Reputation: 1108
I just start using Rake instead of Make for building my projects, and would like to use some kind of "task template" for automating the building.
Consider the following snippets:
task :test1 => ['1', '2']
task :test2 => ['3', '4']
Rake::Tasks.each do |task|
p task
p task.sources
end
The output is:
$ rake
<Rake::Task test1 => [1, 2]>
[]
<Rake::Task test2 => [3, 4]>
[]
My question is why task.sources
is []
, that is the prerequisites are missed? Thanks in advance.
Upvotes: 3
Views: 36
Reputation: 2536
The prerequisites of a task are accessed with task.prerequisites
.
task.sources
and task.source
is only used for tasks that are built from a rule as described in the rdocs: http://ruby-doc.org/stdlib-2.1.2/libdoc/rake/rdoc/Rake/Task.html#method-i-source
Upvotes: 1