Skip to content

Commit

Permalink
docs: add more installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Vieilledent committed May 29, 2018
1 parent ef7fa7a commit 1abcaf8
Showing 1 changed file with 80 additions and 6 deletions.
86 changes: 80 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ $ cat tmp/deploy-dist/index.json
"robots.txt": "robots.txt"
}
```

## What is an Ember CLI Deploy plugin?

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.
Expand All @@ -25,17 +24,38 @@ For more information on what plugins are and how they work, please refer to the

## Setup

- Requirements
### Requirements

You'll first have to install and configure :

You'll first have to [setup `ember-cli-deploy-s3-index`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index#quick-start).
- [`ember-cli-deploy`](https://github.com/ember-cli-deploy/ember-cli-deploy)
- [`ember-cli-deploy-index-json`](https://github.com/peopledoc/ember-cli-deploy-index-json
- [`ember-cli-deploy-s3-index`](https://github.com/ember-cli-deploy/ember-cli-deploy-s3-index#quick-start).)
- [ember-cli-deploy-build](https://github.com/ember-cli-deploy/ember-cli-deploy-build)
- [ember-cli-deploy-revision-data](https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data)
- [ember-cli-deploy-display-revisions](https://github.com/duizendnegen/ember-cli-deploy-display-revisions)

- Install this plugin
You can do this like so:

``` shell
ember install ember-cli-deploy // ↶ requires
ember install ember-cli-deploy-s3-index // ↶ requires:
ember install ember-cli-deploy-s3
ember install ember-cli-deploy-build
ember install ember-cli-deploy-revision-data
ember install ember-cli-deploy-display-revisions
```

### Install this plugin

```bash
$ ember install ember-cli-deploy-index-json
```

- Configuration
### Configuration

When `ember install ember-cli-deploy` was run, it should have
generated a a file at `your-app/config/deploy.js`.

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

Expand All @@ -49,7 +69,61 @@ s3: {},
}
```

*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.
*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. More on this in the Ember CLI Deploy plugin section.

Here is a full example of this file, getting the Amazon S3 information
from unix environement variables.

``` js
/* eslint-env node */
'use strict';

module.exports = function(deployTarget) {
let ENV = {
s3: {},
'revision-data': {
filePattern: 'index.json'
},
's3-index': {
filePattern: 'index.json'
},
build: {}
};

if (deployTarget === 'development') {
ENV.build.environment = 'development';
// configure other plugins for development deploy target here
}

if (deployTarget === 'staging') {
ENV.build.environment = 'production';
// configure other plugins for staging deploy target here
}

if (deployTarget === 'production') {
ENV.build.environment = 'production';
// configure other plugins for production deploy target here
let s3Config = {
allowOverwrite: process.env.ALLOW_OVERWRITE === 'true' ? true : false,
signatureVersion: 'v4',
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
bucket: process.env.S3_BUCKET_URI,
region: process.env.S3_REGION
};

Object.assign(ENV.s3, s3Config);
Object.assign(ENV['s3-index'], s3Config);
}

// Note: if you need to build some configuration asynchronously, you can return
// a promise that resolves with the ENV object instead of returning the
// ENV object synchronously.
return ENV;
};
```

## Usage

Expand Down

0 comments on commit 1abcaf8

Please sign in to comment.