Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git.overnothing.com:rvm

  • Loading branch information...
commit 315b14e48d7844f42f16a24300b6054496ea5c3b 2 parents 1b4ab39 + 0356826
@Sutto Sutto authored
View
2  lib/rvm.rb
@@ -79,6 +79,8 @@ def reset_current!
# RVM.environments("ree@rails3,rbx@rails3") do |env|
# puts "Full environment: #{env.expanded_name}"
# end
+ # # => "ree-1.8.7@rails3"
+ # # => "rbx-1.1.0@rails3" # Suppose that you are installed rbx 1.1.0
#
# Alternatively, you can use the more ruby-like fashion:
#
View
5 lib/rvm/environment.rb
@@ -34,6 +34,11 @@ def inspect
end
# 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"
+ #
def expanded_name
@expanded_name ||= tools_identifier.to_s
end
View
15 lib/rvm/environment/env.rb
@@ -2,11 +2,18 @@ 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
normalize_array rvm(:env, environment_name, :path => true).stdout
end
@@ -17,6 +24,12 @@ def env
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
View
4 lib/rvm/environment/info.rb
@@ -3,6 +3,10 @@
module RVM
class Environment
+ # Return a Hash with the same output that command:
+ #
+ # $ rvm info
+ #
def info(*ruby_strings)
ruby_string = normalize_ruby_string(ruby_strings)
res = rvm(:info, ruby_string)
View
15 lib/rvm/environment/list.rb
@@ -2,41 +2,56 @@ module RVM
class Environment
# Returns a raw array list of ruby + gemset combinations.
+ #
+ # env.list_gemsets # => ['ruby-1.9.2-p0@my_gemset', 'jruby@my_gemset', ...]
+ #
def list_gemsets
normalize_listing_output rvm(:list, :gemsets, :strings).stdout
end
# Returns a raw array list of installed ruby strings, including aliases.
+ #
+ # env.list_strings # => ["ruby-1.9.2-p0", "jruby-1.5.3"]
+ #
def list_strings
normalize_listing_output rvm(:list, :strings).stdout.tr(' ', "\n")
end
# 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"
+ #
def list_default
normalize rvm(:list, :default, :string).stdout
end
# Lists all known ruby strings (raw, filtered output)
+ #
def list_known
normalize_listing_output rvm(:list, :known).stdout
end
# Lists all known ruby strings
+ #
def list_known_strings
normalize_listing_output rvm(:list, :known_strings).stdout
end
# Lists all known svn tags.
+ #
def list_ruby_svn_tags
normalize_listing_output rvm(:list, :ruby_svn_tags).stdout
end
# Returns an interface to a more Ruby-like interface for list.
+ #
def list
@list_helper ||= ListWrapper.new(self)
end
# Provides a ruby-like interface to make listing rubies easier.
+ #
class ListWrapper
def initialize(parent)
View
4 lib/rvm/environment/rubies.rb
@@ -17,6 +17,10 @@ def remove(rubies, opts = {})
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)
View
60 scripts/cd
@@ -45,46 +45,26 @@ if [[ ${rvm_project_rvmrc:-1} -ne 0 ]] ; then
return $result
}
- #
- # Can someone please explain to me what this was meant to accomplish?
- # telemachus was encountering issues when he had CDPATH set.
- # Namely comletion stopped working.
- #
- # _rvm_cd_complete ()
- # {
- # local directory current matches item index
-
- # COMPREPLY=()
-
- # current="${COMP_WORDS[COMP_CWORD]}"
-
- # if [[ -n "$CDPATH" ]] ; then
-
- # index=${#COMPREPLY[@]}
-
- # for directory in $(printf "$CDPATH" | tr -s ':' ' ') ; do
-
- # for item in $( compgen -d "$directory/$current" ) ; do
-
- # item="${item}/"
-
- # COMPREPLY[index++]=${item#$directory/}
-
- # done
-
- # done
-
- # COMPREPLY=( $(echo ${COMPREPLY} | uniq | sort) )
-
- # else
-
- # COMPREPLY=( $(compgen -d ${current}) )
-
- # fi
-
- # }
-
- # complete -o filenames -o dirnames -o nospace -F _rvm_cd_complete cd
+ # If $CDPATH is set, bash should tab-complete based on directories in those paths,
+ # but with the cd function above, the built-in tab-complete ignores $CDPATH. This
+ # function returns that functionality.
+ _rvm_cd_complete ()
+ {
+ local directory current matches item index
+ COMPREPLY=()
+ current="${COMP_WORDS[COMP_CWORD]}"
+ if [[ -n "$CDPATH" && ${current:0:1} != "/" ]] ; then
+ index=0
+ for directory in $(printf "$CDPATH" | tr -s ':' ' ') ; do
+ for item in $( compgen -d "$directory/$current" ) ; do
+ COMPREPLY[index++]=${item#$directory/}
+ done
+ done
+ else
+ COMPREPLY=( $(compgen -d ${current}) )
+ fi
+ }
+ complete -o bashdefault -o default -o filenames -o dirnames -o nospace -F _rvm_cd_complete cd
fi
View
2  scripts/manage
@@ -22,7 +22,7 @@ __rvm_check_for_bison()
if [[ ${rvm_head_flag:-0} -gt 0 ]]; then
command -v bison > /dev/null
result=$?
- if [[ $? -gt 0 ]] ; then
+ if [[ $result -gt 0 ]] ; then
"$rvm_path/scripts/log" "fail" \
"\nbison is not available in your path. \nPlease ensure bison is installed before compiling from head.\n"
fi
View
6 scripts/notes
@@ -126,6 +126,12 @@ elif [[ "Darwin" = "$system" ]] ; then
If you intend on installing MacRuby you must install LLVM first.
If you intend on installing JRuby you must install the JDK.
If you intend on installing IronRuby you must install Mono (version 2.6 or greater is recommended).
+
+ To seamlessly abandon the Apple-installed system ruby (ruby 1.8.7 patchlevel 174 for Snow Leopard):
+
+ rvm install 1.8.7 # installs patch 302: closest supported version
+ rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system # migrate your gems
+ rvm --default 1.8.7
"
fi
Please sign in to comment.
Something went wrong with that request. Please try again.