rake
rake copied to clipboard
Fix the issues #173 and #192 with the 'Rake::Task#results'
This PR fixes issues #173 and #192 by introducing the Rake::Task#results method.
We could also have the RakeTask#status or RakeTask#exit_status methods (and maybe keep #results private).
However, we would need to inspect the result of each task execution and adopt a convention for statuses. Thus, exposing #results seems a bit more flexible and permits this kind of use case:
task default: %w[test]
task :test do
puts 'Testing...'
:success
end
require "rake"
Rake.application.load_rakefile
task = Rake::Task[:test]
task.invoke
p task.results
# => [:success]
(I just rebased the branch to solve conflicts)