-
-
Save mpapis/5334353 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :stages, %w(production sandbox) | |
set :default_stage, "sandbox" | |
require 'capistrano/ext/multistage' | |
set :application, "blogtest" | |
set :repository, "git@github.com:iewnait/blogtest.git" | |
default_run_options[:pty] = true | |
set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names | |
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` | |
set :deploy_to, "/home/deployer/apps/blogtest" | |
set :user, "deployer" | |
set :use_sudo, false | |
set :rvm_ruby_string, "1.9.3-p327@#{application}" | |
set :rvm_install_pkgs, %w[libyaml openssl] # package list from https://rvm.io/packages | |
set :rvm_install_ruby_params, '--with-opt-dir=/usr/local/rvm/usr --autolibs=4' # package support | |
before 'deploy:setup', 'rvm:install_rvm' # install RVM | |
before 'deploy:setup', 'rvm:install_pkgs' # install RVM packages before Ruby | |
before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, or: | |
before 'deploy:setup', 'rvm:create_gemset' # only create gemset | |
before 'deploy:setup', 'rvm:import_gemset' # import gemset from file | |
require "rvm/capistrano" | |
namespace :rvm do | |
rvm_task :install_ruby do | |
ruby, gemset = rvm_ruby_string.to_s.strip.split /@/ | |
if %w( release_path default ).include? "#{ruby}" | |
raise "ruby can not be installed when using :rvm_ruby_string => :#{ruby}" | |
else | |
command_install = "" | |
command_install << "#{sudo} #{File.join(rvm_bin_path, "rvm")} --autolibs=4 requirements #{ruby}" | |
command_install << "; " | |
command_install << with_rvm_group("#{File.join(rvm_bin_path, "rvm")} --autolibs=1 #{rvm_install_ruby} #{ruby} -j #{rvm_install_ruby_threads} #{rvm_install_ruby_params}") | |
if gemset | |
command_install << "; " | |
command_install << with_rvm_group("#{File.join(rvm_bin_path, "rvm")} #{ruby} do rvm gemset create #{gemset}") | |
end | |
run_silent_curl command_install | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment