[Rake-devel] synthesizing namespaces and tasks

jeanpierre at gmail.com jeanpierre at gmail.com
Sat May 26 22:28:11 EDT 2007


On 5/26/07, Jim Weirich <jim at weirichhouse.org> wrote:
>
> jeanpierre at gmail.com 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rake-devel/attachments/20070526/5b08c9ca/attachment.html 


More information about the Rake-devel mailing list