Skip to content

Instantly share code, notes, and snippets.

@kiote
Created December 22, 2011 15:57
Show Gist options
  • Save kiote/1510782 to your computer and use it in GitHub Desktop.
Save kiote/1510782 to your computer and use it in GitHub Desktop.
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
set :application, "application_name"
set :repository, "git@your_path_to_git.git"
set :scm, :git
set :keep_releases, 5
# Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
set :rvm_ruby_string, '1.9.3'
set :rvm_type, :user # Don't use system-wide RVM
# Load RVM's capistrano plugin.
require 'rvm/capistrano'
require 'bundler/capistrano'
after "deploy", "rvm:trust_rvmrc"
namespace :deploy do
task :restart do
run "if [ -f #{unicorn_pid} ]; then kill -USR2 `cat #{unicorn_pid}`; else cd #{deploy_to}/current && bundle exec unicorn_rails -c #{unicorn_conf} -E #{rails_env} -D; fi"
end
task :start do
run "bundle exec unicorn_rails -c #{unicorn_conf} -E #{rails_env} -D"
end
task :stop do
run "if [ -f #{unicorn_pid} ]; then kill -QUIT `cat #{unicorn_pid}`; fi"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment