Skip to content

Instantly share code, notes, and snippets.

@semipermeable
Created June 23, 2011 06:17
Show Gist options
  • Save semipermeable/1042008 to your computer and use it in GitHub Desktop.
Save semipermeable/1042008 to your computer and use it in GitHub Desktop.
tddium:db_hook example
# lib/tasks/tddium.rake
namespace :tddium do
desc "tddium environment db setup task"
task :db_hook do
ENV['RAILS_ENV'] = 'test'
Rake::Task["db:create"].invoke
if File.exists?(File.join(Rails.root, "db", "schema.rb"))
Rake::Task['db:schema:load'].invoke
else
Rake::Task['db:migrate'].invoke
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment