scripts/rvm-utility in rvm-0.0.38 vs scripts/rvm-utility in rvm-0.0.39

- old
+ new

@@ -1,107 +1,7 @@ #!/bin/bash -function __rvm_meta { - rvm_meta_author="Wayne E. Seguin" - rvm_meta_author_email="wayneeseguin@gmail.com" - rvm_meta_website="http://rvm.beginrescueend.com/" - rvm_meta_version="`cat $rvm_path/VERSION.yml | tail -n 3 | sed 's/^.*: //g' | tr "\n" '.' | sed 's/\.$//'`" - rvm_meta_updated="2009.09.14" -} - -function __rvm_version { __rvm_meta ; echo "rvm $rvm_meta_version ($rvm_meta_updated) [$rvm_meta_website]" ; } - -function __rvm_usage { - - __rvm_meta - - cat <<-Usage - - rvm ${rvm_meta_version} ${rvm_meta_website} by ${rvm_meta_author} (${rvm_meta_author_email}) - - Usage: - - rvm Action [Implementation] [Options] - - Action: - - * usage - Show this usage information - use - Switch to using a specific ruby version (new login shell) - info - Show information for current ruby - list - Show currently installed versions - gemdir - Switch to gem directory for installation (new login shell) - srcdir - Switch to src directory for the current ruby installation - gemdup - Clone source version gems to current version - (highly expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/ - install - Install a ruby version, default is from source - uninstall - Uninstall a ruby version - reset - Remove default and current settings, exit the shell. - (If you experience odd behavior try this first) - rubydo - Used with -f to run a ruby file against specified or all rubies - gemdo - Used with -f to execute a command using selected ruby's 'gem' - debug - Emit environment & configuration information for *current* ruby - - reload - Reload rvm source itself (useful after changing rvm source) - implode - Removes all ruby installations it manages, everything in ~/.rvm - update - Upgrades rvm to the latest version. - - Implementation: - - * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6 - jruby - jRuby - rubinius - Rubinius - ree - Ruby Enterprise Edition - system - Use the system ruby (eg. pre-rvm state) - default - Use rvm set default ruby and system if it hasn't been set. - - Options: - - -v|--version - Ruby Package Version, defaults to 'latest' - -l|--level - Patch level for the specified Ruby version - -p|--prefix - Package and source directory prefix, with trailing slash! - Default is a users home directory and /usr/local/ for root - -a|--archives - Directory to place downladed files into (~/.rvm/archives/) - -n|--nice - Specify a process niceness (for slow computers, default 0) - -m|--gem-set - Named gem set for switching between different gem sets - --rm-gem-set - Removes a named gemset. - - -l|--level - Specify a patch level to use - -t|--tag - - -r|--rev - Specify the repository revision # to use or 'head' for - - -P|--prefix - Sets the prefix path for installs to be installed to - --bin - Specify path for binaries to be placed - --source - Specify src directory to use - --archive - Specify archive directory to use (tabralls / zips) - -G|--gems - Specify root gem path to use - -C|--configure - Specify custom configure options, comma separated - default: --enable-shared=true - --re-configure - Force installer to re-run configure if already run - -M|--make - Specify a custom make command - -I|--make-install - " a custom make install command - - -f|--file - Specify a ruby file to run with 'rubydo' command - -h|--help - Emit this output and exit - -d|--default - Set the default Ruby to a specified version - -m|--gem-set - Use a named gem set instead of the default set. - -S|--script - Specify a script file to attempt to load and run (rubydo) - --all - Used with 'rvm list' to list "most" installable versions. - --rm-gem-set - Remove a named gem set - --jit - Enable JIT for the Rubinius build - --force - Force install, removes old install & source directories. - --set-prompt - Set prompt to have the selected ruby prepended. - --debug|--trace - Toggle debug mode on for very verbose output. - - Resources: - - http://rvm.beginrescueend.com/ - https://www.pivotaltracker.com/projects/26822 - -Usage - -} - function __rvm_info { cat <<Info ruby: interpreter: "`ruby -v | awk '{print $1}'`" @@ -179,11 +79,11 @@ rvm_ruby_log_path=${rvm_ruby_log_path:-$rvm_path/log} mkdir -p $rvm_ruby_log_path if [ $rvm_debug ] ; then __rvm_log "debug" "Executing: $command" ; fi touch $rvm_ruby_log_path/$log_file_name.log $rvm_ruby_log_path/$log_file_name.error.log # for zsh :( echo "[$(date +'%Y-%m-%d %H:%M:%S')] $command" | tee $rvm_ruby_log_path/$log_file_name.log > $rvm_ruby_log_path/$log_file_name.error.log - if [ -z "$rvm_niceness" ] ; then + if [ -z "$rvm_niceness" -o "$rvm_niceness" = "0" ] ; then eval "$command" >> $rvm_ruby_log_path/$log_file_name.log 2>> $rvm_ruby_log_path/$log_file_name.error.log else eval "nice -n $rvm_niceness /bin/bash -l -c '$command'" >> $rvm_ruby_log_path/$log_file_name.log 2>> $rvm_ruby_log_path/$log_file_name.error.log fi if [ $? -gt 0 ] ; then __rvm_log "error" "Error running '$command', please check $rvm_ruby_log_path/$log_file_name.error.log" ; popd 2> /dev/null ; return 1 ; fi @@ -213,17 +113,16 @@ function __rvm_bin_script { if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi ruby_wrapper=$(cat <<RubyWrapper #!/bin/bash -if [ "`whoami`" = "root" ] ; then - echo "rvm installed ruby binaries should *not* be run as the root user, yet: http://rvm.beginrescueend.com/faq/" -fi + GEM_HOME=$rvm_gem_home ; export GEM_HOME GEM_PATH=$rvm_gem_home ; export GEM_PATH MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME PATH=$rvm_ruby_home/bin:$rvm_gem_home/bin:\$PATH ; export PATH + exec "$rvm_ruby_binary" "\$@" RubyWrapper ) echo "$ruby_wrapper" > $rvm_bin_path/$rvm_ruby_package_name unset ruby_wrapper @@ -232,13 +131,20 @@ function __rvm_fetch { pushd $rvm_archives_path > /dev/null eval $rvm_fetch "$1" - 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 + status=$? + if [ $status -gt 0 ] ; then + if [ $status -eq 78 ] ; then + __rvm_log "error" "The requested url does not exist: '$1'" + else + __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" + fi + fi popd 2> /dev/null - + return $status } function __rvm_load-defaults { if [ ! -s $rvm_path/system ] ; then @@ -331,13 +237,11 @@ fi done } function __rvm_gem-dir { - if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi - mkdir -p $rvm_gem_home echo $rvm_gem_home } function __rvm_src-dir { @@ -507,12 +411,10 @@ fi else rvm_fetch="$rvm_fetch -O -L -s --create-dirs -C - " fi - rvm_niceness=${rvm_niceness:-0} - # TODO: Sanitize user input, ensure that there is a / a the end... if [ "`whoami`" = "root" ] ; then __rvm_log "fail" "root user support is not yet implemented." #rvm_prefix_path=${rvm_prefix_path:-/usr/local/} else @@ -553,12 +455,13 @@ __rvm_version __rvm_update_rvm __rvm_version fi __rvm_reload - if [ "$rvm_bin_flag" ] ; then __rvm_bin_scripts ; fi - if [ "$rvm_rubygems_flag" ] ; then __rvm_rubygems_install ; fi + __rvm_select + if [ "$rvm_bin_flag" ] ; then __rvm_bin_scripts ; fi + if [ "$rvm_rubygems_flag" ] ; then __rvm_rubygems_setup ; fi } function __rvm_update_rvm { mkdir -p $rvm_source_path if [ "$rvm_ruby_rev" = "head" ] ; then @@ -810,13 +713,21 @@ pushd $rvm_path/src > /dev/null package=readline version=5.2 # TODO: Figure out how to list, grab and apply the patches __rvm_fetch "ftp://ftp.gnu.org/gnu/readline/$package-$version.tar.gz" - __rvm_run "extract" tar zxf $rvm_archives_path/$package-$version.tar.gz -C $rvm_path/src/ + __rvm_run "$package.extract" tar zxf $rvm_archives_path/$package-$version.tar.gz -C $rvm_path/src/ cd $rvm_path/src/$package-$version - __rvm_run "configure" ./configure --prefix=$rvm_path/usr --disable-dependency-tracking --disable-static --enable-shared + if [ "`uname`" = "Darwin" ] ; then + sdk=`ls -t /Developer/SDKs/ | head -n 1` + CFLAGS="-isysroot /Developer/SDKs/$sdk -arch i386 -arch x86_64" + LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/$sdk -arch i386 -arch x86_64" + export CFLAGS LDFLAGS + __rvm_run "$package.configure" ./configure --prefix=$rvm_path/usr --disable-dependency-tracking --disable-static --enable-shared + else + __rvm_run "$package.configure" ./configure --prefix=$rvm_path/usr --disable-dependency-tracking --disable-static --enable-shared + fi __rvm_run "$package.make" make __rvm_run "$package.make.install" make install popd > /dev/null } @@ -832,6 +743,5 @@ __rvm_run "$package.make" make __rvm_run "$package.make.install" make install popd > /dev/null } -