how to pass parameter to jake task like that namespace:task parameter?
I would like to have generators for my migration like:
jake migration:create <name>
jake migration:remove <name>
jake migration:execute <name>
code is
namespace('migration', function(){
desc('Create migration file');
task('create', [], function(params) {
console.log(arguments);
//some code for creation
开发者_StackOverflow中文版 });
desc('Remove migration file');
task('remove', [], function(params) {
console.log(arguments);
//some code for removing
});
desc('Execute migration file');
task('execute', [], function(params) {
console.log(arguments);
//some code for executing
});
});
but I didn't find how to pass parameter <name>
inside 'namespaced' jake task.
Could you please help me?
UPD:
even examples from https://github.com/isaacs/node-jake "Passing parameters to jake" doesn't work for me, every time arguments
is empty,
any suggestion?
You should check: https://github.com/mde/jake
You pass parameters as comma separated list:
jake migration:create[run,foo,bar]
and then catch them in you function as params:
namespace('migration', function(){
desc('Create migration file');
task('create', [], function(p1,p2,p3) {
console.log(p1,p2,p3);
//some code for creation
});
desc('Remove migration file');
task('remove', [], function(p1,p2,p3) {
console.log(p1,p2,p3);
//some code for removing
});
desc('Execute migration file');
task('execute', [], function(p1,p2,p3) {
console.log(p1,p2,p3);
//some code for executing
});
});
精彩评论