I''m wondering if there was a better way to do this:
I want to add a prerequisite check to the db:reset rails task so that if
we''re in production mode, the user has to add an additional environment
variable for it to run (yes, I *know* users shouldn''t even be on
production machines, but in this case it''s worth it).
What I found I had to do was:
- added a task for the check:
namespace :fp do
task :check_for_production_flag => :environment do
raise "Boom!" unless RAILS_ENV!=''production'' ||
ENV[''production'']
end
end
- added a dependency for db:reset:
namespace :db do
task :reset => ["fp:check_for_production_flag"]
end
And then, most importantly, had to change Rakefile so that the rake file
with the above items was loaded *before* "require
''tasks/rails''".
This *may* be because db:reset is actually an empty task and
accomplishes its work through its 3 prerequisites.
Did I have any alternative to doing it this way?
Thanks,
dwh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---