Sha256: 9a2241374123408d0d6de28b239ec815842bf1b26266d4ce46c69daf86fb6408

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

Contents

load 'tasks/support/rake_task_helpers.rb'

namespace :db do
  include RakeTaskHelpers
  
  namespace :seed do
    desc "List all available seeds"
    task :list do
      puts seeds.inspect
    end
    
    desc "Up all seeds, or a seed specified in the SEED environment variable"
    task :up => :environment do
      if ENV["SEED"]
        seed_name = ENV["SEED"]
        verify_seed(seed_name)      

        seed_klass = seeds[seed_name]        
        AmbitiousSeeder::Seeder.up(seed_klass)
      else      
        AmbitiousSeeder::Seeder.up(seeds.values)
      end
    end

    desc "Down the seed specific in the SEED environment variable"
    task :down => :environment do
      seed = ENV["SEED"]
      abort "Specify the seed to down: 'rake db:seed:down SEED=seed_name'" unless seed
      verify_seed(seed)

      seed_klass = seeds[seed]      
      AmbitiousSeeder::Seeder.down(seed_klass)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ambitious_seeder-0.1.0 lib/tasks/ambitious_seeder.rake