bash/rvm-install in rvm-0.0.22 vs bash/rvm-install in rvm-0.0.23
- old
+ new
@@ -1,25 +1,27 @@
#!/bin/bash
user=`whoami`
-if [ "$user" = "root" ] ; then
+if [ "$user" = "root" ] ; then
echo -e "\033[0;31m <e> \033[0mroot user support is not yet implemented.\033[0m"
exit 1
fi
info="\n\033[0;32m<i>\033[0m"
question="\n\033[0;32m<?>\033[0m"
echo -e "Installing rvm source to ~/.rvm/bin/rvm..."
mkdir -p ~/.rvm/src ~/.rvm/bin
-cp $(pwd)/bash/rvm ~/.rvm/bin/
+for script in rvm ; do # Preparing for refactoring.
+ cp "`dirname "${0}"`/$script" ~/.rvm/bin/
+done
+
# State what is required to use rvm
echo -e "\n\033[0;32mrvm\033[0m is a shell script that allows a user to manage multiple ruby versions in their own account."
-echo -e "$info In order to use rvm two items must occur in your shell's load paths:"
+echo -e "$info In order to use rvm the following line must occur in your shell's loading files:"
echo -e "\n\033[0;32m (a)\033[0m if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi"
-echo -e "\033[0;32m (b)\033[0m if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi"
while : ; do
echo -n -e "$question Do you want this (s)cript to set this up for you, or do it (m)anually yourself ('s' or 'm')? "
read response
if [ "${response:0:1}" = "s" ] ; then
@@ -45,71 +47,65 @@
elif [ "${response:0:1}" = "o" ] ; then
user_shell="both"
break
fi
done
-
- touch ~/.profile
-
+
if [ "$user_shell" = "bash" -o "$user_shell" = "both" ] ; then
-
+
touch ~/.bash_profile
if [ -z "`grep '\.rvm/bin/rvm' ~/.bash_profile`" ] ; then
echo "Adding 'if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi' to your ~/.bash_profile."
echo "if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi" >> ~/.bash_profile
fi
-
- if [ -z "`grep '\.rvm/current' ~/.bash_profile`" ] ; then
- echo "Adding 'if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi' ~/.bash_profile."
- echo "if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi" >> ~/.bash_profile
+ touch ~/.bashrc
+ if [ -z "`grep '\.rvm/bin/rvm' ~/.bashrc`" ] ; then
+ echo "Adding 'if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi' to your ~/.bashrc."
+ echo "if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi" >> ~/.bashrc
fi
-
- elif [ "$user_shell" = "zsh" -o "$user_shell" = "both" ] ; then
-
+
+ fi
+
+ if [ "$user_shell" = "zsh" -o "$user_shell" = "both" ] ; then
+
touch ~/.zshrc
if [ -z "`grep '\.rvm/bin/rvm' ~/.zshrc`" ] ; then
echo "Adding 'if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi' to your ~/.zshrc."
echo "if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi" >> ~/.zshrc
fi
-
- if [ -z "`grep '\.rvm/current' ~/.zshrc`" ] ; then
- echo "Adding 'if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi' ~/.zshrc."
- echo "if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi" >> ~/.zshrc
- fi
-
- else
-
- echo -e "\n\033[0;31m<e> An error has occurred, we were expecting either bash or zsh however we encountered $user_shell \033[0m"
- return 1
-
fi
+
fi
system=`uname`
if [ "$system" = "Linux" ] ; then
- echo -e "For jRuby (if you wish to use it) you will need:"
- if [ ! -z "`which apt-get 2>/dev/null`" ] ; then
- echo -e " sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk "
- elif [ ! -z "`which emerge 2>/dev/null`" ] ; then
- echo -e "emerge dev-java/sun-jdk dev-java/sun-jre-bin"
- elif [ ! -z "`which pacman 2>/dev/null`" ] ; then
- echo -e "pacman -Sy jdk jre"
- elif [ ! -z "`which yum 2>/dev/null`" ] ; then
- echo -e "yum install -y rpm-build gcc gcc-c++ redhat-rpm-config ; then download and rpmbuild and install the sdk, Have fun..."
+ rvm_apt_get_binary=`which apt-get`
+ rvm_emerge_binary=`which emerge`
+ rvm_pacman_binary=`which pacman`
+ rvm_yum_binary=`which yum`
+
+ echo -e "\033[0;33m <w> \033[0mFor jRuby (if you wish to use it) you will need:"
+ if [ ! -z "$rvm_apt_get_binary" ] ; then
+ echo -e "\033[0;32m <i> \033[0msudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk "
+ elif [ ! -z "$rvm_emerge_binary" ] ; then
+ echo -e "\033[0;32m <i> \033[0msudo emerge dev-java/sun-jdk dev-java/sun-jre-bin"
+ elif [ ! -z "$rvm_pacman_binary" ] ; then
+ echo -e "\033[0;32m <i> \033[0msudo pacman -Sy jdk jre"
+ elif [ ! -z "$rvm_yum_binary" ] ; then
+ echo -e "\033[0;32m <i> \033[0myum install -y rpm-build gcc gcc-c++ redhat-rpm-config ; then download and rpmbuild and install the sdk, Have fun..."
else
- echo -e "The SUN java runtime environment and development kit."
+ echo -e "\033[0;32m <i> \033[0mThe SUN java runtime environment and development kit."
fi
#elif [ "$sytem" = "Darwin" ] ; then
#else
-
fi
source ~/.rvm/bin/rvm
-rvm-symlinks
+rvm symlinks
-echo -e "\n$info If you add ~/.rvm/bin/ to your path you will be able to refer to installed ruby binaries using: <implementation>-<version>p<patchlevel>"
+echo -e "\n$info If you add ~/.rvm/bin/ to your path you will be able to refer to installed ruby binaries using: <implementation>-<version><patchlevel>"
echo -e " For example: ruby-1.9.1-p243 -e 'puts \"hello world\"' #=> hello world"
-echo -e "$info Contact wayneeseguin on irc.freenod.net in #rvm for any questions / feedback."
+echo -e "$info Contact wayneeseguin on irc.freenode.net in #rvm for any questions / feedback."
echo -e " I truly hope that you find rvm helpful! Thank you very much for using rvm. \n"
echo -e " ~ Wayne"
echo -e "$info To start using rvm see: \033[0;32m rvm usage\033[0m, Now close this login shell and open a new one."