Reputation: 1370
I have a rake task, that depends on another in terms of that it parses its output to determine failure or success.
Currently I do it like this:
task :foo do
puts "OK"
end
task :bar do
if `bundle exec rake foo`.split(/\n/)[-1] == "OK" then
puts "Everything went fine"
else
puts "Something went wrong"
exit 1
end
end
But I would prefer not to run the dependency in a subshell but specify it correctly as in task bar: :foo do
and then check its output, is something like that possible?
Upvotes: 0
Views: 1010
Reputation: 3072
Follow this, it calls one task from other. It helps.
namespace :abc do
task :aa do
"ok"
end
task :bb do
op = Rake::Task["abc:aa"].enhance(["abc:aa"])
p "op=> #{op}"
end
end
Upvotes: 1