Module: ApplicationSeeds::Capistrano

Defined in:
lib/application_seeds/capistrano2.rb

Class Method Summary collapse

Class Method Details

.load_into(configuration) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/application_seeds/capistrano2.rb', line 4

def self.load_into(configuration)
  configuration.load do
    set :dataset, ""

    namespace :deploy do
      desc "Populate the application's database with application_seed data"
      task :application_seeds do
        raise "You cannot run this task in the production environment" if rails_env == "production"

        if dataset == ""
          run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} db:seed}
        else
          run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} application_seeds:load\[#{dataset}\]}
        end
      end
    end
  end
end