Skip to content

Commit af04f14

Browse files
kturneylukemelia
authored andcommitted
Dependency Upgrades (#84)
* update deps * update some dev deps. fix tests that were mixing done and returning a promise * stick to core-object@2 for node 0.12 support * use same core-object semver as ember-cli-deploy
1 parent e4c1eb8 commit af04f14

File tree

4 files changed

+32
-51
lines changed

4 files changed

+32
-51
lines changed

lib/s3.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,48 @@ var _ = require('lodash');
1010

1111
module.exports = CoreObject.extend({
1212
init: function(options) {
13-
this._plugin = options.plugin;
13+
this._super(options);
1414
var AWS = require('aws-sdk');
1515
var s3Options = {
16-
region: this._plugin.readConfig('region')
16+
region: this.plugin.readConfig('region')
1717
};
1818

19-
const proxy = this._plugin.readConfig('proxy');
19+
const proxy = this.plugin.readConfig('proxy');
2020
if (proxy) {
21-
this._proxyAgent = this._plugin.readConfig('proxyAgent') || require('proxy-agent');
21+
this._proxyAgent = this.plugin.readConfig('proxyAgent') || require('proxy-agent');
2222
s3Options.httpOptions = {
2323
agent: this._proxyAgent(proxy)
2424
};
2525
}
2626

27-
const accessKeyId = this._plugin.readConfig('accessKeyId');
28-
const secretAccessKey = this._plugin.readConfig('secretAccessKey');
29-
const sessionToken = this._plugin.readConfig('sessionToken');
30-
const profile = this._plugin.readConfig('profile');
31-
const signatureVersion = this._plugin.readConfig('signatureVersion');
27+
const accessKeyId = this.plugin.readConfig('accessKeyId');
28+
const secretAccessKey = this.plugin.readConfig('secretAccessKey');
29+
const sessionToken = this.plugin.readConfig('sessionToken');
30+
const profile = this.plugin.readConfig('profile');
31+
const signatureVersion = this.plugin.readConfig('signatureVersion');
3232

3333
if (accessKeyId && secretAccessKey) {
34-
this._plugin.log('Using AWS access key id and secret access key from config', { verbose: true });
34+
this.plugin.log('Using AWS access key id and secret access key from config', { verbose: true });
3535
s3Options.accessKeyId = accessKeyId;
3636
s3Options.secretAccessKey = secretAccessKey;
3737
}
3838

3939
if (signatureVersion) {
40-
this._plugin.log('Using signature version from config', { verbose: true });
40+
this.plugin.log('Using signature version from config', { verbose: true });
4141
s3Options.signatureVersion = signatureVersion;
4242
}
4343

4444
if (sessionToken) {
45-
this._plugin.log('Using AWS session token from config', { verbose: true });
45+
this.plugin.log('Using AWS session token from config', { verbose: true });
4646
s3Options.sessionToken = sessionToken;
4747
}
4848

49-
if (profile && !this._plugin.readConfig('s3Client')) {
50-
this._plugin.log('Using AWS profile from config', { verbose: true });
49+
if (profile && !this.plugin.readConfig('s3Client')) {
50+
this.plugin.log('Using AWS profile from config', { verbose: true });
5151
AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile: profile });
5252
}
5353

54-
this._client = this._plugin.readConfig('s3Client') || new AWS.S3(s3Options);
54+
this._client = this.plugin.readConfig('s3Client') || new AWS.S3(s3Options);
5555
},
5656

5757
upload: function(options) {
@@ -73,7 +73,7 @@ module.exports = CoreObject.extend({
7373
},
7474

7575
_determineFilePaths: function(options) {
76-
var plugin = this._plugin;
76+
var plugin = this.plugin;
7777
var filePaths = options.filePaths || [];
7878
if (typeof filePaths === 'string') {
7979
filePaths = [filePaths];
@@ -105,7 +105,7 @@ module.exports = CoreObject.extend({
105105
},
106106

107107
_putObject: function(filePath, options, filePaths) {
108-
var plugin = this._plugin;
108+
var plugin = this.plugin;
109109
var cwd = options.cwd;
110110
var bucket = options.bucket;
111111
var prefix = options.prefix;

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@
2121
"dependencies": {
2222
"aws-sdk": "^2.6.12",
2323
"chalk": "^1.0.0",
24-
"core-object": "^1.1.0",
24+
"core-object": "^2.0.0",
2525
"ember-cli-babel": "^5.1.7",
2626
"ember-cli-deploy-plugin": "^0.2.2",
27-
"lodash": "^3.9.3",
27+
"lodash": "^4.17.4",
2828
"mime": "^1.3.4",
2929
"minimatch": "^3.0.3",
3030
"proxy-agent": "^2.0.0"
3131
},
3232
"devDependencies": {
3333
"broccoli-asset-rev": "^2.4.5",
34+
"chai": "^3.5.0",
35+
"chai-as-promised": "^6.0.0",
3436
"ember-ajax": "^2.4.1",
35-
"chai": "^2.2.0",
36-
"chai-as-promised": "^5.0.0",
3737
"ember-cli": "2.10.0",
3838
"ember-cli-app-version": "^2.0.0",
3939
"ember-cli-dependency-checker": "^1.3.0",
@@ -52,9 +52,9 @@
5252
"ember-load-initializers": "^0.5.1",
5353
"ember-resolver": "^2.0.3",
5454
"github": "^0.2.4",
55-
"glob": "^5.0.5",
55+
"glob": "^7.1.1",
5656
"loader.js": "^4.0.10",
57-
"mocha": "^2.2.4",
57+
"mocha": "^3.2.0",
5858
"multiline": "^1.0.2"
5959
},
6060
"engines": {

tests/unit/index-nodetest.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ describe('s3 plugin', function() {
253253
});
254254
});
255255

256-
it('calls proxy agent if a proxy is specified', function(done) {
256+
it('calls proxy agent if a proxy is specified', function() {
257257
var plugin = subject.createDeployPlugin({
258258
name: 's3'
259259
});
@@ -266,15 +266,12 @@ describe('s3 plugin', function() {
266266
plugin.beforeHook(context);
267267
plugin.configure(context);
268268

269-
return assert.isFulfilled(plugin.upload(context)).then(function(){
269+
assert.isFulfilled(plugin.upload(context)).then(function(){
270270
assert.equal(assertionCount, 1);
271-
done();
272-
}).catch(function(reason){
273-
done(reason.actual.stack);
274271
});
275272
});
276273

277-
it('sets the appropriate header if the file is inclued in gzippedFiles list', function(done) {
274+
it('sets the appropriate header if the file is inclued in gzippedFiles list', function() {
278275
var plugin = subject.createDeployPlugin({
279276
name: 's3'
280277
});
@@ -301,9 +298,6 @@ describe('s3 plugin', function() {
301298
plugin.beforeHook(context);
302299
return assert.isFulfilled(plugin.upload(context)).then(function(){
303300
assert.equal(assertionCount, 2);
304-
done();
305-
}).catch(function(reason){
306-
done(reason.actual.stack);
307301
});
308302
});
309303
});

tests/unit/lib/s3-nodetest.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ describe('s3', function() {
241241
});
242242

243243
describe('with a manifestPath specified', function () {
244-
it('uploads all files when manifest is missing from server', function (done) {
244+
it('uploads all files when manifest is missing from server', function () {
245245
var options = {
246246
filePaths: ['app.js', 'app.css'],
247247
cwd: process.cwd() + '/tests/fixtures/dist',
@@ -260,13 +260,10 @@ describe('s3', function() {
260260
assert.match(mockUi.messages[3], /- js-app\/app\.css/);
261261
assert.match(mockUi.messages[4], /- js-app\/manifest\.txt/);
262262
assert.deepEqual(filesUploaded, ['app.js', 'app.css', 'manifest.txt']);
263-
done();
264-
}).catch(function(reason) {
265-
done(reason);
266263
});
267264
});
268265

269-
it('only uploads missing files when manifest is present on server', function (done) {
266+
it('only uploads missing files when manifest is present on server', function () {
270267
s3Client.getObject = function(params, cb) {
271268
cb(undefined, {
272269
Body: "app.js"
@@ -290,13 +287,10 @@ describe('s3', function() {
290287
assert.match(mockUi.messages[2], /- js-app\/app\.css/);
291288
assert.match(mockUi.messages[3], /- js-app\/manifest\.txt/);
292289
assert.deepEqual(filesUploaded, ['app.css', 'manifest.txt']);
293-
done();
294-
}).catch(function(reason) {
295-
done(reason);
296290
});
297291
});
298292

299-
it('does not upload manifest.txt when one of the files does not succeed uploading', function(done) {
293+
it('does not upload manifest.txt when one of the files does not succeed uploading', function() {
300294
s3Client.putObject = function(params, cb) {
301295
if (params.Key === 'js-app/app.css') {
302296
cb('error uploading');
@@ -320,9 +314,6 @@ describe('s3', function() {
320314
assert.match(mockUi.messages[0], /- Downloading manifest for differential deploy.../);
321315
assert.match(mockUi.messages[1], /- Manifest not found. Disabling differential deploy\./);
322316
assert.match(mockUi.messages[2], /- js-app\/app\.js/);
323-
done();
324-
}).catch(function(reason) {
325-
done(reason);
326317
});
327318
});
328319
});
@@ -376,7 +367,7 @@ describe('s3', function() {
376367
});
377368
});
378369

379-
it('uploads the correct number of batches', function (done) {
370+
it('uploads the correct number of batches', function () {
380371
var s3Params;
381372
var requests = 0;
382373

@@ -412,14 +403,10 @@ describe('s3', function() {
412403
return subject.upload(options)
413404
.then(function () {
414405
assert.equal(requests, 4);
415-
done();
416-
})
417-
.catch(function (reason) {
418-
done(reason);
419406
});
420407
});
421408

422-
it('rejects if an upload fails', function (done) {
409+
it('rejects if an upload fails', function () {
423410
s3Client.putObject = function(params, cb) {
424411
cb('error uploading');
425412
};
@@ -433,7 +420,7 @@ describe('s3', function() {
433420

434421
var promises = subject.upload(options);
435422

436-
return assert.isRejected(promises).then(function () { done(); });
423+
return assert.isRejected(promises);
437424
});
438425
});
439426
});

0 commit comments

Comments
 (0)