Sha256: d116defb9b4554a114cdb0a7b7bfa0a7b0d02979ec77369784f5c918a89c1e35
Contents?: true
Size: 715 Bytes
Versions: 1
Compression:
Stored size: 715 Bytes
Contents
require 'rake' namespace :db do desc 'Runs the populators defined in the configuration file' task :populate => :environment do populators.each do |populator| require "#{Rails.root}/config/#{populator}" Kernel.const_get(populator).split('_').collect(&:capitalize).run end end private def path defined?(Rails) ? "#{Rails.root}/config/populate.yml" : "populate.yml" end def configuration @configuration ||= YAML.load_file(path) rescue raise Exception, 'Missing configuration file. Add a populate.yml in the project directory or in the config/ directory for rails projects.' unless File.exists?(path) end def populators configuration['populators'] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
db-populator-0.1.10 | lib/tasks/populate.rake |