lib/rvm/environment/env.rb in rvm-1.0.19 vs lib/rvm/environment/env.rb in rvm-1.0.20
- old
+ new
@@ -1,23 +1,36 @@
module RVM
class Environment
# Returns the contents of the env file.
+ #
+ # env.env_contents # => ['export PATH= ....', ...]
+ #
def env_contents
- rvm(:env, environment_name).stdout
+ rvm(:env, environment_name).stdout.split
end
# 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"
+ #
def env_path
- rvm(:env, environment_name, :path => true).stdout.strip
+ normalize_array rvm(:env, environment_name, :path => true).stdout
end
# Returns a ruby-like wrapper for the env functions
def env
@env_wrapper ||= EnvWrapper.new(self)
end
# 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'
+ #
def path_for(command)
run(:command, "-v", command).stdout.strip
end
alias which path_for