Is there a way using Rake to watch depedencies for changes and execute tasks automatically?
For example, given the following 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
It would be great if when I changed greet.c or main.c then hello would automatically execute.
AFAIK rake doesn’t support watching files and directories with a continuous compilation approach.
The buildr project implements a continuous compilation task for java which you can get inspired by to do the job for your project.
Also, it looks like guard might help there. See the guard github profile for implementations using guard. There’s even a Rake extension to do what you want!