Sha256: 7803bd1c8d88f324dd9b209ddb2b6a4826e4d0e4323ba20c5be34612df2e62c3

Contents?: true

Size: 1.36 KB

Versions: 32

Compression:

Stored size: 1.36 KB

Contents

module RVM
  class Environment

    # Installs the given ruby
    def install(rubies, opts = {})
      rvm(:install, normalize_ruby_string(rubies), opts).successful?
    end

    # Uninstalls a ruby (remove but keeps src etc)
    def uninstall(rubies, opts = {})
      rvm(:uninstall, normalize_ruby_string(rubies), opts).successful?
    end

    # Removes a given ruby from being managed by rvm.
    def remove(rubies, opts = {})
      rvm(:remove, normalize_ruby_string(rubies), opts).successful?
    end

    # Changes the ruby string for the current environment.
    def use(ruby_string, opts = {})
      ruby_string = ruby_string.to_s
      result = rvm(:use, ruby_string)
      if result.successful?
        @environment_name = ruby_string
        @expanded_name    = nil
        use_env_from_result! result if opts[:replace_env]
      end
    end

    # Like use but with :replace_env defaulting to true.
    def use!(ruby_string, opts = {})
      use ruby_string, opts.merge(:replace_env => true)
    end

    # Will get the ruby from the given path. If there
    # is a compatible ruby found, it will then attempt
    # to use the associated gemset.
    # e.g. RVM::Environment.current.use_from_path! Dir.pwd
    def use_from_path!(path)
     use! tools.path_identifier(path)
    end

    protected

    def normalize_ruby_string(rubies)
      Array(rubies).join(",")
    end

  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
rvm-1.0.5 lib/rvm/environment/rubies.rb
rvm-1.0.4 lib/rvm/environment/rubies.rb
rvm-1.0.3 lib/rvm/environment/rubies.rb
rvm-1.0.2 lib/rvm/environment/rubies.rb
rvm-1.0.1 lib/rvm/environment/rubies.rb
rvm-1.0.0 lib/rvm/environment/rubies.rb
rvm-0.1.47 lib/rvm/environment/rubies.rb
rvm-0.1.46 lib/rvm/environment/rubies.rb
rvm-0.1.45 lib/rvm/environment/rubies.rb
rvm-0.1.44 lib/rvm/environment/rubies.rb
rvm-0.1.43 lib/rvm/environment/rubies.rb
rvm-0.1.42 lib/rvm/environment/rubies.rb