Skip to content

Commit

Permalink
'rvm default' now uses the current set default or system. 'rvm system…
Browse files Browse the repository at this point in the history
…' now uses system. Added bugfix for install/update, thanks Maz.
  • Loading branch information
wayneeseguin committed Aug 31, 2009
1 parent fe841df commit a64687b
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 14 deletions.
20 changes: 9 additions & 11 deletions scripts/rvm
Expand Up @@ -53,7 +53,8 @@ function __rvm_usage {
jruby - jRuby
rubinius - Rubinius
ree - Ruby Enterprise Edition
default - Use the default system ruby
system - Use the system ruby (eg. pre-rvm state)
default - Use rvm set default ruby and system if it hasn't been set.
Options:
Expand Down Expand Up @@ -585,12 +586,8 @@ function __rvm_select {
fi
;;

system|default)
unset rvm_ruby_interpreter rvm_ruby_version
__rvm_cleanup-variables
if [ -e $rvm_install_path/current ] ; then
source $rvm_install_path/current
fi
default|system)
#noop?
;;
*)
__rvm_log "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
Expand Down Expand Up @@ -639,14 +636,15 @@ function __rvm_select {
function __rvm_use {

if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
if [ -z "$rvm_ruby_interpreter" ] ; then rvm_ruby_interpreter="default" ; fi

if [ "$rvm_ruby_interpreter" = "default" -o "$rvm_ruby_interpreter" = "system" -o -z "$rvm_ruby_interpreter" ] ; then
if [ "$rvm_ruby_interpreter" = "default" -o "$rvm_ruby_interpreter" = "system" ] ; then
unset GEM_HOME MY_RUBY_HOME IRBRC
__rvm_cleanup-variables
PATH="$rvm_default_path" ; export PATH
if [ -e $rvm_install_path/current ] ; then
if [ "$rvm_ruby_interpreter" = "default" -a -s $rvm_install_path/current ] ; then
source $rvm_install_path/current
fi

else
GEM_HOME=$rvm_gem_home ; export GEM_HOME
MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME
Expand Down Expand Up @@ -724,7 +722,7 @@ function __rvm_list {

function __rvm_reset {

__rvm_select "default"
__rvm_select "system"

PATH="$rvm_default_path" ; export PATH
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do unset $variable ; done
Expand Down
4 changes: 2 additions & 2 deletions scripts/rvm-install
Expand Up @@ -10,8 +10,8 @@ info="\n\033[0;32m<i>\033[0m"
question="\n\033[0;32m<?>\033[0m"
cwd=$(pwd)
source_dir="${source_dir:-`dirname $0 | xargs dirname`}"
if [ ! -d "$source_dir" ] ; then unset source_dir ; fi
source_dir="${source_dir:-$cwd}"
export source_dir
rvm_dir=~/.rvm

echo -e "Installing rvm source to ~/.rvm/scripts/rvm..."
Expand All @@ -35,7 +35,7 @@ fi

for dir in scripts examples ; do
mkdir -p $rvm_dir/$dir
for file in `/bin/ls $dir/`; do
for file in `/bin/ls $source_dir/$dir/`; do
cp $source_dir/$dir/$file $rvm_dir/$dir/$file
done
done
Expand Down
3 changes: 2 additions & 1 deletion scripts/rvm-update
Expand Up @@ -7,6 +7,7 @@ if [ "$user" = "root" ] ; then
fi
cwd=$(pwd)
source_dir="${source_dir:-`dirname $0 | xargs dirname`}"
if [ ! -d "$source_dir" ] ; then unset source_dir ; fi
source_dir="${source_dir:-$cwd}"
rvm_dir=~/.rvm

Expand All @@ -31,7 +32,7 @@ fi

for dir in scripts examples ; do
mkdir -p $rvm_dir/$dir
for file in `/bin/ls $dir/`; do
for file in `/bin/ls $source_dir/$dir/`; do
cp $source_dir/$dir/$file $rvm_dir/$dir/$file
done
done
Expand Down
76 changes: 76 additions & 0 deletions site/output/setdefault/index.html
@@ -0,0 +1,76 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>rvm: Ruby Version Manager - Set Default Ruby</title>
<link rel="stylesheet" type="text/css" href="/bp.css" media="screen">
<link rel="stylesheet" type="text/css" href="/style.css" media="screen">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>

<a href="http://github.com/wayneeseguin/rvm"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub" /></a>

<div class="container">
<div id="sidebar" class="span-7 append-1">
<div id="header">
<div class="title"><a href="/">rvm</a></div>
<div class="tagline">Ruby Version Manager</div>
</div>
<h2 class="quick">
gem install rvm
<br/>
rvm-install
</h2>

<h2>Navigation</h2>
<ul>
<li><a href="/install/">Installing</a></li>
<li><a href="/use/">Using</a></li>
<li><a href="/implementations/">Interpreters</a></li>
<li><a href="/patchlevels/">Patch Levels</a></li>
<li><a href="/setdefault/">Set Default Ruby</a></li>
<!--
<li><a href="/tags/">Tags</a></li>
<li><a href="/revisions/">Revisions</a></li>
<li><a href="/gemsets/">Named Gem Sets</a></li>
<li><a href="/rvmrc/">rvmrc</a></li>
-->
<li><a href="/rubydo/">rubydo / do</a></li>
<li><a href="/examples/">Examples</a></li>
<li><a href="/faq/">FAQ & Notes</a></li>
<li><a href="/todo/">TODO</a></li>
<li><a href="/contribute/">Contributing</a></li>
<li><a href="/about/">About</a></li>
<li><a href="/thanks/">Credits &amp; Thanks</a></li>
</ul>

<h2>IRC</h2>
<ul>
<li>irc.freenode.net #rvm</li>
<li>wayneeseguin</li>
</ul>

<h2>Development</h2>
<ul>
<li><a href="http://github.com/wayneeseguin/rvm/tree/master">Git (GitHub)</a></li>
<li><a href="http://github.com/wayneeseguin/rvm/issues">Issues (GitHub)</a></li>
<li><a href="https://www.pivotaltracker.com/projects/26822">Pivotal Tracker Project</a></li>
</ul>
</div>
<div id="main" class="span-16 last">
<a name="top"></a>
<a name="setdefault"></a>
<a name="default"></a>
<h1>Setting the default Ruby</h1>

<p>If you would like to make a Ruby be the default ruby that is selected when you open a new terminal shell simply use the --default flag:</p>
<code>
$ rvm 1.9.1 --default
</code>
<p>The next time you open a window Ruby 1.9.1 will be the selected ruby.</p>

<a name="bottom"></a>
</div>
</div>
</body>
</html>

0 comments on commit a64687b

Please sign in to comment.