Skip to content
Browse files

Merge branch 'master' of https://github.com/wayneeseguin/rvm into mac…

…ruby_repo_url_github
  • Loading branch information...
2 parents 0050bb7 + 0bde515 commit 2a7166ba02528dda22958192fcbb41fdb19b0ea1 @hiroshi hiroshi committed
View
2 binscripts/rvm-install
@@ -8,7 +8,7 @@ Dir.chpwd( File.join( ENV["GEM_HOME"], "gems", "rvm-#{RVM::Version::STRING}", "r
puts "Extracting bundled rvm-#{RVM::Version::STRING}.tar.gz"
- %x{tar zxf rvm-#{RVM::Version::STRING}.tar.gz}
+ %x{tar zoxf rvm-#{RVM::Version::STRING}.tar.gz}
Dir.chpwd( "rvm-#{RVM::Version::STRING}" ) do
View
29 binscripts/rvm-installer
@@ -85,7 +85,7 @@ Halting installation.
"
fi
- tar zxf "${rvm_archives_path}/rvm-${version}.tar.gz" -C "$rvm_src_path/"
+ tar zoxf "${rvm_archives_path}/rvm-${version}.tar.gz" -C "$rvm_src_path/"
cd "$rvm_src_path/rvm-${version}"
}
@@ -140,16 +140,6 @@ else
fi
fi
-export PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
-
-rvm_src_path="$rvm_path/src"
-rvm_archives_path="$rvm_path/archives"
-rvm_releases_url="http://rvm.beginrescueend.com/releases"
-
-for dir in "$rvm_src_path" "$rvm_archives_path" ; do
- [[ ! -d "$dir" ]] && mkdir -p "$dir/"
-done
-
# Parse CLI arguments.
while [[ $# -gt 0 ]] ; do
token="$1" ; shift
@@ -183,10 +173,10 @@ while [[ $# -gt 0 ]] ; do
version="$1" ; shift
;;
lastest|stable)
- version="latest"
+ version="latest" ; shift
;;
head|master)
- version="head"
+ version="head" ; shift
branch="master"
;;
*)
@@ -215,6 +205,17 @@ done
true "${version:=head}"
+export PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
+
+rvm_src_path="$rvm_path/src"
+rvm_archives_path="$rvm_path/archives"
+rvm_releases_url="http://rvm.beginrescueend.com/releases"
+rvm_prefix="$(dirname $rvm_path)/"
+
+for dir in "$rvm_src_path" "$rvm_archives_path" ; do
+ [[ ! -d "$dir" ]] && mkdir -p "$dir/"
+done
+
# Perform the actual installation, first we obtain the source using whichever
# means was specified, if any. Defaults to head.
case "${version}" in
@@ -244,4 +245,4 @@ flags=""
[[ ${rvm_debug_flag:-0} -eq 1 ]] && flags="$flags --debug"
# Now we yield to the RVM installer.
-exec ./scripts/install ${flags} --path "$rvm_path"
+exec ./scripts/install ${flags} --prefix "$rvm_prefix" --path "$rvm_path"
View
68 binscripts/rvm-shell
@@ -1,5 +1,73 @@
#!/usr/bin/env bash
+export HOME="${HOME%%+(\/)}" # Remove trailing slashes if they exist on HOME
+
+if [[ ${rvm_ignore_rvmrc:-0} -eq 0 ]]; then
+ 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"
+ return 1
+ else
+ source "$rvmrc"
+ fi
+ fi
+ done
+fi
+
+if [[ -z "${rvm_path:-}" ]] ; then
+
+ # Set the default sandboxed value.
+ # TODO: Alter the variable names to make sense
+ if [[ -z "${rvm_user_install:-""}" ]]; then
+
+ if [[ $UID -eq 0 || -n "$rvm_prefix" && "$rvm_prefix" != "$HOME"/* ]]; then
+ rvm_user_install=0
+ else
+ rvm_user_install=1
+ fi
+
+ fi
+
+ if [[ -z "${rvm_prefix:-""}" ]] ; then
+
+ if [[ "${rvm_user_install:-0}" = "0" ]] ; then
+
+ rvm_prefix="/usr/local/"
+
+ elif [[ -n "$HOME" ]] ; then
+
+ rvm_prefix="$HOME/."
+
+ else
+
+ echo "No \$rvm_prefix was provided and "
+ echo "$(id | \sed -e's/^[^(]*(//' -e 's/).*//') has no \$HOME defined."
+ echo "Haling loading of RVM."
+ rvm_load_rvm=0
+ fi
+
+ fi
+
+ # Fix rvm_prefix changes.
+ [[ "${rvm_prefix}" != *[/.] && -d "${rvm_prefix/rvm/scripts}" ]]
+
+ rvm_prefix_needs_trailing_slash="$?"
+
+ if [[ "$rvm_prefix" = "/usr/local" || "$rvm_prefix_needs_trailing_slash" = "0" ]]; then
+
+ rvm_prefix="$rvm_prefix/"
+
+ fi
+
+ if [[ -z "${rvm_path:-""}" ]] ; then
+ rvm_path="${rvm_prefix}rvm"
+ fi
+
+ export rvm_path="${rvm_path%%+(\/)}"
+
+fi
+
true ${rvm_scripts_path:="$rvm_path/scripts"}
__rvm_shell_lookup_script() {
View
1 binscripts/rvmsudo
@@ -3,6 +3,7 @@
args=()
while [[ $# -gt 0 ]] ; do
token="${1}" ; shift
+
case "${token}" in
--trace)
export PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
View
4 config/known
@@ -6,10 +6,6 @@
[ruby-]1.9.1-p378
[ruby-]1.9.1[-p431]
[ruby-]1.9.1-head
-[ruby-]1.9.2-preview1
-[ruby-]1.9.2-preview3
-[ruby-]1.9.2-rc1
-[ruby-]1.9.2-rc2
[ruby-]1.9.2[-p180]
[ruby-]1.9.2-head
ruby-head
View
44 contrib/ps1_functions
@@ -26,9 +26,9 @@
ps1_identity()
{
if [[ $UID -eq 0 ]] ; then
- printf " \033[31m\\\u\033[0m@\033[36m\\h\033[35m:\w\033[0m "
+ printf "\[\033[31m\]\\\u\[\033[0m\]@\[\033[36m\]\\h\[\033[35m\]:\w\[\033[0m\] "
else
- printf " \033[32m\\\u\033[0m@\033[36m\\h\033[35m:\w\033[0m "
+ printf "\[\033[32m\]\\\u\[\033[0m\]@\[\033[36m\]\\h\[\033[35m\]:\w\[\033[0m\] "
fi
}
@@ -70,10 +70,11 @@ ps1_git()
esac
if [[ $color -gt 0 ]] ; then
- printf " \033[${attr}${color}m(git:${branch}:$sha1)\033[0m "
+ printf "\[\033[${attr}${color}m\](git:${branch}:$sha1)\[\033[0m\] "
fi
}
+
ps1_rvm()
{
if command -v rvm-prompt >/dev/null 2>/dev/null ; then
@@ -81,17 +82,18 @@ ps1_rvm()
fi
}
-ps1_set()
+ps1_update()
{
local prompt_char='$'
local separator="\n"
+ local notime=0
if [[ $UID -eq 0 ]] ; then
prompt_char='#'
fi
while [[ $# -gt 0 ]] ; do
- token="$1" ; shift
+ local token="$1" ; shift
case "$token" in
--trace)
@@ -102,17 +104,27 @@ ps1_set()
prompt_char="$1"
shift
;;
+ --noseparator)
+ separator=""
+ ;;
--separator)
separator="$1"
shift
;;
+ --notime)
+ notime=1
+ ;;
*)
true # Ignore everything else.
;;
esac
done
- PS1="\D{%H:%M:%S}$(ps1_identity)\$(ps1_git)\$(ps1_rvm)${separator}${prompt_char} "
+ if [[ $notime -gt 0 ]] ; then
+ PS1="$(ps1_identity)$(ps1_git)$(ps1_rvm)${separator}${prompt_char} "
+ else
+ PS1="\D{%H:%M:%S} $(ps1_identity)$(ps1_git)$(ps1_rvm)${separator}${prompt_char} "
+ fi
}
ps2_set()
@@ -124,3 +136,23 @@ ps4_set()
{
export PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
}
+
+# WARNING: This clobbers your PROMPT_COMMAND so if you need to write your own, call
+# ps1_update within your PROMPT_COMMAND with the same arguments you pass
+# to ps1_set
+#
+# The PROMPT_COMMAND is used to help the prompt work if the separator is not a new line.
+# In the event that the separtor is not a new line, the prompt line may become distored if
+# you add or delete a certian number of characters, making the string wider than the
+# $COLUMNS + len(your_input_line).
+# This orginally was done with callbacks within the PS1 to add in things like the git
+# commit, but this results in the PS1 being of an unknown width which results in the prompt
+# being distored if you add or remove a certain number of characters. To work around this
+# it now uses the PROMPT_COMMAND callback to re-set the PS1 with a known width of chracters
+# each time a new command is entered. see PROMPT_COMMAND for more details.
+#
+ps1_set()
+{
+ PROMPT_COMMAND="ps1_update $@"
+}
+
View
2 lib/rvm/environment/gemset.rb
@@ -118,7 +118,7 @@ def initialize(parent)
# Import a gemset file.
def import(prefix)
- @parent.gemset_export prefix.to_s.gsub(/\.gems$/, '')
+ @parent.gemset_import prefix.to_s.gsub(/\.gems$/, '')
end
alias load import
View
20 scripts/functions/installer
@@ -21,12 +21,10 @@ install_setup()
export PS4="+ \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "
# TODO: Figure out a much better name for 'rvm_user_install'
- if [[ -z ${rvm_user_install:-} ]]; then
- if [[ $UID -eq 0 || -n "$rvm_prefix" && "$rvm_prefix" != "${HOME}"/* ]]; then
- export rvm_user_install=0
- else
- export rvm_user_install=1
- fi
+ if [[ $UID -eq 0 || -n "${rvm_prefix:-}" && "$rvm_prefix" != "${HOME}"/* ]]; then
+ export rvm_user_install=0
+ else
+ export rvm_user_install=1
fi
unset rvm_auto_flag
@@ -278,6 +276,7 @@ create_install_paths()
for install_path in "${install_paths[@]}" ; do
[[ -d "$rvm_path/$install_path" ]] || mkdir -p "$rvm_path/$install_path"
done
+ [[ -d "$rvm_bin_path" ]] || mkdir -p "$rvm_bin_path"
return 0
}
@@ -378,6 +377,7 @@ install_binscripts()
if [[ "${rvm_bin_path}" != "${rvm_path}/bin" ]] ; then
cp -f "${source_path}/binscripts/${file}" "${rvm_bin_path}/${file}"
fi
+
done
return 0
}
@@ -768,6 +768,14 @@ if [ -n \"\${BASH_VERSION:-}\" -o -n \"\${ZSH_VERSION:-}\" ] ; then
ps1_set
fi
fi
+
+ # Add $rvm_bin_path to $PATH in necessary
+ if [[ \"\${rvm_bin_path}\" != \"\${rvm_path}/bin\" ]] ; then
+ regex=\"^([^:]*:)*\${rvm_bin_path}(:[^:]*)*\$\"
+ if [[ ! \"\${PATH}\" =~ \$regex ]] ; then
+ export PATH=\"\${rvm_bin_path}:\${PATH}\"
+ fi
+ fi
fi
" >> "${etc_profile_file}"
View
4 scripts/functions/packages
@@ -20,7 +20,7 @@ install_package()
|| (result=$? && return $result)
__rvm_run "$package/extract" \
- "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" \
+ "tar zxof $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" \
"Extracting $package-$version.$archive_format to $rvm_src_path"
;;
@@ -31,7 +31,7 @@ install_package()
|| (result=$? && return $result)
__rvm_run "$package/extract" \
- "tar jxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" \
+ "tar jxof $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" \
"Extracting $package-$version.$archive_format to $rvm_src_path"
;;
View
2 scripts/get
@@ -65,7 +65,7 @@ get_version()
exit 1
fi
- tar zxf "${rvm_path}/archives/rvm-${version}.tar.gz" -C "$rvm_src_path/"
+ tar zxof "${rvm_path}/archives/rvm-${version}.tar.gz" -C "$rvm_src_path/"
(
cd "$rvm_src_path/rvm-${version}"
View
10 scripts/manage
@@ -465,7 +465,7 @@ RubyWrapper
__rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
__rvm_run "extract" \
- "gunzip < \"${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C ${rvm_src_path}" \
+ "gunzip < \"${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xof - -C ${rvm_src_path}" \
"$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string"
result=$?
@@ -565,7 +565,7 @@ RubyWrapper
exit $result
fi
__rvm_run "extract" \
- "gunzip < \"${rvm_archives_path}/$(basename $rvm_ruby_package_file)\" | tar xf - -C ${rvm_src_path}" \
+ "gunzip < \"${rvm_archives_path}/$(basename $rvm_ruby_package_file)\" | tar xof - -C ${rvm_src_path}" \
"$rvm_ruby_string - #extracting"
result=$?
@@ -839,7 +839,7 @@ RubyWrapper
builtin cd "${rvm_src_path}/$rvm_ruby_string"
__rvm_run "gemstone.extract" \
- "gunzip < \"${rvm_archives_path}/${rvm_gemstone_package_file}.${rvm_archive_extension}\" | tar xf - -C ${rvm_src_path}/$rvm_ruby_string"
+ "gunzip < \"${rvm_archives_path}/${rvm_gemstone_package_file}.${rvm_archive_extension}\" | tar xof - -C ${rvm_src_path}/$rvm_ruby_string"
result=$?
if [[ "$result" -gt 0 ]] ; then
@@ -1283,7 +1283,7 @@ __rvm_fetch_ruby()
case "$rvm_archive_extension" in
tar.gz|tgz)
- __rvm_run "extract" "gunzip < \"${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C ${rvm_tmp_path:-/tmp}/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string"
+ __rvm_run "extract" "gunzip < \"${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xof - -C ${rvm_tmp_path:-/tmp}/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string"
result=$?
if [[ "$result" -gt 0 ]] ; then
@@ -1301,7 +1301,7 @@ __rvm_fetch_ruby()
fi
;;
tar.bz2)
- __rvm_run "extract" "bunzip2 < '${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension' | tar xf - -C ${rvm_tmp_path:-/tmp}/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string"
+ __rvm_run "extract" "bunzip2 < '${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension' | tar xof - -C ${rvm_tmp_path:-/tmp}/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string"
result=$?
if [[ "$result" -gt 0 ]] ; then
View
2 scripts/rubygems
@@ -80,7 +80,7 @@ rubygems_setup()
fi
__rvm_run "rubygems.extract" \
- "gunzip < ${rvm_archives_path}/$rvm_gem_package_name.tgz | tar xf - -C ${rvm_src_path}" \
+ "gunzip < ${rvm_archives_path}/$rvm_gem_package_name.tgz | tar xof - -C ${rvm_src_path}" \
"Extracting $rvm_gem_package_name ..."
fi
View
6 scripts/set
@@ -72,7 +72,11 @@ __rvm_ruby_do()
case "${args[@]}" in
- *[:space:]-S[:space:]*)
+ exec*)
+ command="$binary $rvm_ruby_mode ${args[@]}"
+ ;;
+
+ *[[:space:]]-S[[:space:]]*)
command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path ${args[@]}"
;;
View
2 scripts/snapshot
@@ -172,7 +172,7 @@ snapshot_load()
rvm_log "Extracting snapshot"
(
builtin cd "$snapshot_temp_path"
- tar xzf "$snapshot_archive"
+ tar xozf "$snapshot_archive"
result="$?"
__error_on_result "$result" "Error extracting the archive '$snapshot_archive'" && return "$result"
)

0 comments on commit 2a7166b

Please sign in to comment.
Something went wrong with that request. Please try again.