lib/wagons/wagon_tasks.rake in wagons-0.0.1 vs lib/wagons/wagon_tasks.rake in wagons-0.0.9

- old
+ new

@@ -1,8 +1,7 @@ # These are the tasks included by the specific wagons - begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end @@ -97,23 +96,25 @@ desc "Revert the database and set it up again" task :reset => [:unseed, :revert, :setup] desc "Display status of migrations" app_task "migrate:status" + + app_task "test:prepare" end Rake.application.invoke_task(:load_app) namespace :app do - task :environment do - # set migrations paths only to core to have db:test:prepare work as desired - ActiveRecord::Migrator.migrations_paths = Rails.application.paths['db/migrate'].to_a - end - namespace :db do + task :load_config do + # set migrations paths to core only to have db:test:prepare work as desired + ActiveRecord::Migrator.migrations_paths = Rails.application.paths['db/migrate'].to_a + end + namespace :test do # for sqlite, make sure to delete the test.sqlite3 from the main application task :purge do abcs = ActiveRecord::Base.configurations case abcs['test']['adapter'] @@ -121,10 +122,11 @@ dbfile = Rails.application.root.join(abcs['test']['database']) File.delete(dbfile) if File.exist?(dbfile) end end - # run wagon migrations and load seed data + # run wagon migrations and load seed data. + # append this to the regular app:db:test:prepare task. task :prepare do Rails.env = 'test' dependencies = (wagon.all_dependencies + [wagon]) # migrate