<commit_before># Ember-cli-s3-sync

## TODO
- [ ] write tests
- [ ] write documentation for each function
- [ ] write documentation describing flow, configurable options, general how to use
- [ ] deal with errors in conventional way (however ember-cli deals with them);
- [ ] ability to save config file as `config-s3.json` in cwd
- [ ] probably add `config-s3.json` to .gitignore
- [ ] ability to specify optional params in `config-s3.json` to be prompted for
- [ ] ability to sync individual files to s3 bucket
- [ ] ability to create bucket if specified bucket doesn't exist
- [ ] ability to authenticate using IAM roles
- [ ] ability to do a dryrun
- [ ] update s3 with file's ContentMD5, preferrably async after upload

This README outlines the details of collaborating on this Ember addon.

## Installation

* `git clone` this repository
* `npm install`
* `bower install`

## Running

* `ember server`
* Visit your app at http://localhost:4200.

## Running Tests

* `ember test`
* `ember test --server`

## Building

* `ember build`

For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).<commit_msg>update readme with basic usage and goals<commit_after># Ember-cli-s3-sync
This is a WIP. However it does work as stands for uploading your /dist directory to specified bucket. Still -use at your own risk :)

## TODO
- [ ] write tests
- [ ] write documentation for each function
- [ ] write documentation describing flow, configurable options, general how to use
- [ ] deal with errors in conventional way (however ember-cli deals with them);
- [ ] ability to save config file as `config-s3.json` in project's directory
- [ ] probably add `config-s3.json` to .gitignore
- [ ] ability to specify optional params in `config-s3.json` to be prompted for
- [ ] ability to sync individual files to s3 bucket
- [ ] ability to create bucket if specified bucket doesn't exist
- [ ] ability to authenticate using IAM roles
- [ ] ability to do a dryrun
- [ ] ability to skip build task and just deploy a specified directory
- [ ] update s3 with file's ContentMD5, preferrably async after upload



## Install
* `npm install ember-cli-s3-sync --save-dev`
* `npm install`

## Using with your AWS creds
  This addon uses [`aws-sdk`](https://github.com/aws/aws-sdk-js) so you get some pretty stable behavior when making requests to S3. AWS credentials can be provided in several ways, hopefully satisfying most development environments. Listed below is the order of preference for AWS credentials
  
Anything included as a command line argument *should be* king of the hill. However here is current order:
  1. shared credentials file at [~/.aws/credentials file.](http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs)
  2. `ember deploy:s3 --awsSecret=my-secret --awsKey=my-cool-key`
  3. these shell environment variables: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`
  4. [TODO] **config-s3.json**:

  ```
    {
      "options": { "accessKeyId": "mykeee", "secretAccessKey": "myseeecret" }
    }
  ```
  
**note** if none of the above are provided. You will be prompted for credentials -blocking the deploy (keep this in mind if using with automated/continuous deployment systems).

## How to use
`ember deploy:s3 --environment=development --awsKey=heybob --awsSecret=asdfasdf --awsBucket=buckets-o-fun`
  - this builds a development version of your app and deploys all files in the `/dist` directory to the S3 bucket "buckets-o-fun"

`ember deploy:s3`
  - this will build development version of your app and prompt you for awsKey, awsSecret, and awsBucket

possible cli arguments:
  - `environment` (optional) uses app's default
  - `outputPath` (optional) uses app's default `/dist`
  - `awsKey` (required. will prompt if not provided as cli arg)
  - `awsSecret` (required. will prompt if not provided as cli arg)
  - `awsBucket` (required. will prompt if not provided as cli arg)
  - `awsRegion` (optional. will verify the specified region with aws)

## Configuring deployment
  - **config-s3.json**
  - WIP
{'fraction_non_alphanumeric': 0.10167435088570735, 'fraction_numerical': 0.008250424654210144, 'mean_word_length': 3.8665879574970483, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6899741', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1203, 'n_words': 501}