Sha256: 23bf265c46c591bbed6a951c7c96c6d317ad4f2386be7d715df20116fa141215

Contents?: true

Size: 957 Bytes

Versions: 1

Compression:

Stored size: 957 Bytes

Contents

module CapistranoDeployManagement
  module Unicorn
    def self.load_into(configuration)
      configuration.load do

        set(:unicorn_config) { "#{current_path}/config/unicorn.rb" }
        set(:unicorn_pidfile) { "cat #{deploy_to}/shared/pids/unicorn.pid" }

        namespace :unicorn do
          desc 'Restart unicorn.'
          task :restart, :roles => :app, :except => {:no_release => true} do
            unicorn.stop
            unicorn.start
          end

          desc 'Start unicorn.'
          task :start, :roles => :app, :except => {:no_release => true} do
            run "cd #{current_path} && unicorn -c #{unicorn_config} -E production -D"
          end

          desc 'Stop unicorn.'
          task :stop, :roles => :app, :except => {:no_release => true} do
            run "cd #{current_path} && kill $(#{unicorn_pidfile})"
          end
        end

        after 'deploy:restart', 'unicorn:restart'

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-deploy-management-0.1.2 lib/capistrano-deploy-management/unicorn.rb