Sha256: 0e188791065d2533804bb72bba4799be444dd0b60f96b3548043d7b5db5c2778

Contents?: true

Size: 1.43 KB

Versions: 72

Compression:

Stored size: 1.43 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.
    #
    # env.use '1.9.2' # => nil
    # env.use 'ree' # => nil
    #
    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

72 entries across 72 versions & 1 rubygems

Version Path
rvm-1.6.2 lib/rvm/environment/rubies.rb
rvm-1.5.2 lib/rvm/environment/rubies.rb
rvm-1.5.1 lib/rvm/environment/rubies.rb
rvm-1.5.0 lib/rvm/environment/rubies.rb
rvm-1.3.2 lib/rvm/environment/rubies.rb
rvm-1.3.1 lib/rvm/environment/rubies.rb
rvm-1.3.0 lib/rvm/environment/rubies.rb
rvm-1.2.9 lib/rvm/environment/rubies.rb
rvm-1.2.8 lib/rvm/environment/rubies.rb
rvm-1.2.7 lib/rvm/environment/rubies.rb
rvm-1.2.6 lib/rvm/environment/rubies.rb
rvm-1.2.5 lib/rvm/environment/rubies.rb
rvm-1.2.4 lib/rvm/environment/rubies.rb
rvm-1.2.3 lib/rvm/environment/rubies.rb
rvm-1.2.2 lib/rvm/environment/rubies.rb
rvm-1.1.12 lib/rvm/environment/rubies.rb
rvm-1.1.11 lib/rvm/environment/rubies.rb
rvm-1.1.10 lib/rvm/environment/rubies.rb
rvm-1.1.9 lib/rvm/environment/rubies.rb
rvm-1.1.8 lib/rvm/environment/rubies.rb