Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look in /usr/share/rvm when in :system mode #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 53 additions & 13 deletions lib/capistrano/tasks/rvm.rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
RVM_SYSTEM_PATH = "/usr/local/rvm"
RVM_SYSTEM_PATH = "/usr/share/rvm"
RVM_OLD_SYSTEM_PATH = "/usr/local/rvm"
RVM_USER_PATH = "~/.rvm"

namespace :rvm do
Expand All @@ -16,21 +17,60 @@ namespace :rvm do
task :hook do
on roles(fetch(:rvm_roles, :all)) do
rvm_path = fetch(:rvm_custom_path)
rvm_path ||= case fetch(:rvm_type)
when :auto
if test("[ -d #{RVM_USER_PATH} ]")
RVM_USER_PATH
elsif test("[ -d #{RVM_SYSTEM_PATH} ]")
RVM_SYSTEM_PATH
else
RVM_USER_PATH
unless rvm_path
rvm_type = fetch(:rvm_type)
if rvm_type == :auto
[RVM_USER_PATH,
RVM_SYSTEM_PATH,
RVM_OLD_SYSTEM_PATH].each do |pathtotest|
if test("[ -d #{pathtotest} ]")
rvm_path = pathtotest
break
end
end
elsif [:system,:mixed].include?(rvm_type)
rvm_path = RVM_SYSTEM_PATH
else # :user
rvm_path = RVM_USER_PATH
end
when :system, :mixed
RVM_SYSTEM_PATH
else # :user
RVM_USER_PATH
end

if test("[ ! -d #{rvm_path} ]")
puts <<EOF
################################################################################

capistrano-rvm config:

RVM path was derived as #{rvm_path}, but that is not found. Things won't work.

You may want to try adding

set :rvm_type, :auto

To your stage, which will search a set of likely candidates.

You can also set it specifically with:

set :rvm_path, '/a/path/to/rvm'

You should be aware that when installing rvm in system mode, the default path
changed from

/usr/local/rvm

to

/usr/share/rvm

starting with

https://github.com/rvm/rvm/issues/2456

################################################################################

EOF
raise "RVM Path #{rvm_path} does not exist. See longer error description above"
end
set :rvm_path, rvm_path
end

Expand Down