New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
returning variables from prerequisites? #199
Comments
There hasn't really been a nice way to handle this. I've just modified Task to include a "value" property which will be the value passed to After a task is completed, this value will be available in the ".value" property on the task. Calling I've just pushed these changes to NPM in v0.5.17. Thanks for the input! |
Awesome! Thanks for the fast turn-around, @mde. I'll be working to bake jake into https://github.com/evantahler/actionhero as a first-class citizen this week. For those of you who got here from google, that means that you can now do this (from my example above): desc("otherTask: prereq");
task("otherTaskPrereq", ["envrionment"], {async: true}, function(){
api = jake.Task["envrionment"].value;
console.log(api)
});
desc("otherTask: invoke");
task("otherTaskInvoke", {async: true}, function(){
var env = jake.Task["envrionment"];
env.addListener('complete', function(){
var api = env.value;
console.log(api)
});
env.invoke();
}); |
I would like to create one jake task to pre-load my environment, and then use that as a prerequisite for other tasks (a very rails-y pattern). However, since none of the jake files share a namespace, I would like to return an 'environment' variable from my
environment
perquisite to my main task:An prototypical environment loader:
I tried 2 methods of "catching" the returned
api
variable, but to no avail:Is such a thing possible?
The text was updated successfully, but these errors were encountered: