[Rake-devel] synthesizing namespaces and tasks
Jim Weirich
jim at weirichhouse.org
Sat May 26 19:42:05 EDT 2007
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.
--
-- Jim Weirich jim at weirichhouse.org http://onestepback.org
-- In theory, practice and theory are the same.
-- In practice, they are different.
More information about the Rake-devel
mailing list