def self.ruby_command
if in_rvm?
name = rvm_ruby_string
dirs = rvm_paths
if name && dirs
dirs.each do |dir|
filename = "#{dir}/wrappers/#{name}/ruby"
if File.exist?(filename)
contents = File.open(filename, 'rb') do |f|
f.read
end
if contents.include?("$HOME")
filename = nil
end
else
filename = nil
end
if filename
return filename
end
end
case rvm_installation_mode
when :single
repair_command = "rvm get stable && rvm reload && rvm repair all"
wrapper_command = "rvm wrapper #{rvm_ruby_string} --no-prefix --all"
when :multi
repair_command = "rvmsudo rvm get stable && rvm reload && rvmsudo rvm repair all"
wrapper_command = "rvmsudo rvm wrapper #{rvm_ruby_string} --no-prefix --all"
when :mixed
repair_command = "rvmsudo rvm get stable && rvm reload && rvm repair all"
wrapper_command = "rvm wrapper #{rvm_ruby_string} --no-prefix --all"
end
STDERR.puts "Your RVM wrapper scripts are too old, or some " +
"wrapper scripts are missing. Please update/regenerate " +
"them first by running:\n\n" +
" #{repair_command}\n\n" +
"If that doesn't seem to work, please run:\n\n" +
" #{wrapper_command}"
exit 1
else
STDERR.puts "Your RVM installation appears to be broken: the RVM " +
"path cannot be found. Please fix your RVM installation " +
"or contact the RVM developers for support."
exit 1
end
else
return ruby_executable
end
end