forked from ionic-team/ionic-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.js
More file actions
49 lines (40 loc) · 1.1 KB
/
hooks.js
File metadata and controls
49 lines (40 loc) · 1.1 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
var fs = require('fs'),
path = require('path'),
argv = require('optimist').argv,
Q = require('q'),
shelljs = require('shelljs'),
Task = require('./task').Task,
IonicStats = require('./stats').IonicStats,
_ = require('underscore'),
IonicProject = require('./project'),
IonicInfo = require('./info').IonicTask
IonicAppLib = require('ionic-app-lib'),
Hooks = IonicAppLib.hooks;
shelljs.config.silent = true;
var IonicTask = function() {};
IonicTask.prototype = new Task();
IonicTask.prototype.run = function run(ionic) {
var self = this;
this.ionic = ionic;
var cmd = argv._[1];
try {
switch(cmd) {
case 'add':
Hooks.add(process.cwd());
break;
case 'remove':
Hooks.remove(process.cwd());
break;
case 'perm':
case 'permissions':
Hooks.setHooksPermission(process.cwd());
break;
default:
console.log('Please supply a command - either add or remove'.red.bold);
}
} catch (ex) {
console.log('error:', ex, ex.stack);
}
IonicStats.t();
};
exports.IonicTask = IonicTask;