Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge and update to rvm latest
  • Loading branch information
nicksieger committed Jul 20, 2010
2 parents 405aaf9 + f3f787f commit 40488ba
Show file tree
Hide file tree
Showing 166 changed files with 26,507 additions and 2,026 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -7,3 +7,5 @@ site/.sass-cache/
site/tmp/dependencies/
site/tmp/
tags
.*.swp
tmp/
114 changes: 62 additions & 52 deletions README
@@ -1,26 +1,73 @@

Usage

rvm Action [Implementation] [Flags] [Options]
rvm [Flags] [Options] Action [Implementation[,Implementation[,...]]

Flags

--head - with update, updates rvm to git head version.
--rubygems - with update, updates rubygems for selected ruby
--default - with ruby select, sets a default ruby for new shells.
--debug - Toggle debug mode on for very verbose output.
--trace - Toggle trace mode on to see EVERYTHING rvm is doing.
--force - Force install, removes old install & source before install.
--summary - Used with rubydo to print out a summary of the commands run.
--latest - with gemset --dump skips version strings for latest gem.
--gems - with uninstall/remove removes gems with the interpreter.
--docs - with install, attempt to generate ri after installation.
--reconfigure - Force ./configure on install even if Makefile already exists.


Options

-v|--version - Emit rvm version loaded for current shell
-l|--level - patch level to use with rvm use / install
--prefix - path for all rvm files (~/.rvm/), with trailing slash!
--bin - path for binaries to be placed (~/.rvm/bin/)
--source - src directory to use (~/.rvm/src/)
--archives - directory for downladed files (~/.rvm/archives/)
-S - Specify a script file to attempt to load and run (rubydo)
-e - Execute code from the command line.
-G - root gem path to use
--gems - Used to set the 'gems_flag', use with 'remove' to remove gems
--archive - Used to set the 'archive_flag', use with 'remove' to remove archive
--patch - With MRI Rubies you may specify one or more full paths to patches
for multiple, specify comma separated:
--patch /.../.../a.patch[%prefix],/.../.../.../b.patch
'prefix' is an optional argument, which will be bypassed
to the '-p' argument of the 'patch' command. It is separated
from patch file name with '%' symbol.
-C|--configure - custom configure options. If you need to pass several configure
options then append them comma separated: -C --...,--...,--...
--nice - process niceness (for slow computers, default 0)
--ree-options - Options passed directly to ree's './installer' on the command line.

Action

* usage - show this usage information
version - show the rvm version installed in rvm_path
use - setup current shell to use a specific ruby version
reload - reload rvm source itself (useful after changing rvm source)
implode - removes rvm completely, i.e. everything in ~/.rvm
implode - (seppuku) removes the rvm installation completely.
This means everything in $rvm_path (~/.rvm).
This does not touch your profiles, which is why
there is an if around the sourcing scripts/rvm.
update - upgrades rvm to the latest version.
(If you experience bugs try this first with --head)
reset - remove current and stored default & system settings.
(If you experience odd behavior try this second)
info - show information for current ruby
debug - show environment & configuration information for *current* ruby
info - show the *current* environment information for current ruby
debug - show info plus additional information for common issues

install - install one or many ruby versions
See also: http://rvm.beginrescueend.com/rubies/installing/
uninstall - uninstall one or many ruby versions, leaves their sources
remove - uninstall one or many ruby versions and remove their sources

wrapper - generates a set of wrapper executables for a given ruby with the
specified ruby and gemset combination. Used under the hood for
passenger support and the like.

ruby - runs a named ruby file against specified and/or all rubies
gem - runs a gem command using selected ruby's 'gem'
rake - runs a rake task against specified and/or all rubies
Expand All @@ -35,63 +82,26 @@ Action

fetch - Performs an archive / src fetch only of the selected ruby.
list - show currently installed rubies, interactive output.
http://rvm.beginrescueend.com/listing/
http://rvm.beginrescueend.com/rubies/list/
package - Install a dependency package {readline,iconv,zlib,openssl}
http://rvm.beginrescueend.com/packages/
notes - Display notes, with operating system specifics.

Implementation

* ruby - MRI/YARV Ruby (The Standard) {1.8.6,1.8.7,1.9.1,1.9.2...}
jruby - JRuby {1.3.1,1.4.0}
rbx - rubinius
ree - ruby Enterprise Edition
macruby - MacRuby (Mac OS X Only)
maglev - GemStone Ruby
ironruby - IronRuby
mput - shyouhei(mput)'s github repository
* ruby - MRI/YARV Ruby (The Gold Standard) {1.8.6,1.8.7,1.9.1,1.9.2...}
jruby - JRuby, Ruby interpreter on the Java Virtual Machine.
rbx - Rubinius
ree - Ruby Enterprise Edition, MRI Ruby with several custom
patches for performance, stability, and memory.
macruby - MacRuby, insanely fast, can make real apps (Mac OS X Only).
maglev - GemStone Ruby, awesome persistent ruby object store.
ironruby - IronRuby, NOT supported yet. Looking for volunteers to help.
mput - shyouhei(mput)'s github repository, popular in Japan :)
system - use the system ruby (eg. pre-rvm state)
default - use rvm set default ruby and system if it hasn't been set.
http://rvm.beginrescueend.com/rubies/default/

Flags

--head - with update, updates rvm to git head version.
--rubygems - with update, updates rubygems for selected ruby
--default - with ruby select, sets a default ruby for new shells.
--debug - Toggle debug mode on for very verbose output.
--force - Force install, removes old install & source before install.
--dump - Used with gemset to dump the current ruby's gemset.
--load - Used with gemset to load a specified gemset file
--summary - Used with rubydo to print out a summary of the commands run.
--jit - Used with rubinius install to build with JIT
--latest - with gemset --dump skips version strings for latest gem.
--reconfigure - Force ./configure on install even if Makefile already exists.


Options

-v|--version - Emit rvm version loaded for current shell
-h|--help - Emit this output and exit
-l|--level - patch level to use with rvm use / install
--tag - subersion tag to use
--rev - repository revision # to use or 'head' for

--prefix - path for all rvm files (~/.rvm/), with trailing slash!
--bin - path for binaries to be placed (~/.rvm/bin/)
--source - src directory to use (~/.rvm/src/)
--archives - directory for downladed files (~/.rvm/archives/)
-S - Specify a script file to attempt to load and run (rubydo)
-e - Execute code from the command line.
-G|--gems - root gem path to use
-C|--configure - custom configure options, comma separated
default: --enable-shared=true
--reconfigure - Force installer to re-run configure if already run
--make - custom make command
--make-install - custom make install command
--nice - process niceness (for slow computers, default 0)
-m|--gem-set - use a named gem set, instead of the default set.
--rm-gem-set - Remove a named gem set
--ree-options - Options passed directly to ree's './installer' on the command line.

Resources:

Expand Down
6 changes: 4 additions & 2 deletions Rakefile
@@ -1,3 +1,5 @@
require "rubygems"

task :default => ["test"]
task :test do exec "bash -l -c \"./test/suite\"" ; end

Expand Down Expand Up @@ -39,7 +41,7 @@ begin
gemspec.date = Time.now.strftime("%Y-%m-%d")
gemspec.description = "Manages Ruby interpreter environments and switching between them."
gemspec.platform = Gem::Platform::RUBY
gemspec.files = ["install", "README", "sha1", "LICENCE", "rvm.gemspec", "bash/*", "binscripts/*", "scripts/*", "examples/*", "config/*", Dir::glob("lib/**/**")].flatten
gemspec.files = ["install", "README", "sha1", "LICENCE", "rvm.gemspec", "bash/*", "binscripts/*", "scripts/*", "examples/*", "config/*", "help/**", "gemsets/*", "contrib/*", Dir::glob("lib/**/**")].flatten
gemspec.executables = Dir::glob("bin/rvm-*").map{ |script| File::basename script }
gemspec.require_path = "lib"
gemspec.has_rdoc = File::exist?("doc")
Expand All @@ -63,6 +65,6 @@ begin

end
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler -s http://gemcutter.org/"
puts "Jeweler not available. Install it with: gem install jeweler"
end

21 changes: 15 additions & 6 deletions binscripts/rvm
@@ -1,15 +1,24 @@
#!/usr/bin/env bash

if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
for rvmrc in /etc/rvmrc $HOME/.rvmrc ; do
if [[ -f "$rvmrc" ]] ; then
if grep -q '^\s*rvm .*$' $rvmrc ; then
printf "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
exit 1
else
source "$rvmrc"
fi
fi
done

if [[ -z "$rvm_prefix" ]] ; then unset rvm_prefix ; fi
if [[ -z "$rvm_path" ]] ; then unset rvm_path ; fi

if [[ -z "$rvm_prefix" ]] ; then
if [[ -z "$rvm_prefix" ]] ; then
if [[ "root" = "$(whoami)" ]] ; then
rvm_prefix="/usr/local"
rvm_prefix="/usr/local"
else
rvm_prefix="$HOME"
rvm_prefix="$HOME/."
fi
fi

Expand All @@ -33,4 +42,4 @@ source $rvm_scripts_path/rvm

unset rvm_interactive

rvm "$*"
rvm $*
60 changes: 54 additions & 6 deletions binscripts/rvm-prompt
Expand Up @@ -10,7 +10,9 @@ add(){
fi
}

if [[ ! -z "$(which ruby 2>/dev/null | awk '/rvm/{print}')" ]] ; then
rvm_gemset_separator=${rvm_gemset_separator:-"+"}
ruby=$(command -v ruby)
if [[ ! -z "$ruby" ]] && [[ ! -z "$(echo "$ruby" | awk '/rvm/{print}')" ]] ; then
unset format
while [[ $# -gt 0 ]] ; do
token="$1" ; shift
Expand All @@ -20,6 +22,9 @@ if [[ ! -z "$(which ruby 2>/dev/null | awk '/rvm/{print}')" ]] ; then
p|patchlevel) add "patchlevel" ;;
r|revision) add "revision" ;;
a|architecture) add "architecture" ;;
g|gemset) add "gemset" ;;
u|unicode) add "unicode" ;;
s|system) add "system" ;;
*) echo "Unrecognized command line option '$token' for $0" ; exit 1 ;;
esac
done
Expand All @@ -28,26 +33,69 @@ if [[ ! -z "$(which ruby 2>/dev/null | awk '/rvm/{print}')" ]] ; then
add "interpreter"
add "version"
add "patchlevel"
add "gemset"
fi

ruby_string=$(dirname "$(which ruby 2>/dev/null)" | xargs dirname | xargs basename)
if [[ ! -z "$interpreter_flag" ]] ; then
ruby_string=$(dirname "$ruby" | xargs dirname | xargs basename)

if [[ ! -z "$interpreter_flag" ]] || [[ ! -z "$unicode_flag" ]] ; then
interpreter="$(echo $ruby_string | awk -F'-' '{print $1}')"
fi
if [[ ! -z "$version_flag" ]] ; then

if [[ ! -z "$version_flag" ]] || [[ ! -z "$unicode_flag" ]] ; then
version="$(echo $ruby_string | awk -F'-' '{print $2}')"
fi

if [[ ! -z "$patchlevel_flag" ]] ; then
patchlevel=$(echo $ruby_string | awk -F'-' '{print $3}')
fi

if [[ ! -z "$architecture_flag" ]] ; then
architecture="$(echo "$(ruby -v)" | sed 's/^.*\[//' | sed 's/\].*$//')"
fi

if [[ ! -z "$gemset_flag" ]] ; then
gemset="$(echo $GEM_HOME | awk -F${rvm_gemset_separator} '{print $2}')"
if [[ ! -z "$gemset" ]] ; then gemset="${rvm_gemset_separator}$gemset" ; fi
fi

if [[ ! -z "$unicode_flag" ]] ; then
case "$interpreter" in
jruby) unicode="" ;;
rbx) unicode="" ;;
ree) unicode="" ;;
macruby) unicode="" ;;
maglev) unicode="" ;;
ironruby) unicode="" ;;
mput) unicode="" ;;
system) unicode="" ;;
ruby)
case "$version" in
1.8.6) unicode="" ;;
1.8.7) unicode="" ;;
1.9.1) unicode="" ;;
1.9.2) unicode="" ;;
*) unicode="" ;;
esac ;;
*) unicode="" ;;
esac

if [[ ! -z "$(echo $ruby_string | awk '/-head/')" ]] ; then
unicode="${unicode}"
fi
fi

command="prompt=\"$format\""
eval "$command"
echo "${prompt/-]/]}"
echo "$prompt" | sed -e 's#^[[:space:]]*-*##g' -e 's#--*#-#g' -e 's#-*[[:space:]]*$##' -e 's#-'${rvm_gemset_separator}'#'${rvm_gemset_separator}'#'

else
while [[ $# -gt 0 ]] ; do
token="$1" ; shift
case "$token" in
s|system) echo "system" ;;
esac
done
fi

exit 0

32 changes: 32 additions & 0 deletions binscripts/rvm-shell
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

__rvm_shell_lookup_script() {
local relative_scripts_dir="$(dirname -- "$(dirname -- "$0")")/scripts"
for directory in "$rvm_scripts_path" "$HOME/.rvm/scripts" "/usr/local/rvm/scripts" "$relative_scripts_dir"; do
if [[ -d "$directory" && -s "$directory/rvm" ]]; then
echo "$directory/rvm"
return
fi
done
}

# If the first argument isn't -c, remove it and set
# it to the ruby string value.
if [[ -n "$1" && -n "$(echo "$1" | grep -v '^-')" ]]; then
rvm_shell_ruby_string="$1"
shift
fi

if [[ -n "$rvm_shell_ruby_string" ]]; then
rvm_shell_rvm_path="$(__rvm_shell_lookup_script)"
if [[ -n "$rvm_shell_rvm_path" ]]; then
source "$rvm_shell_rvm_path"
rvm "$rvm_shell_ruby_string"
if [[ "$?" -gt 0 ]]; then
echo "Error: RVM was unable to use '#$rvm_shell_ruby_string'" 1>&2
exit 1
fi
fi
fi

exec bash "$@"
13 changes: 13 additions & 0 deletions binscripts/rvm-update-head
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
rvm_path="${rvm_path:-$HOME/.rvm}"
mkdir -p $rvm_path/src/
cd $rvm_path/src

rm -rf ./rvm/ && git clone --depth 1 git://github.com/wayneeseguin/rvm.git
cd rvm
# v v v This is a godo idea however it does not preserve the executible bit.
# Needs more thought, perhaps a simple sed instead.
# dos2unix scripts/* >/dev/null 2>&1
bash scripts/install
23 changes: 23 additions & 0 deletions binscripts/rvm-update-latest
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
rvm_path="${rvm_path:-$HOME/.rvm}"
mkdir -p $rvm_path/src/
cd $rvm_path/src

stable_version=$(curl -B http://rvm.beginrescueend.com/releases/stable-version.txt 2>/dev/null)

echo "rvm-${stable_version}"

curl -L "http://rvm.beginrescueend.com/releases/rvm-${stable_version}.tar.gz" -o "rvm-${stable_version}.tar.gz"

tar zxf "rvm-${stable_version}.tar.gz"

cd "rvm-${stable_version}"

# v v v This is a godo idea however it does not preserve the executible bit.
# Needs more thought, perhaps a simple sed instead.
#dos2unix scripts/* >/dev/null 2>&1

bash scripts/install
7 changes: 1 addition & 6 deletions binscripts/rvmsudo
@@ -1,8 +1,3 @@
#!/usr/bin/env bash

prefix="PATH='$PATH'"
if [[ ! -z "$BUNDLE_PATH" ]] ; then prefix="BUNDLE_PATH='$BUNDLE_PATH' $prefix" ; fi
if [[ ! -z "$GEM_HOME" ]] ; then prefix="GEM_HOME='$GEM_HOME' $prefix" ; fi
if [[ ! -z "$GEM_PATH" ]] ; then prefix="GEM_PATH='$GEM_PATH' $prefix" ; fi

eval "sudo" "/usr/bin/env $prefix $@"
exec sudo -E "$@"

0 comments on commit 40488ba

Please sign in to comment.