简体   繁体   English

Rake ::错过任务来源

[英]Rake::Tasks sources missed

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. 我只是开始使用Rake而不是Make来构建我的项目,并且想使用某种“任务模板”来自动化构建。

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? 我的问题是为什么task.sources[] ,这是错过的先决条件? Thanks in advance. 提前致谢。

The prerequisites of a task are accessed with task.prerequisites . 使用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 task.sourcestask.source仅用于根据rdocs中描述的规则构建的任务: http: //ruby-doc.org/stdlib-2.1.2/libdoc/rake/rdoc/Rake/Task 。 HTML#方法-i的源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM