Top Level Namespace

Defined Under Namespace

Modules: RVM

Constant Summary collapse

RUBY_NAME =

Prints out the rvm command (minus rvm install) to install this ruby.

File.basename(ENV['MY_RUBY_HOME'])
RVM_HOME =
ENV['rvm_path']

Instance Method Summary collapse

Instance Method Details

#arguments_for_installObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rvm/install_command_dumper.rb', line 23

def arguments_for_install
  if ruby?(:ruby, :ree, :goruby)
    begin
      require 'rbconfig'
      require 'shellwords'
      # Get the full arguments
      config_args = Shellwords.shellwords(Config::CONFIG['configure_args'].to_s.strip)
      real_arguments = []
      config_args.each do |arg|
        if ruby?(:ree) && arg == "--enable-mbari-api"
          next
        elsif arg =~ /^--prefix/
          next
        elsif arg =~ /^[^\-]/
          next
        else
          real_arguments << normalize_argument(arg)
        end
      end
      config_args = real_arguments.join(",")
      return "-C #{quote(config_args)}" unless config_args.strip.empty?
    rescue LoadError
    end
  end
  return ""
end

#normalize_argument(arg) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/rvm/install_command_dumper.rb', line 15

def normalize_argument(arg)
  real_value, arg_value = arg.split("=", 2)
  if !arg_value.nil?
    real_value << "=#{quote(arg_value)}"
  end
  real_value.gsub("'#{RVM_HOME}", "'\"$rvm_path\"'")
end

#quote(value) ⇒ Object



10
11
12
13
# File 'lib/rvm/install_command_dumper.rb', line 10

def quote(value)
  value = value.to_s.strip
  value.empty? ? "" : "'#{value.gsub("'", "'\'\'")}'"
end

#ruby?(*names) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/rvm/install_command_dumper.rb', line 6

def ruby?(*names)
  names.map { |n| n.to_s }.include?(RUBY_NAME.split("-").first)
end