Module: CapistranoDeploy::Rails

Defined in:
lib/capistrano-deploy/rails.rb

Class Method Summary collapse

Class Method Details

.load_into(configuration) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/capistrano-deploy/rails.rb', line 3

def self.load_into(configuration)
  configuration.load do
    set :rake do
      if using_recipe?(:bundle)
        'bundle exec rake'
      else
        'rake'
      end
    end

    set(:rails_env) { 'production' }

    namespace :deploy do
      desc 'Deploy & migrate'
      task :migrations do
        update
        migrate
        restart
      end

      desc 'Run migrations'
      task :migrate, :roles => :db, :only => {:primary => true} do
        run "cd #{deploy_to} && RAILS_ENV=#{rails_env} #{rake} db:migrate"
      end
    end
  end
end