-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (28 loc) · 826 Bytes
/
index.js
File metadata and controls
29 lines (28 loc) · 826 Bytes
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
'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var meta = require('jsforce-metadata-tools');
module.exports = function(options) {
return through.obj(function(file, enc, callback) {
var err;
if (file.isNull()) {
return callback(null, file);
}
if (file.isStream()) {
err = new gutil.PluginError('gulp-jsforce-deploy', 'Stream input is not supported');
return callback(err);
}
options.logger = gutil;
meta.deployFromZipStream(file.contents, options)
.then(function(res) {
meta.reportDeployResult(res, gutil, options.verbose);
if (!res.success) {
return callback(new Error('Deploy Failed.'));
}
callback(null, file);
})
.catch(function(err) {
callback(err);
});
});
};