0
我開始咕嚕咕嚕,我已經定義了這個任務,就像一個魅力的工作:發動對git的咕嚕任務傳球PARAMS提交
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
force: false,
options: {
evil: true,
regexdash: true,
browser: true,
wsh: true,
trailing: true,
multistr: true,
sub: true,
loopfunc: true,
expr: true,
jquery: true,
newcap: true,
plusplus: false,
curly: true,
eqeqeq: true,
globals: {
jQuery: true
}
},
src: ['workspace/**/*.js']
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('default', ['jshint:src']);
};
現在,我想發動這個任務經過SRC像PARAM (使用git提交的文件)。
我從嘗試這樣一個預提交腳本在我git的文件夾,但它簡化版,工作:
var exec = require('child_process').exec;
exec('grunt jshint', {
cwd: 'C:\\workspace',
src: 'subfolder\\**\\*.js'
}, function (err, stdout, stderr) {
console.log(stdout);
var exitCode = 0;
if (err) {
console.log(stderr);
exitCode = -1;
}
process.exit(exitCode);
});
如何傳遞的執行時間PARAMS我咕嚕任務?
非常感謝,最好的問候。
感謝您的回答,它爲我工作。 –