Skip to content

Commit

Permalink
Merge pull request #88 from backspace/ext-promise-to-rsvp
Browse files Browse the repository at this point in the history
Replace `ember-cli/ext/promise` with `rsvp`
  • Loading branch information
ghedamat authored Mar 21, 2017
2 parents 923b1b3 + 91db0ba commit e359304
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions bin/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

var EOL = require('os').EOL;
var multiline = require('multiline');
var Promise = require('ember-cli/lib/ext/promise');
var RSVP = require('rsvp');
var GitHubApi = require('github');

var github = new GitHubApi({version: '3.0.0'});
var compareCommits = Promise.denodeify(github.repos.compareCommits);
var compareCommits = RSVP.denodeify(github.repos.compareCommits);
var currentVersion = 'v' + require('../package').version;

var user = 'ember-cli-deploy';
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* jshint node: true */
'use strict';

var Promise = require('ember-cli/lib/ext/promise');
var RSVP = require('rsvp');
var minimatch = require('minimatch');
var DeployPluginBase = require('ember-cli-deploy-plugin');
var S3 = require('./lib/s3');
Expand Down Expand Up @@ -99,7 +99,7 @@ module.exports = {
if (error) {
this.log(error.stack, { color: 'red' });
}
return Promise.reject(error);
return RSVP.reject(error);
}
});
return new DeployPlugin();
Expand Down
12 changes: 6 additions & 6 deletions lib/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var fs = require('fs');
var path = require('path');
var mime = require('mime');

var Promise = require('ember-cli/lib/ext/promise');
var RSVP = require('rsvp');

var _ = require('lodash');

Expand Down Expand Up @@ -97,10 +97,10 @@ module.exports = CoreObject.extend({
return _.difference(filePaths, manifestEntries);
}).catch(function(/* reason */){
plugin.log("Manifest not found. Disabling differential deploy.", { color: 'yellow', verbose: true });
return Promise.resolve(filePaths);
return RSVP.resolve(filePaths);
});
} else {
return Promise.resolve(filePaths);
return RSVP.resolve(filePaths);
}
},

Expand Down Expand Up @@ -155,7 +155,7 @@ module.exports = CoreObject.extend({
params.ContentEncoding = 'gzip';
}

return new Promise(function(resolve, reject) {
return new RSVP.Promise(function(resolve, reject) {
this._client.putObject(params, function(error) {
if (error) {
reject(error);
Expand All @@ -174,7 +174,7 @@ module.exports = CoreObject.extend({
this._currentEnd += currentBatch.length;

//Execute our current batch of promises
return Promise.all(currentBatch.map(function (filePath) {
return RSVP.all(currentBatch.map(function (filePath) {
return this._putObject(filePath, options, filePaths);
}.bind(this)))
//Then check if we need to execute another batch
Expand All @@ -193,7 +193,7 @@ module.exports = CoreObject.extend({
return this._putObjectsBatch(filePaths, options);
}

return Promise.all(filePaths.map(function (filePath) {
return RSVP.all(filePaths.map(function (filePath) {
return this._putObject(filePath, options, filePaths);
}.bind(this)));
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"lodash": "^4.17.4",
"mime": "^1.3.4",
"minimatch": "^3.0.3",
"proxy-agent": "^2.0.0"
"proxy-agent": "^2.0.0",
"rsvp": "^3.5.0"
},
"devDependencies": {
"broccoli-asset-rev": "^2.4.5",
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/index-nodetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);

var assert = chai.assert;
var Promise = require('ember-cli/lib/ext/promise');
var RSVP = require('rsvp');

describe('s3 plugin', function() {
var subject;
Expand All @@ -32,7 +32,7 @@ describe('s3 plugin', function() {
ui: mockUi,
uploadClient: {
upload: function(options) {
return Promise.resolve(['app.css', 'app.js']);
return RSVP.resolve(['app.css', 'app.js']);
}
},
config: {
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('s3 plugin', function() {

context.uploadClient = {
upload: function(opts) {
return Promise.reject(new Error('something bad went wrong'));
return RSVP.reject(new Error('something bad went wrong'));
}
};

Expand Down

0 comments on commit e359304

Please sign in to comment.