-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.js
106 lines (84 loc) · 2.42 KB
/
index.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
* Module dependencies
*/
var runDefaultTask = require('./lib/run-default-task');
var helpRunTask = require('./lib/help-run-task');
/**
* Grunt hook
*
* @param {SailsApp} sails
* @return {Dictionary} [hook definition]
*/
module.exports = function (sails) {
/**
* Grunt hook
*
* Build the hook definition.
* (this is returned below)
*
* @type {Dictionary}
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* A core hook for interacting with the Grunt-powered pipeline which
* is the conventional default in all new Sails apps.
*
*
* @event 'hook:grunt:loaded'
* Emitted when the Grunt hook has been automatically loaded by Sails core, and
* triggered the callback in its `initialize` function.
*
* @event 'hook:grunt:done'
* Emitted when the Grunt child process exits with a normal status code.
* (in development, this will not fire until the app is lowered, since grunt-contrib-watch
* keeps the child process active)
*
* @event 'hook:grunt:error'
* Emitted when the Grunt child process exits with a non-zero status code.
*
*
* > In development, note that *neither* the `grunt:hook:done`, *nor* the `grunt:hook:done` event will
* > fire until the app is lowered if you're using the default pipeline.
* > (This is because `grunt-contrib-watch` keeps the child process active.)
*
*
* @stability 2
* @see http://sailsjs.org/documentation/concepts/assets
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
return {
/**
* defaults
*
* The implicit configuration defaults merged into `sails.config` by this hook.
*
* @type {Dictionary}
*/
defaults: {
},
/**
* configure()
*
* @type {Function}
*/
configure: function() {
},
/**
* initialize()
*
* Logic to run when this hook loads.
*/
initialize: function (done) {
// Expose `sails.hooks.grunt.runTask` function.
sails.hooks.grunt.runTask = function (taskName, cb){
helpRunTask(sails, taskName, cb);
};//</define sails.hooks.grunt.runTask()>
return runDefaultTask(sails, done);
},
/**
* sails.hooks.grunt.teardown()
*/
teardown: function (done) {
return done();
}
};
};