install in rvm-1.0.11 vs install in rvm-1.0.13
- old
+ new
@@ -1,50 +1,68 @@
#!/usr/bin/env bash
set -o errtrace
+set -o errexit
+
export PS4='+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }'
if [[ -z "$rvm_selfcontained" ]]; then
- if [[ "root" = "$(whoami)" ]] || [[ -n "$rvm_prefix" && "$rvm_prefix" != "$HOME"/* ]]; then
+ if [[ "root" = "$(whoami)" \
+ || -n "$rvm_prefix" && "$rvm_prefix" != "$HOME"/* ]]; then
export rvm_selfcontained=0
else
export rvm_selfcontained=1
fi
fi
unset rvm_auto_flag
install_source_path="$(dirname "$0" | sed 's#\/scripts$##')"
-if [[ -d "$install_source_path/scripts" ]] && [[ -s "$install_source_path/scripts/utility" ]] ; then
+if [[ -d "$install_source_path/scripts" \
+ && -s "$install_source_path/scripts/utility" ]] ; then
builtin cd "$install_source_path"
fi
source scripts/version
source scripts/utility
-usage() {
+usage()
+{
printf "
Usage:
+
${0} [options]
options:
+
--auto : Automatically update shell profile files.
+
--prefix : Installation prefix directory.
+
--help : Display help/usage (this) message
+
--version : display rvm package version
+
"
}
-check_rubyopt_conditions() {
+check_rubyopt_conditions()
+{
if [[ -n "${RUBYOPT:-""}" ]]; then
- printf "\n\nWARNING: You have RUBYOPT set in your current environment. This may interfere with normal rvm"
- printf "\n operation. If errors show up, please try unsetting RUBYOPT first.\n"
+ printf "
+
+WARNING: You have RUBYOPT set in your current environment.
+This may cause rubies to not work as you expect them to as it is not supported
+by all of them If errors show up, please try unsetting RUBYOPT first.
+
+"
fi
}
-andand_return_instructions() {
+andand_return_instructions()
+{
printf "
This means that if you see something like:
'[ -z \"\$PS1\" ] && return'
@@ -61,11 +79,12 @@
EOF - This marks the end of the .bashrc file
"
}
-installation_complete() {
+installation_complete()
+{
printf "
You must now complete the install by loading RVM in new shells.
1) Place the folowing line at the end of your shell's loading files
(.bashrc or .bash_profile for bash and .zshrc for zsh),
@@ -89,11 +108,12 @@
3) CLOSE THIS SHELL and open a new one in order to use rvm.
\n"
}
-andand_return_warning() {
+andand_return_warning()
+{
printf "
WARNING: you have a 'return' statement in your ~/.bashrc
This could cause some features of RVM to not work.
$(andand_return_instructions)
@@ -102,11 +122,12 @@
If you have any questions about this please visit
#rvm on irc.freenode.net.
\n"
}
-thank_you() {
+thank_you()
+{
printf "
${name:-"$(whoami)"},
Thank you very much for using RVM! I sincerely hope that RVM helps to
make your work both easier and more enjoyable.
@@ -133,11 +154,12 @@
~ Wayne
"
}
-upgrade_notes() {
+upgrade_notes()
+{
printf "
Upgrade Notes
* Ruby package dependency list for your OS is given by:
@@ -185,18 +207,27 @@
rvm_path="${rvm_prefix}rvm"
fi
source scripts/initialize
-if grep -q 'scripts/rvm' "$HOME"/.bash* 2>/dev/null || grep -q 'scripts/rvm' "$HOME"/.zsh* 2>/dev/null; then
+if grep -q 'scripts/rvm' "$HOME"/.bash* 2>/dev/null \
+ || grep -q 'scripts/rvm' "$HOME"/.zsh* 2>/dev/null ; then
+
if [[ -d "$rvm_path" ]] && [[ -s "${rvm_path}/scripts/rvm" ]] ; then
+
export upgrade_flag=1
+
else
+
export upgrade_flag=0
+
fi
+
else
+
export upgrade_flag=0
+
fi
__rvm_initialize
#
@@ -235,11 +266,21 @@
printf "\nInstalling RVM to $rvm_path/"
fi
-directories=( "${rvm_archives_path:-"$rvm_path/archives"}" "${rvm_src_path:-"$rvm_path/src"}" "${rvm_log_path:-"$rvm_path/log"}" "$rvm_bin_path" "${rvm_gems_path:-"$rvm_path/gems"}" "${rvm_rubies_path:-"$rvm_path/rubies"}" "$rvm_path/config" "${rvm_tmp_path:-"$rvm_path/tmp"}" "$rvm_path/bin" )
+directories=(
+ "${rvm_archives_path:-"$rvm_path/archives"}"
+ "${rvm_src_path:-"$rvm_path/src"}"
+ "${rvm_log_path:-"$rvm_path/log"}"
+ "$rvm_bin_path"
+ "${rvm_gems_path:-"$rvm_path/gems"}"
+ "${rvm_rubies_path:-"$rvm_path/rubies"}"
+ "$rvm_path/config"
+ "${rvm_tmp_path:-"$rvm_path/tmp"}"
+ "$rvm_path/bin"
+ )
for directory in "${directories[@]}" ; do
if [[ ! -d "$directory" ]] ; then
@@ -275,11 +316,12 @@
fi
done
if [[ ! -s "$rvm_path/config/user" ]] ; then
- echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_path/config/user"
+ echo '# User settings, overrides db settings and persists across installs.' \
+ >> "$rvm_path/config/user"
fi
scripts=(monitor match log install color db fetch log set package)
for script_name in "${scripts[@]}" ; do
@@ -319,23 +361,29 @@
if [[ -s "$HOME/.profile" ]] ; then
if ! grep -q '.profile' "$rcfile" ; then
- echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
+ echo " Adding profile sourcing line to $rcfile."
- printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> "$rcfile"
+ printf "
+# rvm-install added line:
+[[ -s \$HOME/.profile ]] && source \$HOME/.profile
+" >> "$rcfile"
fi
fi
if ! grep -q "scripts\/rvm" "$rcfile" ; then
- echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
+ echo " Adding rvm loading line to $rcfile."
- printf "\n# rvm-install added:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> "$rcfile"
+ printf "
+# rvm-install added:
+[[ -s \"$rvm_path/.rvm/scripts/rvm\" ]] && . \"$rvm_path/.rvm/scripts/rvm\"
+" >> "$rcfile"
fi
done
fi
@@ -350,21 +398,22 @@
mkdir -p "$rvm_path/gemsets"
fi
- for gemset_file in $(builtin cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
+ for gemset_file in $(find "$PWD/gemsets" -iname '*.gems' | sed 's/^\.\///') ; do
- destination="$rvm_path/gemsets/$gemset_file"
+ cwd="${PWD//\//\\/}\/gemsets\/"
+ destination="$rvm_path/gemsets/${gemset_file/$cwd}"
destination_path="$(dirname "$destination")"
if [[ ! -s "$destination" ]] ; then
mkdir -p "$destination_path"
- cp "gemsets/$gemset_file" "$destination"
+ cp "$gemset_file" "$destination"
fi
done
@@ -402,11 +451,12 @@
#
# Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
#
mkdir -p "${rvm_rubies_path:-"$rvm_path/rubies"}/"
-for ruby in $rvm_path/ruby-* $rvm_path/jruby-* $rvm_path/mput-* $rvm_path/rbx-* $rvm_path/maglev-* $rvm_path/ree-* ; do
+for ruby in $rvm_path/ruby-* $rvm_path/jruby-* $rvm_path/mput-* \
+ $rvm_path/rbx-* $rvm_path/maglev-* $rvm_path/ree-* ; do
if [[ -d "$ruby" ]] ; then
mv "$ruby" "${rvm_rubies_path:-"$rvm_path/rubies"}/"
@@ -414,11 +464,12 @@
for file in gem rake ; do
if [[ -s "$new_path/bin/$file" ]] ; then
- sed -e '1,1s=.*=#!'"${new_path}/bin/ruby=" "${new_path}/bin/${file}" > "${new_path}/bin/${file}.new"
+ sed -e '1,1s=.*=#!'"${new_path}/bin/ruby=" "${new_path}/bin/${file}" \
+ > "${new_path}/bin/${file}.new"
mv -f "$new_path/bin/$file.new" "$new_path/bin/$file"
chmod +x "$new_path/bin/$file"
@@ -479,11 +530,12 @@
done
# Move from legacy defaults to the new, alias based system.
if [[ -s "$rvm_path/config/default" ]]; then
- original_version="$(basename "$(grep GEM_HOME "$rvm_path/config/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator:-"@"}#")")"
+ original_version="$(basename "$(grep GEM_HOME "$rvm_path/config/default" \
+ | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator:-"@"}#")")"
if [[ -n "$original_version" ]]; then
"$rvm_path/scripts/alias" create default "$original_version" &> /dev/null
@@ -503,23 +555,28 @@
mkdir -p "${rvm_bin_path:-"$rvm_path/bin"}"
files=(rvm rvmsudo rvm-shell rvm-auto-ruby)
for file in "${files[@]}" ; do
- [[ -s "${rvm_bin_path:-"$rvm_path/bin"}/$file" ]] && chmod +x "${rvm_bin_path:-"$rvm_path/bin"}/$file"
+ if [[ -s "${rvm_bin_path:-"$rvm_path/bin"}/$file" ]] ; then
+ chmod +x "${rvm_bin_path:-"$rvm_path/bin"}/$file"
+
+ fi
+
done
printf "\n Copying manpages into place."
-files=($(builtin cd "$install_source_path/man" ; find . -maxdepth 1 -mindepth 1 -type f -print))
+files=($(builtin cd "$install_source_path/man" ; \
+ find . -maxdepth 1 -mindepth 1 -type f -print))
for file in "${files[@]//.\/}" ; do
- rm -rf "$rvm_man_path/$man_file"
+ rm -rf "$rvm_man_path/$file"
- cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
+ cp -R "$install_source_path/man/$file" "$rvm_man_path/"
done
files=($( find "$rvm_path/" -mindepth 1 -maxdepth 2 -iname '*.swp' -type f ))
@@ -535,22 +592,20 @@
done
fi
if [[ $upgrade_flag -eq 0 ]] ; then
- chmod +x ./script/notes # Sometimes things don't clone properly :/
+ chmod +x ./scripts/notes # Sometimes things don't clone properly :/
./scripts/notes
fi
name="$(awk -F= '/^[[:space:]]*name/{print $2}' ~/.gitconfig 2>/dev/null)"
if [[ ${upgrade_flag:-0} -eq 1 ]] ; then
upgrade_notes
check_rubyopt_conditions
-
- regenerate_wrappers
printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
else