Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first try at using the new rvm-capistrano tasks

  • Loading branch information...
commit 55b0592ea4bd97852095c1f2c5f01b9e2ff1fa1c 1 parent d20c80d
@hollow hollow authored
Showing with 26 additions and 63 deletions.
  1. +1 −1  .rvmrc
  2. +5 −5 Gemfile.lock
  3. +1 −1  capper.gemspec
  4. +19 −56 lib/capper/rvm.rb
View
2  .rvmrc
@@ -1 +1 @@
-rvm use --create ruby-1.9.3-p125@capper
+rvm use --create ruby-1.9.3-p194@capper
View
10 Gemfile.lock
@@ -1,11 +1,11 @@
PATH
remote: .
specs:
- capper (0.9.20)
+ capper (0.9.23)
capistrano (~> 2.9.0)
capistrano_colors (~> 0.5.5)
erubis
- rvm-capistrano
+ rvm-capistrano (~> 1.2.3)
GEM
remote: http://rubygems.org/
@@ -18,15 +18,15 @@ GEM
net-ssh-gateway (>= 1.1.0)
capistrano_colors (0.5.5)
erubis (2.7.0)
- highline (1.6.12)
+ highline (1.6.13)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
- net-ssh (2.3.0)
+ net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
- rvm-capistrano (1.1.0)
+ rvm-capistrano (1.2.3)
capistrano (>= 2.0.0)
PLATFORMS
View
2  capper.gemspec
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
s.add_dependency "erubis"
s.add_dependency "capistrano", "~> 2.9.0"
s.add_dependency "capistrano_colors", "~> 0.5.5"
- s.add_dependency "rvm-capistrano"
+ s.add_dependency "rvm-capistrano", "~> 1.2.3"
end
View
75 lib/capper/rvm.rb
@@ -1,20 +1,24 @@
load "capper/ruby"
-require 'rvm/capistrano'
+require "rvm/capistrano"
set(:rvm_type, :user)
set(:rvm_ruby_string, File.read(".rvmrc").gsub(/^rvm( use)? --create (.*)/, '\2').strip)
-_cset(:rvm_version, "1.11.7")
-_cset(:rvm_installer_url, "http://get.rvm.io")
+_cset(:rvm_version, "1.14.5")
+set(:rvm_install_type) { rvm_version }
+
+before "deploy:setup", "rvm:install_ruby"
+before "rvm:install_ruby", "rvm:install_rvm"
+before "rvm:install_rvm", "rvm:install_rvmrc"
+after "rvm:install_ruby", "rvm:auto_gem"
+after "rvm:install_ruby", "rvm:install_rubygems"
-before "deploy:setup", "rvm:setup"
after "deploy:symlink", "rvm:trust_rvmrc"
namespace :rvm do
- desc "Install RVM and Ruby"
- task :setup, :except => {:no_release => true} do
- # setup rvmrc
+ desc "Install a global .rvmrc"
+ task :install_rvmrc, :except => {:no_release => true} do
rvmrc = <<-EOS
export rvm_path="#{deploy_to}/.rvm"
export rvm_verbose_flag=0
@@ -22,41 +26,16 @@
EOS
put(rvmrc, "#{deploy_to}/.rvmrc")
+ end
- # download rvm installer
- run("curl -s -L #{rvm_installer_url} > #{deploy_to}/rvm-installer; " +
- "chmod +x #{deploy_to}/rvm-installer",
- :shell => "/bin/bash")
-
- # install rvm
- run("if ! test -d #{deploy_to}/.rvm; then " +
- "#{deploy_to}/rvm-installer --branch #{rvm_version}; fi",
- :shell => "/bin/bash")
-
- # update rvm if version differs
- run("source ~/.rvm/scripts/rvm && " +
- "if ! rvm version | grep -q 'rvm #{rvm_version}'; then " +
- "#{deploy_to}/rvm-installer --branch #{rvm_version}; fi",
- :shell => "/bin/bash")
-
- # remove rvm installer
- run("rm -f #{deploy_to}/rvm-installer",
- :shell => "/bin/bash")
-
- # install requested ruby version
- wo_gemset = rvm_ruby_string.gsub(/@.*/, '')
-
- run("echo silent > ~/.curlrc", :shell => "/bin/bash")
- run("source ~/.rvm/scripts/rvm && " +
- "if ! rvm list rubies | grep -q #{wo_gemset}; then " +
- "rvm install #{wo_gemset}; fi && " +
- "rvm use --create #{rvm_ruby_string} >/dev/null",
- :shell => "/bin/bash")
- run("rm ~/.curlrc")
-
- # this ensures that Gentoos declare -x RUBYOPT="-rauto_gem" is ignored.
+ desc "Ensure that Gentoos declare -x RUBYOPT=\"-rauto_gem\" is ignored"
+ task :auto_gem do
+ wo_gemset = rvm_ruby_string.split('@').first
run "touch ~/.rvm/rubies/#{wo_gemset}/lib/ruby/site_ruby/auto_gem.rb"
+ end
+ desc "Install the specified rubygems version"
+ task :install_rubygems do
# if specified freeze rubygems version, otherwise don't touch it
if fetch(:rvm_rubygems_version, false)
run("rvm rubygems #{rvm_rubygems_version}")
@@ -70,23 +49,7 @@
desc "Reinstall the current ruby version"
task :reinstall do
- # install requested ruby version
- wo_gemset = rvm_ruby_string.gsub(/@.*/, '')
-
- run("echo silent > ~/.curlrc", :shell => "/bin/bash")
- run("source ~/.rvm/scripts/rvm && " +
- "rvm reinstall #{wo_gemset} && " +
- "rvm use --create #{rvm_ruby_string} >/dev/null",
- :shell => "/bin/bash")
- run("rm ~/.curlrc")
-
- # this ensures that Gentoos declare -x RUBYOPT="-rauto_gem" is ignored.
- run "touch ~/.rvm/rubies/#{wo_gemset}/lib/ruby/site_ruby/auto_gem.rb"
-
- # if specified freeze rubygems version, otherwise don't touch it
- if fetch(:rvm_rubygems_version, false)
- run("rvm rubygems #{rvm_rubygems_version}")
- end
+ set(:rvm_install_ruby, :reinstall)
end
# prevents interactive rvm dialog
Please sign in to comment.
Something went wrong with that request. Please try again.