Given a rule
rule '.2' => '.1' do ...
If a.2 doesn't exist and a.1 does exist, then the rule triggers. I'd
expect this.
If a.2 exists and has a timestamp later than a.1, the rule does not
fire. I'd expect this.
If a.2 exists but the timestamp is earlier than a.1, the rule does not
fire. I don't expect this--the target is out of date wrt the source,
and needs rebuilding.
Also, if the dependencies of a rule is an array, then the entries
after the first one seem to be ignored.
I've appended a simple Rakefile that demonstrates this.
So, my question: am I misunderstanding how rules are supposed to work?
Dave
- - - Rakefile - - -
def tidy
rm_rf "rake_test*"
sh "echo >rake_test.1"
sh "echo >rake_test_other"
end
def line
puts "\n\n------------------------------\n\n"
end
task :test do
tidy
# Regular build when target doesn't exist
puts "Should output (In ..)/cat rake_test.1 >rake_test.2"
sh "rake rake_test.2"
line
# Should not rebuild
puts "Should just output (In ...)"
sh "rake rake_test.2"
line
# Touch the source forces rebuild
sh "touch rake_test.1"
puts "Should output (In ..)/cat rake_test.1 >rake_test.2"
sh "rake rake_test.2"
line
# Now touch the second dependency
sh "touch rake_test_other"
puts "Should output (In ..)/cat rake_test.1 >rake_test.2"
sh "rake rake_test.2"
end
rule '.2' => ['.1', 'rake_test_other'] do |t|
"creating #{t.name} from #{t.source}"
sh "cat #{t.source} >#{t.name}"
end
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel