lib/rvm/capistrano.rb in rvm-capistrano-1.3.1 vs lib/rvm/capistrano.rb in rvm-capistrano-1.3.2
- old
+ new
@@ -135,14 +135,32 @@
rm -rf $CURL_HOME;
exit ${__LAST_STATUS}
EOF
end
+ def rvm_if_sudo
+ case rvm_type
+ when :root, :system
+ if fetch(:use_sudo, true) == false && rvm_install_with_sudo == false
+ raise "
+
+:use_sudo is set to 'false' but sudo is needed to install rvm_type: #{rvm_type}.
+You can enable use_sudo within rvm for use only by this install operation by adding to deploy.rb: set :rvm_install_with_sudo, true
+
+"
+ else
+ "#{sudo} "
+ end
+ else
+ ''
+ end
+ end
+
def with_rvm_group(command)
case rvm_type
when :root, :system
- "#{sudo} sg rvm -c \"#{command}\""
+ "#{rvm_if_sudo} sg rvm -c \"#{command}\""
else
command
end
end
@@ -164,25 +182,11 @@
set :rvm_install_shell, :zsh
EOF
rvm_task :install_rvm do
command_fetch = "curl -L get.rvm.io"
- command_install = case rvm_type
- when :root, :system
- if fetch(:use_sudo, true) == false && rvm_install_with_sudo == false
- raise "
-
-:use_sudo is set to 'false' but sudo is needed to install rvm_type: #{rvm_type}.
-You can enable use_sudo within rvm for use only by this install operation by adding to deploy.rb: set :rvm_install_with_sudo, true
-
-"
- else
- "#{sudo} "
- end
- else
- ''
- end
+ command_install = rvm_if_sudo
command_install << "#{rvm_install_shell} -s #{rvm_install_type} --path #{rvm_path}"
case rvm_type
when :root, :system
command_install << " --add-to-rvm-group #{[rvm_add_to_group].flatten.map(&:to_s).join(",")}"
end
@@ -222,21 +226,12 @@
).include?( autolibs_flag )
if autolibs_flag_no_requirements
command_install << with_rvm_group("#{File.join(rvm_bin_path, "rvm")} --autolibs=#{autolibs_flag} #{rvm_install_ruby} #{ruby} -j #{rvm_install_ruby_threads} #{rvm_install_ruby_params}")
else
- if fetch(:use_sudo, true) == false && rvm_install_with_sudo == false
- raise "
-
-:use_sudo is set to 'false' but sudo is needed to install requirements with autolibs '#{autolibs_flag}'.
-You can enable use_sudo within rvm for use only by this ruby install operation by adding to deploy.rb: set :rvm_install_with_sudo, true
-
-"
- else
- command_install << "#{sudo} #{File.join(rvm_bin_path, "rvm")} --autolibs=#{autolibs_flag} 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}")
- end
+ command_install << "#{rvm_if_sudo} #{File.join(rvm_bin_path, "rvm")} --autolibs=#{autolibs_flag} 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}")
end
if gemset
command_install << "; "
command_install << with_rvm_group("#{File.join(rvm_bin_path, "rvm")} #{ruby} do rvm gemset create #{gemset}")