Sha256: 661378febd5eee0d812f9d864780e210c1feea50c639fe708e933637c89e962c

Contents?: true

Size: 704 Bytes

Versions: 3

Compression:

Stored size: 704 Bytes

Contents

require Cardboard::Engine.root.join('lib/cardboard/helpers/seed.rb')

# Rake::Task['db:seed'].enhance do
#   Rake::Task['cardboard:seed'].invoke
# end


# Seed!
task 'cardboard:seed' => :environment do
  puts "Seeding Cardboard ..."
  begin
    file_hash = YAML.load(ERB.new(File.read(Rails.root.join('config', 'cardboard.yml'))).result).try(:with_indifferent_access)
  rescue Errno::ENOENT => e
    puts "Error: You must first create a cardboard.yml file in your application config folder"
  end

  if file_hash
    Cardboard::Seed.populate_pages(file_hash[:pages]) 
    Cardboard::Seed.populate_templates(file_hash[:templates]) 
    Cardboard::Seed.populate_settings(file_hash[:settings]) 
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cardboard_cms-0.3.1 lib/tasks/cardboard_tasks.rake
cardboard_cms-0.2.2 lib/tasks/cardboard_tasks.rake
cardboard_cms-0.2.1 lib/tasks/cardboard_tasks.rake