gpt4 book ai didi

ruby - Rake 中的常规任务和文件任务有什么区别

转载 作者:数据小太阳 更新时间:2023-10-29 08:40:35 24 4
gpt4 key购买 nike

我目前正在研究使用 Rake 来部署我的项目,并且我正在努力学习 Ruby/Rake。但是有人可以向我解释常规任务和文件任务之间的区别吗?这一直被提及,但我不知道两者之间的区别,我找不到定义?

最佳答案

Martin Fowler 对这些特性做了很好的解释。

File Tasks

The tasks I talked about above are similar to tasks in ant. Rake also supports a slightly different kind of task called a file task which is closer to the notion of tasks in make. Here's another example, slightly simplified, from my web site rakefile.

file 'build/dev/rake.html' => 'dev/rake.xml' do |t|
require 'paper'
maker = PaperMaker.new t.prerequisites[0], t.name
maker.run
end

With a file you are referring to actual files rather than task names. So 'build/dev/rake.html' and 'dev/rake.xml' are actual files. The html file is the output of this task and the xml file is the input. You can think of a file task as telling the build system how to make the output file - indeed this is exactly the notion in make - you list the output files you want and tell make how to make them.

关于ruby - Rake 中的常规任务和文件任务有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7444648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com