Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,18 @@ Enable adding a meta tag with the current revisionKey into the head of your `ind

### replaceFiles

At deploy-time, the plugin will check your Sentry instance for an existing release under the current `revisionKey`. If a release is found and this is set to `true`, all existing files for the matching release will be deleted before the current build's files are uploaded to Sentry. If this is set to `false`, the files on Sentry will remain untouched and the just-built files will not be uploaded.
At deploy-time, the plugin will check your Sentry instance for an existing release under the current `revisionKey`. If a release is found and this is set to `true`, all existing files for the matching release will be deleted before the current build's files are uploaded to Sentry. If this is set to `false`, the files on Sentry will remain untouched and the just-built files will not be uploaded.

*Default* true

### gzippedFiles

The list of files that have been gziped. This option should be relative to `distDir`. By default, this option will use the `gzippedFiles` property of the deployment context, provided by [ember-cli-deploy-gzip][13].

This option will be used to determine which files in `distDir`, that match `filePattern`, require the gzip content encoding when uploading.

*Default:* `context.gzippedFiles`

## Prerequisites

The following properties are expected to be present on the deployment `context` object:
Expand Down Expand Up @@ -205,3 +213,4 @@ It works. We use it in production at [Hatchet](https://hatchet.is).
[10]: http://ember-cli.github.io/ember-cli-deploy/plugins "Plugin Documentation"
[11]: https://github.com/zapnito/ember-cli-deploy-build "ember-cli-deploy-build"
[12]: https://github.com/zapnito/ember-cli-deploy-revision-data "ember-cli-deploy-revision-data"
[13]: https://github.com/ember-cli-deploy/ember-cli-deploy-gzip "ember-cli-deploy-gzip"
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ module.exports = {
return context.revisionData && context.revisionData.revisionKey;
},
enableRevisionTagging: true,

gzippedFiles: function(context) {
return context.gzippedFiles || []; // e.g. from ember-cli-deploy-gzip
},

replaceFiles: true
},
requiredConfig: ['publicUrl', 'sentryUrl', 'sentryOrganizationSlug', 'sentryProjectSlug', 'sentryApiKey', 'revisionKey'],
Expand Down Expand Up @@ -135,6 +140,11 @@ module.exports = {
throw new SilentError('Creating release failed');
});
},
_isFileGzipped(filePath) {
var gzippedFiles = this.readConfig('gzippedFiles') || [];
var isGzipped = gzippedFiles.indexOf(filePath) >= 0;
return isGzipped;
},
_doUpload: function doUpload() {
return this._getFilesToUpload()
.then(this._uploadFileList.bind(this));
Expand Down Expand Up @@ -173,6 +183,10 @@ module.exports = {
file: fs.createReadStream(fileName),
};

if (this._isFileGzipped(filePath)) {
formData.header = 'content-encoding:gzip';
}

return request({
uri: urljoin(this.releaseUrl, 'files/'),
method: 'POST',
Expand Down