Rake tasks with parameters


#1

Hi,

I have some Rake tasks (actually these are Rails tasks to load db
fixtures) that take parameters, for example:

$ rake db:fixtures:load FIXTURES=foo,bar

What is the best way to make this type of task as dependency for some
other task ? Now I do it this way:

task :setup => [:clean, :migrate, :load_foo_and_bar]

task :load_foo_and_bar do
ENV[‘FIXTURES’] = ‘foo,bar’
Rake::Task[‘db:fixtures:load’].invoke
end

Maybe there is some cleaner way to do this kind of stuff ? BTW I don’t
get any error information to stdout if load_foo_and_bar fails.