Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Getting namespaces from rake
Chris Kilmer
10/26/2007 2:56:00 PM
I am trying to automate the process of running all of the rake tasks
within a specific directory. Currently, we have a file that looks like
this:
namespace :myapp do
namespace :bootstrap do
desc "Bootstrap users"
task :users do
end
desc "Bootstrap categories"
task :categories do
end
desc "Bootstrap all"
task :all do
tasks = %w[users categories]
tasks.each do |task|
Rake::Task["myapp:bootstrap:#{task}"].invoke
end
end
end
end
I would like a way to have the :all task look at the myapp:bootstrap
namespace and provide a list of tasks automatically. We want to avoid
someone adding a bootstrap task and forgetting to add it to the array in
the all task (i.e. %w[...)].
I have read through the rake docs and look at the source, but I'm just
not getting it.
I've looked the following:
tasks = Rake::NameSpace(task_manager, "myapp:bootstrap)
Of course, this doesn't work because I can't figure out how to get and
use a TaskManager object.
I'm sure there is a way to get the task list other than grepping rake -T
myapp:bootstrap. Can anyone provide some insight? All help
appreciated.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Getting namespaces from rake
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password