Sha256: ec5949b30c7f41cabc8da079ae60ab18df0bd92295b1bc54a6ede94bd9306d72

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

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

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

        namespace :unicorn do
          desc 'Restart unicorn.'
          task :restart, :roles => :app do
            unicorn.stop
            unicorn.start
            # run "cd #{current_path} && kill -USR2 #{unicorn_pid}"
          end

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

          desc 'Stop unicorn.'
          task :stop, :roles => :app do
            # run "if test -s #{unicorn_pidfile}; then cd #{current_path} && kill $(#{unicorn_pid}) fi"
            # above line fails with error -c: line 1: syntax error: unexpected end of file
            run "cd #{current_path} && kill -QUIT $(#{unicorn_pid})"
          end
        end

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

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-deploy-management-0.1.9 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.8 lib/capistrano-deploy-management/unicorn.rb