Skip to content

Commit 1abcaf8

Browse files
author
Hugo Vieilledent
committed
docs: add more installation instructions
1 parent ef7fa7a commit 1abcaf8

File tree

1 file changed

+80
-6
lines changed

1 file changed

+80
-6
lines changed

README.md

+80-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ $ cat tmp/deploy-dist/index.json
1616
"robots.txt": "robots.txt"
1717
}
1818
```
19-
2019
## What is an Ember CLI Deploy plugin?
2120

2221
A plugin is an addon that can be executed as a part of the Ember CLI Deploy pipeline. A plugin will implement one or more of the Ember CLI Deploy's pipeline hooks.
@@ -25,17 +24,38 @@ For more information on what plugins are and how they work, please refer to the
2524

2625
## Setup
2726

28-
- Requirements
27+
### Requirements
28+
29+
You'll first have to install and configure :
2930

30-
You'll first have to [setup `ember-cli-deploy-s3-index`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index#quick-start).
31+
- [`ember-cli-deploy`](https://github.com/ember-cli-deploy/ember-cli-deploy)
32+
- [`ember-cli-deploy-index-json`](https://github.com/peopledoc/ember-cli-deploy-index-json
33+
- [`ember-cli-deploy-s3-index`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index#quick-start).)
34+
- [ember-cli-deploy-build](https://github.com/ember-cli-deploy/ember-cli-deploy-build)
35+
- [ember-cli-deploy-revision-data](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data)
36+
- [ember-cli-deploy-display-revisions](https://github.com/duizendnegen/ember-cli-deploy-display-revisions)
3137

32-
- Install this plugin
38+
You can do this like so:
39+
40+
``` shell
41+
ember install ember-cli-deploy // ↶ requires
42+
ember install ember-cli-deploy-s3-index // ↶ requires:
43+
ember install ember-cli-deploy-s3
44+
ember install ember-cli-deploy-build
45+
ember install ember-cli-deploy-revision-data
46+
ember install ember-cli-deploy-display-revisions
47+
```
48+
49+
### Install this plugin
3350

3451
```bash
3552
$ ember install ember-cli-deploy-index-json
3653
```
3754

38-
- Configuration
55+
### Configuration
56+
57+
When `ember install ember-cli-deploy` was run, it should have
58+
generated a a file at `your-app/config/deploy.js`.
3959

4060
Edit `config/deploy.js` so that your configuration looks like the snippet below.
4161

@@ -49,7 +69,61 @@ s3: {},
4969
}
5070
```
5171

52-
*In depth:* The idea is that `revision-data`, `s3-index` and `index-json` have the same `filePattern` value. `index-json` is not present in this example because we're using its default `filePattern` value.
72+
*In depth:* The idea is that `revision-data`, `s3-index` and
73+
`index-json` have the same `filePattern` value. `index-json` is not
74+
present in this example because we're using its default `filePattern` value. More on this in the Ember CLI Deploy plugin section.
75+
76+
Here is a full example of this file, getting the Amazon S3 information
77+
from unix environement variables.
78+
79+
``` js
80+
/* eslint-env node */
81+
'use strict';
82+
83+
module.exports = function(deployTarget) {
84+
let ENV = {
85+
s3: {},
86+
'revision-data': {
87+
filePattern: 'index.json'
88+
},
89+
's3-index': {
90+
filePattern: 'index.json'
91+
},
92+
build: {}
93+
};
94+
95+
if (deployTarget === 'development') {
96+
ENV.build.environment = 'development';
97+
// configure other plugins for development deploy target here
98+
}
99+
100+
if (deployTarget === 'staging') {
101+
ENV.build.environment = 'production';
102+
// configure other plugins for staging deploy target here
103+
}
104+
105+
if (deployTarget === 'production') {
106+
ENV.build.environment = 'production';
107+
// configure other plugins for production deploy target here
108+
let s3Config = {
109+
allowOverwrite: process.env.ALLOW_OVERWRITE === 'true' ? true : false,
110+
signatureVersion: 'v4',
111+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
112+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
113+
bucket: process.env.S3_BUCKET_URI,
114+
region: process.env.S3_REGION
115+
};
116+
117+
Object.assign(ENV.s3, s3Config);
118+
Object.assign(ENV['s3-index'], s3Config);
119+
}
120+
121+
// Note: if you need to build some configuration asynchronously, you can return
122+
// a promise that resolves with the ENV object instead of returning the
123+
// ENV object synchronously.
124+
return ENV;
125+
};
126+
```
53127

54128
## Usage
55129

0 commit comments

Comments
 (0)