2014-04-08 13:11:06 +02:00
|
|
|
# Allow loading multiple seeds
|
|
|
|
# Tried using seedbank, but that supposes all seeds are loaded, while
|
|
|
|
# we want to have different options to choose from (and they can't
|
|
|
|
# be loaded at the same time).
|
|
|
|
require 'pathname'
|
|
|
|
|
|
|
|
namespace :db do
|
|
|
|
namespace :seed do
|
2022-10-08 16:03:19 +02:00
|
|
|
Rails.root.glob('db/seeds/*.seeds.rb').sort.each do |seedfile|
|
2014-04-08 13:11:06 +02:00
|
|
|
desc "Load the seed data from #{Pathname.new(seedfile).relative_path_from(Rails.root)}"
|
|
|
|
task File.basename(seedfile, '.seeds.rb') => :environment do
|
|
|
|
require_relative seedfile
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|