generators/vulcanize/templates/base/config/rubber/deploy-setup.rb in nirvdrum-rubber-1.1.7 vs generators/vulcanize/templates/base/config/rubber/deploy-setup.rb in nirvdrum-rubber-2.0.0.rails3.beta6
- old
+ new
@@ -1,66 +1,45 @@
namespace :rubber do
namespace :base do
rubber.allow_optional_tasks(self)
+ before "rubber:install_gems", "rubber:base:install_rvm"
+ task :install_rvm do
+ rubber.sudo_script "install_rvm", <<-ENDSCRIPT
+ if [[ `rvm --version 2> /dev/null` == "" ]]; then
+ wget -qNP /tmp http://rvm.beginrescueend.com/releases/rvm-install-head
+ bash /tmp/rvm-install-head
+ echo "#{rubber_env.rvm_prepare}" > /etc/profile.d/rvm.sh
+ echo "rvm_prefix=/usr/local" > /etc/rvmrc
+ fi
+ ENDSCRIPT
+ end
- before "rubber:install_packages", "rubber:base:pre_install_ruby"
- task :pre_install_ruby do
-
- # figure out which hosts we have specified enterprise ruby for
- sys_ruby_hosts = []
- ent_ruby_hosts = []
- rubber_instances.filtered.each do |ic|
- env = rubber_cfg.environment.bind(ic.role_names, ic.name)
- if env.use_enterprise_ruby
- ent_ruby_hosts << ic.full_name
- end
- end
-
- if ent_ruby_hosts.size > 0
- task :_install_enterprise_ruby, :hosts => ent_ruby_hosts do
- ver = "1.8.7-2009.10"
- rubber.run_script "install_ruby-enterprise", <<-ENDSCRIPT
- if [[ ! `ruby --version 2> /dev/null` =~ "Ruby Enterprise Edition 2009.10" ]]; then
- arch=`uname -m`
- if [ "$arch" = "x86_64" ]; then
- src="http://rubyforge.org/frs/download.php/66163/ruby-enterprise_#{ver}_amd64.deb"
- else
- src="http://rubyforge.org/frs/download.php/66164/ruby-enterprise_#{ver}_i386.deb"
- fi
- src_file="${src##*/}"
- wget -qP /tmp ${src}
- dpkg -i /tmp/${src_file}
- fi
- ENDSCRIPT
- end
-
- _install_enterprise_ruby
- end
-
+ # ensure that the rvm profile script gets sourced by reconnecting
+ after "rubber:base:install_rvm" do
+ teardown_connections_to(sessions.keys)
end
- # The ubuntu rubygem package is woefully out of date, so install it manually
- after "rubber:install_packages", "rubber:base:install_rubygems"
- task :install_rubygems do
- ver = "1.3.5"
- src_url = "http://rubyforge.org/frs/download.php/60718/rubygems-#{ver}.tgz"
- rubber.sudo_script 'install_rubygems', <<-ENDSCRIPT
- if [[ `gem --version 2>&1` != "#{ver}" ]]; then
- wget -qNP /tmp #{src_url}
- tar -C /tmp -xzf /tmp/rubygems-#{ver}.tgz
- ruby -C /tmp/rubygems-#{ver} setup.rb
- ln -sf /usr/bin/gem1.8 /usr/bin/gem
- rm -rf /tmp/rubygems*
- gem source -l > /dev/null
+ after "rubber:base:install_rvm", "rubber:base:install_rvm_ruby"
+ task :install_rvm_ruby do
+ opts = get_host_options('rvm_ruby')
+ install_rvm_ruby_script = <<-ENDSCRIPT
+ rvm_ver=$1
+ if [[ ! `rvm list default 2> /dev/null` =~ "$rvm_ver" ]]; then
+ rvm install $rvm_ver
+ # need to set default after using once or something in env is broken
+ rvm use $rvm_ver &> /dev/null
+ rvm use $rvm_ver --default
fi
ENDSCRIPT
+ opts[:script_args] = '$CAPISTRANO:VAR$'
+ rubber.sudo_script "install_rvm_ruby", install_rvm_ruby_script, opts
end
-
+
after "rubber:install_packages", "rubber:base:configure_git" if scm == "git"
task :configure_git do
- rubber.run_script 'configure_git', <<-ENDSCRIPT
+ rubber.sudo_script 'configure_git', <<-ENDSCRIPT
if [[ "#{repository}" =~ "@" ]]; then
# Get host key for src machine to prevent ssh from failing
rm -f ~/.ssh/known_hosts
! ssh -o 'StrictHostKeyChecking=no' #{repository.gsub(/:.*/, '')} &> /dev/null
fi