耙子 - 注意变化

时间:2012-02-14 09:08:45

标签: rake

有没有办法使用Rake来监视变更的依赖关系并自动执行任务?

例如,给定以下Rakefile

file 'main.o' => ["main.c", "greet.h"] do
  sh "cc -c -o main.o main.c"
end

file 'greet.o' => ['greet.c'] do
  sh "cc -c -o greet.o greet.c"
end

file "hello" => ["main.o", "greet.o"] do
  sh "cc -o hello main.o greet.o"
end

如果我更改greet.cmain.c然后hello会自动执行,那就太棒了。

2 个答案:

答案 0 :(得分:1)

AFAIK rake不支持使用连续编译方法观看文件和目录。

buildr项目为java实现continuous compilation task,你可以从中为你的项目做好工作。

此外,看起来guard可能对此有所帮助。有关使用guard的实现,请参阅guard github配置文件。甚至还有do what you want!

的Rake扩展名

答案 1 :(得分:0)

还有重新运行https://github.com/alexch/rerun。您可以执行rerun rake来观看和运行默认任务。