forked from apigeecs/apigee-migrate-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
89 lines (83 loc) · 2.41 KB
/
Gruntfile.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
var apigee = require('./config.js');
module.exports = function(grunt) {
//require('time-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
availabletasks: { // task
tasks: {options: {
filter: 'exclude',
tasks: ['mkdir', 'availabletasks', 'warn', 'default']
}} // target
},
exportDevs: {
dest: './data/devs'
},
exportProducts: {
dest: './data/products'
},
exportApps: {
dest: './data/apps'
},
exportProxies: {
dest: './data/proxies'
},
importProxies: {
src: './data/proxies/*.zip'
},
importProducts: {
src: 'data/products/*'
},
importDevs: {
src: 'data/devs/*'
},
importApps: {
src: 'data/apps/*/*'
},
importKeys: {
src: 'data/apps/*/*'
},
deleteKeys: {
src: 'data/apps/*/*'
},
deleteApps: {
src: 'data/apps/*/*'
},
deleteProducts: {
src: 'data/products/*'
},
deleteDevs: {
src: './data/devs/*'
},
deleteProxies: {
src: './data/proxies/*'
},
readCSVDevs: {
in_devs: './input/devs.csv',
out_devs: './data/devs/'
},
readCSVApps: {
in_apps: './input/apps.csv',
out_apps: './data/apps/'
}
});
require('load-grunt-tasks')(grunt);
grunt.loadTasks('tasks');
grunt.registerTask('default', ['availabletasks']);
grunt.registerTask('exportAll', ['exportDevs','exportProducts','exportApps', 'exportProxies']);
grunt.registerTask('importAll', ['importProxies','importDevs','importProducts', 'importApps','importKeys']);
grunt.registerTask('deleteAll', ['warn','deleteKeys','deleteApps','deleteProducts', 'deleteDevs', 'deleteProxies']);
grunt.registerTask('warn', 'Display Warning', function() {
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
var done = this.async();
rl.question('THIS SCRIPT WILL DELETE ONE OR MORE RESOURCES will be deleted from the org - ' + apigee.to.org + ' [' + apigee.to.version + '].' + ' THIS ACTION CANNOT BE ROLLBACK. Do you want to continue (yes/no) ? ', function(answer) {
if (answer.match(/^y(es)?$/i))
done(true);
else
done(false);
});
});
};