Class RVM::Environment
In: lib/rvm/environment/cleanup.rb
lib/rvm/environment/list.rb
lib/rvm/environment/sets.rb
lib/rvm/environment/gemset.rb
lib/rvm/environment/wrapper.rb
lib/rvm/environment/rubies.rb
lib/rvm/environment/tools.rb
lib/rvm/environment/configuration.rb
lib/rvm/environment/env.rb
lib/rvm/environment/utility.rb
lib/rvm/environment/alias.rb
lib/rvm/environment/info.rb
lib/rvm/environment.rb
Parent: Object

Implements the actual wrapper around the api. For more information about this design, see the RVM module.

Methods

alias_create   alias_delete   alias_list   alias_show   aliases   chdir   cleanup   compatible_with_current?   config_value_for   config_value_for   current   current_environment_id   current_ruby_string   default_rvm_path   default_wrappers   define_config_accessor   defined_config   env   env_contents   env_path   environment_with_gemset   exec   expanded_name   extract_environment!   extract_identifier!   extract_options!   gemset   gemset_copy   gemset_create   gemset_delete   gemset_dump   gemset_empty   gemset_export   gemset_globalcache   gemset_import   gemset_initial   gemset_list   gemset_load   gemset_pristine   gemset_prune   gemset_update   gemset_use   gemset_use!   hash_to_options   identifier_to_gemset_name   identifier_to_ruby_string   info   inspect   install   list   list_default   list_gemsets   list_known   list_known_strings   list_ruby_svn_tags   list_strings   new   normalize   normalize_array   normalize_listing_output   normalize_option_value   normalize_ruby_string   normalize_set_identifier   path_for   perform_set_operation   rake   rearrange_options!   remove   reset_current!   ruby   ruby_eval   ruby_run   ruby_string   rvm   source_rvm_environment   specs   system   tests   tools   tools_identifier   tools_path_identifier   tools_strings   uninstall   use   use!   use_env_from_result!   use_from_path!   use_rvm_environment   which   wrapper   wrapper_path_for  

Included Modules

ConfigMixin

Classes and Modules

Module RVM::Environment::ConfigMixin
Class RVM::Environment::AliasWrapper
Class RVM::Environment::CleanupWrapper
Class RVM::Environment::EnvWrapper
Class RVM::Environment::GemsetWrapper
Class RVM::Environment::ListWrapper
Class RVM::Environment::ToolsWrapper

Constants

PREFIX_OPTIONS = [:trace, :json, :yaml]

Attributes

environment_name  [R] 
shell_wrapper  [R] 

Public Class methods

Gets the default option or the current environment variable for a given env var.

Returns the currentl environment. Note that when the ruby is changed, this is reset - Also, if the gemset is changed it will also be reset.

Returns the environment identifier for the current environment, as determined from the GEM_HOME.

Returns the ruby string that represents the current environment.

Define the config accessor, which basically uses config_value_for and the linke to set the env variable.

Converts a ruby identifier (string + gemset) to just the ruby string.

Creates a new environment with the given name and optionally a set of extra environment variables to be set on load.

Sets the current environment back to the currently running ruby or the system env (if it can‘t be determined from GEM_HOME).

Protected Class methods

Given an environment identifier, it will add the the given gemset to the end to form a qualified identifier name.

Public Instance methods

Creates an alias with the given name.

Deletes an alias and returns the exit status.

Returns a hash of aliases.

Shows the full ruby string that a given alias points to.

Returns an aliases proxy which can be used in a more Ruby-like manner.

Run commands inside the given directory.

Returns the ruby-like interface defined by CleanupWrapper

Returns the value for a configuration option (mapping to an environment variable). If check_live is true (which it is by default), it will also check the environment for a value.

Generates the default wrappers.

Returns a hash of all of the user defined configuration.

Returns a ruby-like wrapper for the env functions

Returns the contents of the env file.

env.env_contents # => [‘export PATH= .…’, …]

Returns the path to the env file Suppose that you are in the 1.9.2 environment.

env.env_path # => "~/.rvm/environments/ruby-1.9.2-p0"

Executes a command, replacing the current shell. exec is a bit of an odd ball compared to the others, since it has to use the Kernel.exec builtin.

Returns the expanded name, using the same method as used by the rvm command line.

Suppose that you are in the 1.9.2 patchlevel Environment.

env.expanded_name # => "ruby-1.9.2-p0"

Returns the Ruby-like wrapper for gemset operations.

Copies the gems between two different gemsets.

Creates a new gemset with the given name.

Deletes the gemset with a given name.

gemset_dump(gemset_or_file = nil)

Alias for gemset_export

Removes all gem-related stuff from the current gemset.

Enable or disable the rvm gem global cache.

Loads a gemset into the current environment. If an argument is given, it will load it from file_prefix.gems

Initializes gemsets for a given ruby.

gemset_load(file_prefix = nil)

Alias for gemset_import

Resets the current gemset to a pristine state.

Prunes the gem cache for the current ruby.

Updates all gems in the current gemset.

Changes the current environments gemset. If :replace_env is passed and the ruby is compatible, it will attempt to replace the current processes gem home and path with the one requested.

Like gemset_use, but replaces the env by default.

Return a Hash with the same output that command:

$ rvm info

Returns an interface to a more Ruby-like interface for list.

Lists the default ruby (minus gemset) Suppose that Ruby 1.9.2 patchlevel 0, is the default:

env.list_default # => "ruby-1.9.2-p0"

Returns a raw array list of ruby + gemset combinations.

env.list_gemsets # => [‘ruby-1.9.2-p0@my_gemset’, ‘jruby@my_gemset’, …]

Lists all known ruby strings (raw, filtered output)

Lists all known ruby strings

Lists all known svn tags.

Returns a raw array list of installed ruby strings, including aliases.

env.list_strings # => ["ruby-1.9.2-p0", "jruby-1.5.3"]

Returns the path for the given command

Suppose that you are in the 1.9.2 environment.

env.path_for(:rspec) # => ’~/.rvm/gems/ruby-1.9.2-p0/bin/rspec’ env.path_for(:ruby) # => ’~/.rvm/rubies/ruby-1.9.2-p0/bin/ruby‘

Execute rake (optionally taking the path to a rake file), then change back.

Removes a given ruby from being managed by rvm.

Passed either something containing ruby code or a path to a ruby file, will attempt to exectute it in the current environment.

Eval the given code within ruby.

Run the given path as a ruby script.

Lets you build a command up, without needing to see the output. Examples:

 rvm :use, "ree@rails3", :install => true
 > rvm use ree@rails3 --install

 rvm :install, "ree@rails3", :rvm_by_path => true, :rubygems_version => "1.8.23"
 > rvm_rubygems_version=1.8.23 $rvm_path/bin/rvm install ree@rails3

Use the rvm spec runner for specs.

Like Kernel.system, but evaluates it within the environment. Also note that it doesn‘t support redirection etc.

Use the rvm test runner for unit tests.

Return the tools wrapper.

Gets the full name for the current env.

Gets the identifier after cd‘ing to a path, no destructive.

Uninstalls a ruby (remove but keeps src etc)

Changes the ruby string for the current environment.

env.use ‘1.9.2’ # => true env.use ‘ree’ # => true env.use ‘foo’ # => false

Like use but with :replace_env defaulting to true.

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

which(command)

Alias for path_for

Generates wrappers with the specified prefix, pointing to ruby_string.

If available, return the path to the wrapper for the given executable. Will return ni if the wrapper is unavailable.

Protected Instance methods

Checks whether the given environment is compatible with the current ruby interpeter.

From an options hash, extract the environment identifier.

Shorthand to extra an identifier from args. Since we

Extract options from a hash.

Converts a hash of options to an array of command line argumets. If the value is false, it wont be added but if it is true only the key will be added. Lastly, when the value is neither true or false, to_s will becalled on it and it shall be added to the array.

Returns a value, or nil if it is blank.

Normalizes an array, removing blank lines.

Takes a list of rubies / items, 1 per line and strips comments and blank lines.

Converts the given identifier to a rvm-friendly form. Unlike using sets directly, a nil identifier is set to mean the current ruby (not all). :all or "all" will instead return the a blank identifier / run it against all rubies.

Performs a set operation. If the :env or :environment option is given, it will return a yaml summary (instead of the stdout / stderr etc via a Result object.

Moves certain options (e.g. yaml, json etc) to the front of the arguments list, making stuff like sets work.

Automatically load rvm config from the multiple sources.

[Validate]