Merge branch 'master' of github.com:KevinTriplett/db-populate

This commit is contained in:
Kevin Triplett 2011-08-25 00:01:39 -05:00
commit 16fcd59a12

View File

@ -2,16 +2,16 @@ namespace :db do
desc "Loads initial database models for the current environment." desc "Loads initial database models for the current environment."
task :populate => :environment do task :populate => :environment do
require 'create_or_update' require File.join(File.dirname(__FILE__), '/../../lib', 'create_or_update')
Dir[File.join(RAILS_ROOT, 'db', 'populate', '*.rb')].sort.each do |fixture| Dir[File.join(Rails.root, 'db', 'populate', '*.rb')].sort.each do |fixture|
load fixture load fixture
puts "Loaded #{fixture}" puts "Loaded #{fixture}"
end end
(Dir[File.join(RAILS_ROOT, 'db', 'populate', RAILS_ENV, '*.rb')] + Dir[File.join(RAILS_ROOT, 'db', 'populate', 'shared', '*.rb')]).sort{|x,y| File.basename(x) <=> File.basename(y)}.each do |fixture| (Dir[File.join(Rails.root, 'db', 'populate', Rails.env, '*.rb')] + Dir[File.join(Rails.root, 'db', 'populate', 'shared', '*.rb')]).sort{|x,y| File.basename(x) <=> File.basename(y)}.each do |fixture|
load fixture load fixture
puts "Loaded #{fixture}" puts "Loaded #{fixture}"
end end
Dir[File.join(RAILS_ROOT, 'db', 'populate', 'after', '*.rb')].sort.each do |fixture| Dir[File.join(Rails.root, 'db', 'populate', 'after', '*.rb')].sort.each do |fixture|
load fixture load fixture
puts "Loaded #{fixture}" puts "Loaded #{fixture}"
end end