This repository was archived by the owner on Apr 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (49 loc) · 1.71 KB
/
index.js
File metadata and controls
54 lines (49 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* jshint node: true */
var BasePlugin = require('ember-cli-deploy-plugin');
var minimatch = require('minimatch');
var Uploader = require('./lib/uploader');
var RSVP = require('rsvp');
module.exports = {
name: 'ember-cli-deploy-cobot-scss',
createDeployPlugin: function(options) {
var DeployPlugin = BasePlugin.extend({
name: options.name,
defaultConfig: {
srcDir: 'scss',
blankOut: [],
distDir: function(context) {
return context.distDir;
},
distFiles: function(context) {
return context.distFiles || [];
},
},
requiredConfig: ['accessToken', 'bundleUrl'],
upload: function(context) {
var that = this;
var blankOut = this.readConfig('blankOut');
var distFiles = this.readConfig('distFiles');
var filesToUpload = distFiles.filter(minimatch.filter(this.readConfig('srcDir') + '/**/*.scss', { matchBase: true }));
this.log('Uploading SCSS...');
this.log('Files to upload: ' + filesToUpload, {verbose: true});
var uploader = new Uploader({
accessToken: this.readConfig('accessToken'),
bundleUrl: this.readConfig('bundleUrl'),
srcDir: this.readConfig('srcDir'),
baseDir: this.readConfig('distDir'),
logger: this
});
return new RSVP.Promise(function(resolve, reject) {
uploader.uploadFiles(filesToUpload, blankOut).then(function() {
that.log('Done uploading SCSS.');
resolve();
}, function(error) {
that.log('Error uploading SCSS: ' + error, { color: 'red' });
reject(error);
});
});
}
});
return new DeployPlugin();
}
};