rvm 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bash/rvm +14 -3
  2. data/bash/rvm-install +80 -21
  3. metadata +1 -1
data/bash/rvm CHANGED
@@ -3,7 +3,7 @@
3
3
  rvm_author="Wayne E. Seguin"
4
4
  rvm_author_email="wayneeseguin@gmail.com"
5
5
  rvm_website="http://github.com/wayneeseguin/rvm"
6
- rvm_version="0.0.14"
6
+ rvm_version="0.0.15"
7
7
  rvm_updated="2009.08.25"
8
8
 
9
9
  #
@@ -183,6 +183,9 @@ function rvm-install-source {
183
183
  make install > $install_path/$package_name/install.log 2> $install_path/$package_name/install.error.log
184
184
  chmod +x $install_path/$package_name/bin/*
185
185
 
186
+ # Create the ~/.rvm/bin/$package_name
187
+ ln -s $install_path/$package_name/bin/ruby $install_path/bin/$package_name
188
+
186
189
  # Now install rubygems for this ruby version.
187
190
  rvm-log-info "\tInstalling rubygems dedicated to $package_name..."
188
191
  gem_package_name="rubygems-1.3.5"
@@ -232,6 +235,8 @@ function rvm-install-ruby {
232
235
  ./installer -a $install_path/ruby-enterprise-$version-$patchlevel --dont-install-useful-gems > $install_path/$package_name/install.log 2> $install_path/$package_name/install.error.log
233
236
  chmod +x $install_path/$package_name/bin/*
234
237
 
238
+ ln -s $install_path/$package_name/bin/ruby $install_path/bin/$package_name
239
+
235
240
  rvm-log-info "\tInstalling rubygems dedicated to $package_name..."
236
241
  gem_package_name="rubygems-1.3.5"
237
242
  gem_url="http://rubyforge.org/frs/download.php/60718/$gem_package_name.tgz"
@@ -283,6 +288,9 @@ function rvm-install-ruby {
283
288
  for binary in jruby jgem jirb ; do
284
289
  ln -sf $install_path/$package_name/bin/$binary $install_path/$package_name/bin/${binary#j}
285
290
  done
291
+
292
+ ln -s $install_path/$package_name/bin/ruby $install_path/bin/$package_name
293
+
286
294
  for gem_name in rake jruby-openssl ; do
287
295
  rvm-log-info "Installing $gem_name"
288
296
  $install_path/$package_name/bin/jgem install $gem_name --no-rdoc --no-ri -q >> $install_path/$package_name/gems.install.log
@@ -429,12 +437,15 @@ function rvm-use {
429
437
 
430
438
  esac
431
439
 
440
+ # Now actually use it.
432
441
  if [ ! "$implementation" = "default" ] ; then
442
+ # Install if not installed
433
443
  if [ ! -d $MY_RUBY_HOME ] ; then
434
444
  rvm-log-warn "$implementation $version is not installed."
435
445
  rvm-install-ruby $implementation $version $level
436
446
  fi
437
447
 
448
+ # Set as 'current'
438
449
  RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
439
450
  export GEM_HOME MY_RUBY_HOME RUBY_VERSION
440
451
 
@@ -649,10 +660,10 @@ function rvm {
649
660
  else
650
661
  prefix_path=${prefix-$HOME/.}
651
662
  fi
652
- source_path="${source_path-"$prefix_path/src"}"
663
+ source_path="${source_path-"${prefix_path}rvm/src"}"
653
664
  install_path="${prefix_path}rvm"
654
665
 
655
- mkdir -p $prefix_path $source_path $install_path
666
+ mkdir -p $prefix_path $source_path $install_path/bin
656
667
 
657
668
  if [ ! -f $install_path/default ] ; then
658
669
  for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME PATH ; do
data/bash/rvm-install CHANGED
@@ -2,36 +2,95 @@
2
2
 
3
3
  user=`whoami`
4
4
  if [ "$user" = "root" ] ; then
5
- echo -e "\e[0;31m <e> \e[0mroot user support is not yet implemented."
5
+ echo -e "\e[0;31m <e> \e[0mroot user support is not yet implemented.\e[0m"
6
6
  exit 1
7
7
  fi
8
8
 
9
- mkdir -p ~/.rvm/src ~/.rvm/bin
9
+ info="\n\e[0;32m<i>\e[0m"
10
+ question="\n\e[0;32m<?>\e[0m"
10
11
 
12
+ echo -e "Installing rvm source to ~/.rvm/bin/rvm..."
13
+ mkdir -p ~/.rvm/src ~/.rvm/bin
11
14
  cp $(pwd)/bash/rvm ~/.rvm/bin/
12
15
 
13
- touch ~/.profile
14
- if [ -z "`grep '\.rvm/bin/rvm' ~/.profile`" ] ; then
15
- echo "Adding 'source ~/.rvm/bin/rvm' to your ~/.profile."
16
- echo "source ~/.rvm/bin/rvm" >> ~/.profile
17
- fi
16
+ # State what is required to use rvm
17
+ echo -e "\n\e[0;32mrvm\e[0m is a shell script that allows a user to manage multiple ruby versions in their own account."
18
+ echo -e "$info In order to use rvm two items must occur in your shell's load paths:"
19
+ echo -e "\n\e[0;32m (a)\e[0m if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi"
20
+ echo -e "\e[0;32m (b)\e[0m if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi"
18
21
 
19
- if [ -z "`grep '\.rvm/current' ~/.profile`" ] ; then
20
- echo "Adding 'source ~/.rvm/current' ~/.profile."
21
- echo "if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi" >> ~/.profile
22
- fi
22
+ echo -n -e "$question Would you like (u)s to set this up for you, or do it (y)ourself (u/y)? "
23
+ while : ; do
24
+ read response
25
+ if [ "${response:0:1}" = "u" ] ; then
26
+ echo 'w00t!'
27
+ break
28
+ elif [ "${response:0:1}" = "f" ] ; then
29
+ echo -e "$info Please make sure that both lines (a) and (b) are in place, with (a) sourced *first*."
30
+ break
31
+ else
32
+ echo -n -e "$question Would you like (u)s to set this up for you, or do it yoursel(f) (u/f)? "
33
+ fi
34
+ done
23
35
 
24
- touch ~/.bash_profile
25
- if [ -z "`grep '\.profile' ~/.bash_profile`" ] ; then
26
- echo "Adding 'source ~/.profile' to the end of ~/.bash_profile."
27
- echo "if [ -f ~/.profile ] ; then source ~/.profile ; fi" >> ~/.bash_profile
28
- fi
36
+ if [ "${response:0:1}" = "u" ] ; then
29
37
 
30
- touch ~/.zprofile
31
- if [ -z "`grep '\.profile' ~/.zprofile`" ] ; then
32
- echo "Adding 'source ~/.profile' to the end of ~/.zprofile."
33
- echo "if [ -f ~/.profile ] ; then source ~/.profile ; fi" >> ~/.zprofile
38
+ # Find out the user's shell bash / zsh
39
+ echo -n -e "$question Do you use (b)ash or (z)sh for your shell (the default on most *nix systems is bash, press control + C to cancel the installation)\n(b/z) ? "
40
+ while : ; do
41
+ read response
42
+ if [ "${response:0:1}" = "b" ] ; then
43
+ user_shell="bash"
44
+ break
45
+ elif [ "${response:0:1}" = "z" ] ; then
46
+ user_shell="zsh"
47
+ break
48
+ else
49
+ echo -n -e "$question Do you use (b)ash or (z)sh for your shell (the default on most *nix systems is bash, press control + C to cancel the installation)\n(b/z) ? "
50
+ fi
51
+ done
52
+
53
+ touch ~/.profile
54
+
55
+ if [ "$user_shell" = "bash" ] ; then
56
+
57
+ touch ~/.bash_profile
58
+ if [ -z "`grep '\.rvm/bin/rvm' ~/.bash_profile`" ] ; then
59
+ echo "Adding 'if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi' to your ~/.bash_profile."
60
+ echo "if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi" >> ~/.bash_profile
61
+ fi
62
+
63
+ if [ -z "`grep '\.rvm/current' ~/.bash_profile`" ] ; then
64
+ echo "Adding 'if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi' ~/.bash_profile."
65
+ echo "if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi" >> ~/.bash_profile
66
+ fi
67
+
68
+ elif [ "$user_shell" = "zsh" ] ; then
69
+
70
+ touch ~/.zshrc
71
+ if [ -z "`grep '\.rvm/bin/rvm' ~/.zshrc`" ] ; then
72
+ echo "Adding 'if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi' to your ~/.zshrc."
73
+ echo "if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi" >> ~/.zshrc
74
+ fi
75
+
76
+ if [ -z "`grep '\.rvm/current' ~/.zshrc`" ] ; then
77
+ echo "Adding 'if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi' ~/.zshrc."
78
+ echo "if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi" >> ~/.zshrc
79
+ fi
80
+
81
+ else
82
+
83
+ echo -e "\n\e[0;31m<e> An error has occurred, we were expecting either bash or zsh however we encountered $user_shell \e[0m"
84
+ return 1
85
+
86
+ fi
34
87
  fi
35
88
 
36
- echo -e "\n\e[0;32mOpen a new shell and enjoy rvm: rvm usage\e[0m\n"
89
+ echo -e "\n$info If you add ~/.rvm/bin/ to your path you will be able to rever to installed ruby binaries using: <implementation>-<version>p<patchlevel>"
90
+ echo -e " For example: ~/.ruby-1.9.1p243 -e 'puts \"hello world\"' #=> hello world"
91
+ echo -e "$info Contact wayneeseguin on irc.freenod.net in #rvm for any questions / feedback."
92
+ echo -e " I truely hope that you find rvm helpful! Thank you very much for using rvm. \n"
93
+ echo -e " ~ Wayne"
94
+
95
+ echo -e "$info To start using rvm see: \e[0;32m rvm usage\e[0m, Now close this login shell and open a new one."
37
96
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne E. Seguin