Skip to content

Commit e359304

Browse files
authored
Merge pull request #88 from backspace/ext-promise-to-rsvp
Replace `ember-cli/ext/promise` with `rsvp`
2 parents 923b1b3 + 91db0ba commit e359304

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

bin/changelog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
var EOL = require('os').EOL;
1515
var multiline = require('multiline');
16-
var Promise = require('ember-cli/lib/ext/promise');
16+
var RSVP = require('rsvp');
1717
var GitHubApi = require('github');
1818

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

2323
var user = 'ember-cli-deploy';

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* jshint node: true */
22
'use strict';
33

4-
var Promise = require('ember-cli/lib/ext/promise');
4+
var RSVP = require('rsvp');
55
var minimatch = require('minimatch');
66
var DeployPluginBase = require('ember-cli-deploy-plugin');
77
var S3 = require('./lib/s3');
@@ -99,7 +99,7 @@ module.exports = {
9999
if (error) {
100100
this.log(error.stack, { color: 'red' });
101101
}
102-
return Promise.reject(error);
102+
return RSVP.reject(error);
103103
}
104104
});
105105
return new DeployPlugin();

lib/s3.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var fs = require('fs');
44
var path = require('path');
55
var mime = require('mime');
66

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

99
var _ = require('lodash');
1010

@@ -97,10 +97,10 @@ module.exports = CoreObject.extend({
9797
return _.difference(filePaths, manifestEntries);
9898
}).catch(function(/* reason */){
9999
plugin.log("Manifest not found. Disabling differential deploy.", { color: 'yellow', verbose: true });
100-
return Promise.resolve(filePaths);
100+
return RSVP.resolve(filePaths);
101101
});
102102
} else {
103-
return Promise.resolve(filePaths);
103+
return RSVP.resolve(filePaths);
104104
}
105105
},
106106

@@ -155,7 +155,7 @@ module.exports = CoreObject.extend({
155155
params.ContentEncoding = 'gzip';
156156
}
157157

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

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

196-
return Promise.all(filePaths.map(function (filePath) {
196+
return RSVP.all(filePaths.map(function (filePath) {
197197
return this._putObject(filePath, options, filePaths);
198198
}.bind(this)));
199199
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"lodash": "^4.17.4",
2828
"mime": "^1.3.4",
2929
"minimatch": "^3.0.3",
30-
"proxy-agent": "^2.0.0"
30+
"proxy-agent": "^2.0.0",
31+
"rsvp": "^3.5.0"
3132
},
3233
"devDependencies": {
3334
"broccoli-asset-rev": "^2.4.5",

tests/unit/index-nodetest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var chaiAsPromised = require("chai-as-promised");
55
chai.use(chaiAsPromised);
66

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

1010
describe('s3 plugin', function() {
1111
var subject;
@@ -32,7 +32,7 @@ describe('s3 plugin', function() {
3232
ui: mockUi,
3333
uploadClient: {
3434
upload: function(options) {
35-
return Promise.resolve(['app.css', 'app.js']);
35+
return RSVP.resolve(['app.css', 'app.js']);
3636
}
3737
},
3838
config: {
@@ -241,7 +241,7 @@ describe('s3 plugin', function() {
241241

242242
context.uploadClient = {
243243
upload: function(opts) {
244-
return Promise.reject(new Error('something bad went wrong'));
244+
return RSVP.reject(new Error('something bad went wrong'));
245245
}
246246
};
247247

0 commit comments

Comments
 (0)