這是我第一次使用rake,並且我發現文件依賴關係存在問題。Ruby Rake FILE方法不起作用
進行測試,在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
即文件方法在全部四種情況下什麼都不做。我也嘗試刪除所有file
中的報價(即f1
而不是"#{f1}"
等等),但獲得相同的結果。 顯然,每次我在測試時保存Rakefile.rb
,所以我確信應該觸發其中一個文件方法。
有語法錯誤嗎?它與Windows 10的故障排除?
由於
什麼是'文件'應該做的?你能發佈代碼嗎? – floum