/
create-gulp-file.js
57 lines (49 loc) · 1.44 KB
/
create-gulp-file.js
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
55
56
57
module.exports = {
friendlyName: 'Create Gulp File',
description: 'Creates a gulp file from template in the root project directory',
extendedDescription: '',
cacheable: false,
sync: false,
environment: [],
inputs: {
gulpFileSrcPath: {
friendlyName: 'Gulp file source path',
description: 'The directory where the gulp file lives. If not specified as an absolute path, this will be resolved relative to the current working directory.',
example: '../templates/gulpfile.js',
required: true
},
outputDir: {
friendlyName: 'Output directory',
description: 'The path to the directory where gulp file should be placed.',
example: '../../../gulpfile.js',
required: true
}
},
exits: {
error: {
friendlyName: 'error',
description: 'Unexpected error occurred.'
},
success: {
friendlyName: 'then',
description: 'Normal outcome.',
void: true
}
},
fn: function(inputs, exits, env) {
var path = require('path'),
cp = require('machine').build(require('./copy-files'));
cp({
gulpFileSrcPath: path.resolve(__dirname, inputs.gulpFileSrcPath),
outputDir: path.resolve(__dirname, inputs.outputDir)
}).exec({
error: function (err){
console.error('an error occurred- error details:',err);
return exits.error();
},
success: function() {
return exits.success();
}
});
}
};