2008-09-16 01:08:50 +00:00
|
|
|
namespace :db do
|
|
|
|
|
2007-11-28 18:12:15 +00:00
|
|
|
desc "Loads initial database models for the current environment."
|
|
|
|
task :populate => :environment do
|
2008-09-16 01:08:50 +00:00
|
|
|
require File.join(File.dirname(__FILE__), '/../lib', 'create_or_update')
|
2008-09-13 13:28:17 +00:00
|
|
|
Dir[File.join(RAILS_ROOT, 'db', 'populate', '*.rb')].sort.each do |fixture|
|
|
|
|
load fixture
|
|
|
|
puts "Loaded #{fixture}"
|
|
|
|
end
|
|
|
|
Dir[File.join(RAILS_ROOT, 'db', 'populate', RAILS_ENV, '*.rb')].sort.each do |fixture|
|
|
|
|
load fixture
|
|
|
|
puts "Loaded #{fixture}"
|
|
|
|
end
|
2007-11-28 18:12:15 +00:00
|
|
|
end
|
2008-09-16 01:08:50 +00:00
|
|
|
|
|
|
|
desc "Runs migrations and then loads seed data"
|
2008-10-12 00:05:39 +00:00
|
|
|
task :migrate_and_populate => [ 'db:migrate', 'db:populate' ]
|
|
|
|
|
2008-09-16 01:08:50 +00:00
|
|
|
task :migrate_and_load => [ 'db:migrate', 'db:populate' ]
|
|
|
|
|
2008-09-13 13:28:17 +00:00
|
|
|
end
|