scripts/manage in rvm-0.0.97 vs scripts/manage in rvm-0.0.98
- old
+ new
@@ -1,18 +1,21 @@
#!/usr/bin/env bash
-if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
-
original_ruby_version=$rvm_ruby_version
original_ruby_string=$rvm_ruby_string
-source $rvm_scripts_path/rvm
+source $rvm_scripts_path/initialize
+source $rvm_scripts_path/utility
+source $rvm_scripts_path/selector
trap "rm -f $rvm_path/tmp/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15
+if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
+
__rvm_install_source() {
- (( $rvm_ruby_selected_flag )) || __rvm_select $*
+ if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
+
$rvm_scripts_path/log "info" "Installing Ruby from source to: $rvm_ruby_home"
mkdir -p "$rvm_ruby_log_path"
__rvm_pushpop "$rvm_src_path"
if [[ ! -z "$rvm_force_flag" ]] ; then rm -rf "$rvm_ruby_home" "$rvm_ruby_src_path" ; fi
@@ -75,13 +78,12 @@
__rvm_post_install
__rvm_pushpop
}
__rvm_install_ruby() {
+ if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
- (( $rvm_ruby_selected_flag )) || __rvm_select $*
-
if [[ ! -z "$RUBYOPT" ]] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
case "$rvm_ruby_interpreter" in
macruby)
if [[ "Darwin" = "$(uname)" ]] ; then
@@ -189,26 +191,28 @@
;;
rbx|rubinius)
$rvm_scripts_path/log "info" "Installing pre-requisites"
# prereqs, 1.8.6+ + rake. Yes this could all be one line... not pushing our luck.
- echo "$(export rvm_install_on_use_flag=1 ; rvm 1.8.7)" # This should install if missing.
+ original_string="$rvm_ruby_string"
+ export rvm_install_on_use_flag=1 ; $rvm_bin_path/rvm 1.8.7 --install # This should install if missing.
# TODO: use 'rvm gems load' here:
unset CFLAGS LDFLAGS ARCHFLAGS # Important.
- __rvm_unset_ruby_variables ; rvm_ruby_string="rbx-head" ; __rvm_select
+ __rvm_unset_ruby_variables ; rvm_ruby_string="$original_string" ; __rvm_select
+ unset original_string
unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
PATH=$rvm_bin_path:$PATH ; export PATH
if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[ -z "$rvm_head_flag" ]] ; then
if [[ ! -f "$rvm_archives_path/$rvm_ruby_package_file.tar.gz" ]] ; then
$rvm_scripts_path/log "info" "Downloading $rvm_ruby_file, this may take a while depending on your connection..."
$rvm_scripts_path/fetch "$rvm_url" || (result=$? && return $result)
fi
- __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_file.tar.gz ..." || (result=$? && return $result)
- mv $rvm_src_path/rubinius-$rvm_ruby_version $rvm_ruby_src_path
+ __rvm_run "extract" "tar xzf $rvm_archives_path/$(basename $rvm_url) -C $rvm_src_path" "Extracting $(basename $rvm_url) ..." || (result=$? && return $result)
+ mv "$rvm_src_path/rubinius-$rvm_ruby_version-${rvm_ruby_patch_level/^p//}" $rvm_ruby_src_path
else
__rvm_db "rubinius_repo_url" "rvm_ruby_repo_url"
#rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"
if [[ ! -d "$rvm_ruby_src_path" ]] || [[ ! -d "$rvm_ruby_src_path/.git" ]] ; then
rm -rf "$rvm_ruby_src_path" ; builtin cd "$rvm_home"
@@ -222,96 +226,79 @@
#if [[ ! -x "$rvm_ruby_distclean" ]] ; then
# __rvm_run "rake.distclean" "\$(rvm 1.8.7 ; rake distclean --trace)" "Running distclean."
#fi
- # For Installer, can do this once it's ready:
- # RBX_PREFIX="$rvm_ruby_home" ; export RBX_PREFIX
- # Also see 'rakelib/configuration.rake'
-
builtin cd "$rvm_ruby_src_path"
- # TODO: Once installer is done add the prefix:
- rvm_ruby_configure="./configure --prefix=$rvm_ruby_home --disable-llvm" ; message="Configuring rbx"
- #rvm_ruby_configure="./configure" ; message="Configuring rbx"
- if [[ ! -z "$rvm_jit_flag" ]] ; then
+ chmod +x ./configure
+ rvm_ruby_configure="./configure --prefix=$rvm_ruby_home" ; message="Configuring rbx"
+
+ if [[ "$rvm_jit_flag" -eq 0 ]] && [[ "rc1" != "$rvm_ruby_patch_level" ]] ; then
+ rvm_ruby_configure="$rvm_ruby_configure --disable-llvm" ; message="$message with LLVM disabled"
+ else
rvm_ruby_configure="$rvm_ruby_configure" ; message="$message with LLVM enabled"
fi
+
__rvm_run "configure" "$rvm_ruby_configure" "$message"
if [[ "$rvm_trace_flag" -eq 1 ]] ; then
- rvm_ruby_make="\$(rvm 1.8.7 ; rake install --trace)" ; message="Compiling rbx"
+ rvm_ruby_make="$rvm_bin_path/rvm 1.8.7 rake install --trace" ; message="Compiling rbx"
else
- rvm_ruby_make="\$(rvm 1.8.7 ; rake install)" ; message="Compiling rbx"
+ rvm_ruby_make="$rvm_bin_path/rvm 1.8.7 rake install" ; message="Compiling rbx"
fi
__rvm_run "rake" "$rvm_ruby_make" "$message"
- # TODO: Uncomment the following once --prefix is working properly again
- #rvm_ruby_make_install="\$(rvm 1.8.7 ; rake install --trace)" ; message="Installing rbx"
- #__rvm_run "rake.install" "$rvm_ruby_make" "$message"
-
binaries="ruby irb" # Trick to work in more shells :)
for binary_name in $(echo $binaries) ; do
ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary_name
done ; unset binary_name binaries
- binaries="erb ri rdoc"
- __rvm_post_install
+ for binary_name in "gem" ; do
+ if [[ $binary_name != "gem" ]] ; then prefix="-S " ; else unset prefix; fi
- binaries="gem" # Trick to work in more shells :)
- for binary_name in $(echo $binaries); do
- if [[ $binary_name != "gem" ]] ; then prefix="-S" ; fi
ruby_wrapper=$(cat <<RubyWrapper
-#!/bin/bash
+#!/usr/bin/env bash
GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH
MY_RUBY_HOME="$rvm_ruby_home" ; export MY_RUBY_HOME
PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH" ; export PATH
-exec $rvm_ruby_home/bin/rbx $prefix $binary_name "\$@"
+exec $rvm_ruby_home/bin/rbx $prefix$binary_name "\$@"
RubyWrapper
)
- files="$rvm_ruby_home/bin/$binary_name $rvm_path/bin/$binary_name-$rvm_ruby_string"
- for file_name in $(echo $files) ; do
+ for file_name in "$rvm_ruby_home/bin/$binary_name" "$rvm_path/bin/$binary_name-$rvm_ruby_string" ; do
rm -f $file_name
echo "$ruby_wrapper" > $file_name
if [[ -f $file_name ]] ; then chmod +x $file_name ; fi
- done ; unset file_name
- unset ruby_wrapper binary_name files prefix
- done
+ done
- __rvm_run "rake.install" "$rvm_ruby_home/bin/rbx gem install rake --no-rdoc --no-ri" "Installing Rake"
+ unset file_name binaries ruby_wrapper binary_name files prefix
+ done ; unset binary_name
- binary=rake
- if [[ -f $rvm_ruby_gem_home/bin/$binary ]] ; then
- if [[ "$rvm_ruby_gem_home" != "$rvm_ruby_home" ]] ; then
- cp $rvm_ruby_gem_home/bin/$binary $rvm_ruby_home/bin/$binary
- fi
- chmod +x $rvm_ruby_home/bin/$binary
- __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
- __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
- fi ; unset binary
-
+ binaries="erb ri rdoc"
+ __rvm_post_install
__rvm_irbrc
__rvm_bin_script
;;
jruby)
if ! which java &> /dev/null ; then
echo -e "java must be installed and in your path in order to install JRuby." ; return 1
fi
- mkdir -p "$rvm_ruby_log_path" "$rvm_ruby_src_path"
+ mkdir -p "$rvm_ruby_log_path" "$rvm_ruby_src_path"
__rvm_pushpop $rvm_src_path
__rvm_fetch_ruby || (result=$? && return $result)
- (( $rvm_head_flag )) || __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
+ # if [[ -z "$rvm_head_flag" ]] ; then __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..." ; fi
+
builtin cd "$rvm_ruby_src_path"
- (( $rvm_head_flag )) && (( $rvm_ruby_version )) && ant dist
+ if [[ ! -z "$rvm_head_flag" ]] ; then __rvm_run "ant.dist" "ant dist" "Running 'ant dist' (this could take a few minutes) ..." ; fi
mkdir -p "$rvm_ruby_home/bin/"
- __rvm_run "nailgun" "builtin cd "$rvm_ruby_src_path/tool/nailgun" && ./configure --prefix=$rvm_ruby_home && make $rvm_make_flags"
+ __rvm_run "nailgun" "builtin cd \"$rvm_ruby_src_path/tool/nailgun\" && ./configure --prefix=$rvm_ruby_home && make $rvm_make_flags" "Building Nailgun"
__rvm_pushpop
if [[ -z "$rvm_ruby_home" ]] || [[ "$rvm_ruby_home" = "/" ]] ; then echo "WTH?!?! rvm_ruby_home == / ??? not removing." ; return 1000000 ; fi
rm -rf $rvm_ruby_home
@@ -340,18 +327,51 @@
ironruby|ir)
if ! which mono &> /dev/null ; then
echo -e "mono must be installed and in your path in order to install IronRuby." ; return 1
fi
- $rvm_scripts_path/log "info" "Retrieving IronRuby"
- $rvm_scripts_path/fetch "$rvm_url" || (result=$? && return $result)
+ if [[ "$rvm_head_flag" = 1 ]] ; then
+ mono_version="$(mono -V | head -n 1 | cut -d ' ' -f5)"
+ if [[ "$mono_version" =~ ([0-9]+)\.([0-9]+)\.?([0-9]+)? ]] ; then
+ if [[ ${BASH_REMATCH[1]} -lt 2 ]] || ( [[ ${BASH_REMATCH[1]} -eq 2 ]] && [[ ${BASH_REMATCH[2]} -lt 6 ]] ) ; then
+ echo -e "Mono 2.6 (or greater) must be installed and in your path in order to build IronRuby from the repository."
+ echo -e "Version detected: ${BASH_REMATCH[0]}"
+ return 1
+ fi
+ else
+ echo -e "Cannot recognize mono version."
+ return 1
+ fi
- __rvm_run "extract" "unzip $rvm_archives_path/$rvm_ruby_package_file ironruby/bin/* ironruby/lib/* -d $rvm_ruby_home" "Extracting $rvm_ruby_package_file ..."
- mv $rvm_ruby_home/ironruby/* $rvm_ruby_home
- rm -rf $rvm_ruby_home/ironruby
- mv $rvm_ruby_home/lib/ironruby $rvm_ruby_home/lib/IronRuby
+ __rvm_fetch_ruby
+ if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
+ builtin cd $rvm_ruby_src_path
+
+ rvm_ruby_make="rake MERLIN_ROOT=\"$rvm_ruby_src_path/Merlin/Main\" compile mono=1 configuration=release --trace"
+ __rvm_run "rake" "$rvm_ruby_make" "Building IronRuby..."
+ if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
+
+ rm -rf $rvm_ruby_home/*
+ mkdir -p $rvm_ruby_home/bin $rvm_ruby_home/lib $rvm_ruby_home/lib/ruby $rvm_ruby_home/lib/IronRuby
+
+ cp -r $rvm_ruby_src_path/Merlin/Main/Bin/mono_release/* $rvm_ruby_home/bin/
+ cp -r $rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Scripts/bin/* $rvm_ruby_home/bin/
+ cp -r $rvm_ruby_src_path/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p*/lib/ruby/* $rvm_ruby_home/lib/ruby
+ cp -r $rvm_ruby_src_path/ruby_home/lib/IronRuby
+ else
+ $rvm_scripts_path/log "info" "Retrieving IronRuby"
+ $rvm_scripts_path/fetch "$rvm_url" || (result=$? && return $result)
+
+ __rvm_run "extract" "unzip $rvm_archives_path/$rvm_ruby_package_file ironruby/bin/* ironruby/lib/* -d $rvm_ruby_home" "Extracting $rvm_ruby_package_file ..."
+ if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
+
+ mv $rvm_ruby_home/ironruby/* $rvm_ruby_home
+ rm -rf $rvm_ruby_home/ironruby
+ mv $rvm_ruby_home/lib/ironruby $rvm_ruby_home/lib/IronRuby
+ fi
+
binaries="gem irb rake rdoc ri ruby"
for binary_name in $(echo $binaries); do
binary_path=""
if [[ "ruby" != "$binary_name" ]] ; then
binary_path="$rvm_ruby_home/bin/i$binary_name"
@@ -381,49 +401,45 @@
if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
PATH=$rvm_bin_path:$PATH ; export PATH
- unset rvm_ruby_configure
- rvm_ruby_src_path=$rvm_ruby_home
- # rvm_ruby_make="rake"
- # rvm_ruby_make_install="rake install"
rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"
- # rvm_ruby_revision="head"
if [[ ! -d "$rvm_ruby_src_path" ]] || [[ ! -d "$rvm_ruby_src_path/.git" ]] ; then
rm -rf $rvm_ruby_src_path
__rvm_run "mput.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path" "Cloning $rvm_ruby_repo_url"
builtin cd $rvm_ruby_home
else
builtin cd $rvm_ruby_home
__rvm_run "mput.repo" "git pull origin trunk" "Pulling from origin trunk"
fi
+ builtin cd $rvm_ruby_src_path
+
if [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
if which autoconf &> /dev/null ; then
__rvm_run "autoconf" "autoconf" "Running autoconf"
else
$rvm_scripts_path/log "fail" "rvm expects autoconf" ; result=$? ; return $result
fi
fi
if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
(($rvm_debug_flag)) && $rvm_scripts_path/log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
- elif [[ ! -z "rvm_ruby_configure" ]] ; then
- $rvm_ruby_configure
+ elif [[ ! -z "$rvm_ruby_configure" ]] ; then
+ __rvm_run "configure" "$rvm_ruby_configure" || (result=$? && return $result)
elif [[ -s ./configure ]] ; then
- __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_string using $rvm_ruby_configure_flags, this may take a while depending on your cpu(s)..." || (result=$? && return $result)
- unset configure_parameters
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags" "Configuring $rvm_ruby_string using $rvm_ruby_configure_flags, this may take a while depending on your cpu(s)..." || (result=$? && return $result)
else
$rvm_scripts_path/log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
fi
- rvm_ruby_make=${rvm_ruby_make:-"/usr/bin/make"}
+ rvm_ruby_make=${rvm_ruby_make:-"make"}
__rvm_run "make" "$rvm_ruby_make $rvm_make_flags" "Compiling $rvm_ruby_string, this may take a while, depending on your cpu(s)..." || (result=$? && return $result)
- rvm_ruby_make_install=${rvm_ruby_make_install:-"/usr/bin/make install"}
+ rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"}
__rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string" || (result=$? && return $result)
$rvm_scripts_path/log "info" "Installation of $rvm_ruby_string is complete."
GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
@@ -451,11 +467,11 @@
if [[ ! -z "$ruby_options" ]] ; then RUBYOPT=$ruby_options ; export RUBYOPT ; fi
}
__rvm_fetch_ruby() {
- (( $rvm_ruby_selected_flag )) || __rvm_select $*
+ if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
if [[ -z "$rvm_head_flag" ]] && [[ -z "$rvm_ruby_tag" ]] && [[ -z "$rvm_ruby_revision" ]] ; then
rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_string"}"
rvm_ruby_package_file="${rvm_ruby_package_file:-"$rvm_ruby_package_name"}"
rvm_archive_extension="tar.gz"
@@ -519,11 +535,11 @@
fi
fi
}
__rvm_uninstall_ruby() {
- (( $rvm_ruby_selected_flag )) || __rvm_select $*
+ if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
if [[ ! -z "$rvm_ruby_string" ]] ; then
for dir in $rvm_path ; do
if [[ -d $dir/$rvm_ruby_string ]] ; then
$rvm_scripts_path/log "info" "Removing $dir/$rvm_ruby_string..."
@@ -540,11 +556,11 @@
$rvm_scripts_path/log "fail" "Cannot uninstall unknown package '$rvm_ruby_string'"
fi ; unset rvm_uninstall_flag
}
__rvm_remove_ruby() {
- (( $rvm_ruby_selected_flag )) || __rvm_select $*
+ if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
if [[ ! -z "$rvm_ruby_string" ]] ; then
for dir in $rvm_src_path $rvm_path ; do
if [[ -d $dir/$rvm_ruby_string ]] ; then
$rvm_scripts_path/log "info" "Removing $dir/$rvm_ruby_string..."
@@ -701,12 +717,12 @@
else
$rvm_scripts_path/log "warn" 'Really? Install all? See "rvm list --all" and limit the selection to something more sane please :)'
fi
fi
- (( $rvm_summary_flag )) && __rvm_summary
- (( $rvm_yaml_flag )) && __rvm_yaml
- (( $rvm_json_flag )) && __rvm_json
+ if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
+ if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
+ if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
}
rvm_action="$1" ; rubies_string="$2"
__rvm_manage_rubies
exit $?