diff --git a/lib/capistrano/tasks/rvm.rake b/lib/capistrano/tasks/rvm.rake index b2845db..0ceddc0 100644 --- a/lib/capistrano/tasks/rvm.rake +++ b/lib/capistrano/tasks/rvm.rake @@ -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 @@ -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 <