I'm sorry, the example Rakefile was a little convoluted from playing around
with it, It should be:
--------
rule (/-/) => lambda{|t| t.split('-')} do |t|
end
rule (/^[^-]*$/) do |t|
puts t.name
end
---------
Cheers
----- Original Message ----
From: miki <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, August 6, 2008 2:43:43 PM
Subject: [Rake-devel] Lambda for multiple prerequisite rules
Hi all, I just came across what I think is a bug.
The following Rakefile
-----
rule (/a-b-c/) => lambda{|t| [[t.split('-')]]} do |t|
end
rule (/^[^-]*$/) do |t|
puts t.name
end
-----
When invoked should render:
$ rake a-b-c-d-e
a
b
c
d
e
but instead renders:
$ rake a-b-c-d-e
a
a
a
a
a
Apparently the rake.rb file reads:
def attempt_rule(task_name, extensions, block, level)
sources = make_sources(task_name, extensions)
prereqs = sources.collect { |source|
if File.exist?(source) || Rake::Task.task_defined?(source)
source
elsif parent = enhance_with_matching_rule(sources.first, level+1)
parent.name
else
return nil
end
}
task = FileTask.define_task({task_name => prereqs}, &block)
task.sources = prereqs
task
end
I belive line:
elsif parent = enhance_with_matching_rule(sources.first, level+1)
should be:
elsif parent = enhance_with_matching_rule(source, level+1)
As this fixes the problem.
Kind regards
Miguel
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel