Ruby 即使满足了prereq,如何强制在Rake中执行任务?
是否有任何方法可以强制在Rake中执行任务,即使前提条件已经满足 我正在寻找GNU/make()的--always-make选项的等价物 Rakefile示例:Ruby 即使满足了prereq,如何强制在Rake中执行任务?,ruby,makefile,rake,pipeline,Ruby,Makefile,Rake,Pipeline,是否有任何方法可以强制在Rake中执行任务,即使前提条件已经满足 我正在寻找GNU/make()的--always-make选项的等价物 Rakefile示例: file "myfile.txt" do system "touch myfile.txt" puts "myfile.txt created" end “始终使”选项如何工作: # executing the rule for the first time creates a file: $: rake myfile
file "myfile.txt" do
system "touch myfile.txt"
puts "myfile.txt created"
end
“始终使”选项如何工作:
# executing the rule for the first time creates a file:
$: rake myfile.txt
myfile.txt created
# executing the rule a second time returns no output
# because myfile.txt already exists and is up to date
$: rake myfile.txt
# if the --always-make option is on,
# the file is remade even if the prerequisites are met
$: rake myfile.txt --always-make
myfile.txt created
我正在运行Rake版本0.9.2.2,但在--help和手册页中找不到任何选项。如果我正确理解您的意思,您可以使用手动执行任务 当您运行
rake bar
时,您将看到:
Doing something in foo
Doing something in bar
Doing something in foo
如果使用
Rake::Task
,它将在不检查任何先决条件的情况下执行。如果这对您没有帮助,请告诉我。谢谢,这很有效,尽管我正在寻找从命令行调用rake时使用的选项。若要强制重新检查前提条件,请使用rake::Task[“foo”]。调用。
Doing something in foo
Doing something in bar
Doing something in foo