scripts/rvm-ruby-installer in rvm-0.0.41 vs scripts/rvm-ruby-installer in rvm-0.0.42
- old
+ new
@@ -135,17 +135,19 @@
case "$rvm_ruby_interpreter" in
macruby)
if [ "`uname`" = "Darwin" ] ; then
+ #rvm_macruby_repo_url="${rvm_macruby_repo_url:-"http://svn.macosforge.org/repository/ruby/MacRuby"}"
+ rvm_macruby_repo_url="${rvm_macruby_repo_url:-"git://github.com/masterkain/macruby.git"}"
rvm_ruby_repo_url=$rvm_macruby_repo_url
-#/macruby_nightly-2009-09-10.pkg
- rvm_macruby_nightly_url=`__rvm_db "macruby_nightly_url"`
+ #rvm_macruby_nightly_url=`__rvm_db "macruby_nightly_url"`
rvm_ruby_configure=""
rvm_ruby_make="rake macruby:build framework_instdir=$rvm_path/macruby-head framework_name=/macruby-head --trace"
rvm_ruby_make_install="rake framework:install framework_instdir=$rvm_path/macruby-head framework_name=/macruby-head --trace"
- #rvm_ruby_rev="${rvm_ruby_rev:-head}" # Hard coding this for now
+ rvm_ruby_rev="${rvm_ruby_rev:-head}" # Hard coding this for now
+ rvm_url=$rvm_ruby_repo_url
DESTDIR="$rvm_ruby_home" ; export DESTDIR
if [ -z "$rvm_ruby_rev" ] ; then
# TODO: Check if tag v is valid
#rvm_ruby_repo_url=$rvm_ruby_repo_url/tags/$rvm_ruby_tag
@@ -157,13 +159,13 @@
else
#rvm_ruby_repo_url=$rvm_ruby_repo_url/trunk
rvm_ruby_rev="-r $rvm_ruby_rev"
fi
fi
- __rvm_fetch $rvm_url
- __rvm_run /usr/sbin/installer -pkg $rvm_ruby_package_name.pkg -target "$rvm_path/$rvm_ruby_package_name/"
- #__rvm_install-source
+ #__rvm_fetch $rvm_url
+ #__rvm_run /usr/sbin/installer -pkg $rvm_ruby_package_name.pkg -target "$rvm_path/$rvm_ruby_package_name/"
+ __rvm_install-source
unset DESTDIR
else
__rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
fi
;;
@@ -176,35 +178,39 @@
if [ -d $rvm_ruby_src_path ] ; then
cd $rvm_ruby_src_path
else
__rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
__rvm_fetch $rvm_url
- if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd > /dev/null ; return 1 ; fi
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
__rvm_log "info" "\tExtracting $rvm_ruby_package_name..."
mkdir -p $rvm_ruby_src_path
__rvm_run "extract" tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
fi
__rvm_log "info" "\tInstalling $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..."
mkdir -p $rvm_ruby_log_path
cd $rvm_ruby_src_path
+ mkdir -p $rvm_ruby_home/lib/ruby/gems/1.8/gems
if [ ! -z "$rvm_ruby_configure" ] ; then rvm_ruby_configure="-c $rvm_ruby_configure"; fi
__rvm_run "install" ./installer -a $rvm_path/ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level --dont-install-useful-gems --no-tcmalloc $rvm_ruby_configure
+ if [ $? -gt 0 ] ; then result=$? ; return $result ; fi
chmod +x $rvm_ruby_home/bin/*
__rvm_rubygems_setup
- __rvm_bin_script
- popd > /dev/null
-
for rvm_gem_name in rake ; do
__rvm_log "info" "Installing $rvm_gem_name"
__rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
done
- ;;
+ __rvm_bin_script
+
+ popd > /dev/null
+ ;;
+
rbx|rubinius)
# TODO: check if system is 1.8.X otherwise use rvm's 1.8.X and check for parsetree, install if missing
unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
PATH="$rvm_system_path" ; export PATH
rvm_ruby_repo_url=$rvm_rubinius_repo_url
@@ -281,11 +287,13 @@
__rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
done
;;
ruby)
- if [ -z "rvm_ruby_configure" ] ; then rvm_ruby_configure="--enable-shared=true --enable-pthread=true " ; fi
+ # Merge configure options with user specified options
+ rvm_ruby_configure="--enable-shared=true --enable-pthread $rvm_ruby_configure "
+ if [ "`uname`" = "Darwin" ] ; then ARCHFLAGS="-arch x86_64 -arch i386" ; export ARCHFLAGS ; fi
__rvm_install-source $*
;;
default)
__rvm_log "fail" "please specify a ruby implementation to install."
@@ -299,16 +307,38 @@
RUBYOPT=$ruby_options ; export RUBYOPT
fi
}
+# TODO: DRY up __rvm_remove and __rvm_uninstall
+function __rvm_remove {
+ if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
+
+ if [ ! -z "$rvm_ruby_package_name" ] ; then
+ for dir in $rvm_source_path $rvm_path ; do
+ if [ -d $dir/$rvm_ruby_package_name ] ; then
+ __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
+ rm -rf $dir/$rvm_ruby_package_name
+ else
+ __rvm_log "info" "it seems that $dir/$rvm_ruby_package_name is already non existent."
+ fi
+ if [ -e $rvm_bin_path/$rvm_ruby_package_name ] ; then
+ rm -f $rvm_bin_path/$rvm_ruby_package_name
+ fi
+ done ; unset dir
+ rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version*/
+ else
+ __rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
+ fi
+}
+
function __rvm_uninstall {
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
if [ ! -z "$rvm_ruby_package_name" ] ; then
- for dir in $rvm_source_path $rvm_path ; do
+ for dir in $rvm_path ; do
if [ -d $dir/$rvm_ruby_package_name ] ; then
__rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
rm -rf $dir/$rvm_ruby_package_name
else
__rvm_log "info" "it seems that $dir/$rvm_ruby_package_name is already non existent."
@@ -325,10 +355,10 @@
}
function __rvm_post_install {
for binary in gem irb erb ri rdoc testrb rake ; do
- if [ -x $rvm_ruby_src_path/bin/$binary ] ; then
+ if [ -f $rvm_ruby_src_path/bin/$binary ] ; then
if [ "$rvm_ruby_src_path" != "$rvm_ruby_home" ] ; then
cp $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary
fi
string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin:' + ENV['PATH']"
awk "NR==2 {print \"$string\"} {print}" $rvm_ruby_home/bin/$binary > $rvm_ruby_home/bin/$binary.new