On 5/26/07, Jim Weirich <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:
> hi list -
>
> i'm wondering if there is a good way to dynamically create
> namespaces and tasks. currently, i have an ugly string
> generation to eval code that wraps an Xcode project's
> targets/configurations, but i would have to imagine
> there is a better way. looking at the rdocs (for the first
> time), i see a define_task method which sounds good, are there
> any examples of this in use?
Actually, it's much easier than that.
The following bit of code synthesizes creates 10 tasks where task t(n)
depends on t(n-1), except for t0 which depends on nothing:
task :t0
(1..9).each do |i|
task "t#{i}" => "t#{i-1}" do |t|
puts t.name
end
end
No need to delve into define_task and all that.
amazing i overlooked the simple route and instead went so far as to create a
sting to eval. the code necessary was just cut in half :0)
thank you for your help and for rake!
cheers,
jean-pierre
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel