【发布时间】:2016-06-13 08:13:54
【问题描述】:
这是我第一次使用 rake,我发现文件依赖存在问题。
为了进行测试,我在Rakefile.rb 中输入了这段代码:
task :ffile do
f1 = "config.yaml"
f2 = "Rakefile.rb"
if File.file? f1 then puts "## test file task on #{f1}" end
if File.file? f2 then puts "## test file task on #{f2}" end
file "#{f1}" => "#{f2}" do
puts "lol"
end
file "#{f2}" => "#{f1}" do
puts "lul"
end
file "#{f1}" do
puts "lil"
end
file "#{f2}" do
puts "lal"
end
end
我在 Windows 10 上,并且在运行时
rake ffile
结果是
Starting rake operations...
## test file task on config.yaml
## test file task on Rakefile.rb
即文件方法在所有四种情况下都不做任何事情。我还尝试删除引号(即f1 而不是"#{f1}" 等等所有file)但获得相同的结果。
很明显,每次我在测试时保存Rakefile.rb,所以我确定应该是触发文件方法之一。
有语法错误?是 Windows 10 的故障排除吗?
谢谢
【问题讨论】:
-
file应该做什么?可以发一下代码吗?
标签: ruby methods rake rakefile