- 
          1940
          
          umask u=rwx,g=rwx,o=rx
 
      
        
  
  
  
    
      
        - 
          
          
          #! /bin/bash
- 
          
          
          # Copyright (C) 1996-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
- 
          
          
          # This file is part of the GNU C Library.
- 
          
          
          - 
          
          
          # The GNU C Library is free software; you can redistribute it and/or
- 
          
          
          # modify it under the terms of the GNU Lesser General Public
- 
          
          
          # License as published by the Free Software Foundation; either
- 
          
          
          # version 2.1 of the License, or (at your option) any later version.
- 
          
          
          - 
          
          
          # The GNU C Library is distributed in the hope that it will be useful,
- 
          
          
          # but WITHOUT ANY WARRANTY; without even the implied warranty of
- 
          
          
          # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- 
          
          
          # Lesser General Public License for more details.
- 
          
          
          - 
          
          
          # You should have received a copy of the GNU Lesser General Public
- 
          
          
          # License along with the GNU C Library; if not, write to the Free
- 
          
          
          # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 
          
          
          # 02111-1307 USA.
- 
          
          
          - 
          
          
          - 
          
          
          # This is the `ldd' command, which lists what shared libraries are
- 
          
          
          # used by given dynamically-linked executables.  It works by invoking the
- 
          
          
          # run-time dynamic linker as a command and setting the environment
- 
          
          
          # variable LD_TRACE_LOADED_OBJECTS to a non-empty value.
- 
          
          
          - 
          
          
          # We should be able to find the translation right at the beginning.
- 
          1
          
          TEXTDOMAIN=libc
- 
          1
          
          TEXTDOMAINDIR=/usr/share/locale
- 
          
          
          - 
          1
          
          RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2"
- 
          1
          
          warn=
- 
          1
          
          bind_now=
- 
          1
          
          verbose=
- 
          
          
          - 
          1
          
          while test $# -gt 0; do
- 
          1
          
            case "$1" in
- 
          
          
            --vers | --versi | --versio | --version)
- 
          
          
              echo 'ldd (Debian EGLIBC 2.13-38) 2.13'
- 
          
          
              printf $"Copyright (C) %s Free Software Foundation, Inc.
- 
          
          
          This is free software; see the source for copying conditions.  There is NO
- 
          
          
          warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- 
          
          
          " "2011"
- 
          
          
              printf $"Written by %s and %s.
- 
          
          
          " "Roland McGrath" "Ulrich Drepper"
- 
          
          
              exit 0
- 
          
          
              ;;
- 
          
          
            --h | --he | --hel | --help)
- 
          
          
              printf $"Usage: ldd [OPTION]... FILE...
- 
          
          
                --help              print this help and exit
- 
          
          
                --version           print version information and exit
- 
          
          
            -d, --data-relocs       process data relocations
- 
          
          
            -r, --function-relocs   process data and function relocations
- 
          
          
            -u, --unused            print unused direct dependencies
- 
          
          
            -v, --verbose           print all information
- 
          
          
          "
- 
          
          
              printf $"For bug reporting instructions, please see:
- 
          
          
          %s.
- 
          
          
          " "<http://www.debian.org/Bugs/>"
- 
          
          
              exit 0
- 
          
          
              ;;
- 
          
          
            -d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
- 
          
          
            --data-rel | --data-relo | --data-reloc | --data-relocs)
- 
          
          
              warn=yes
- 
          
          
              shift
- 
          
          
              ;;
- 
          
          
            -r | --f | --fu | --fun | --func | --funct | --functi | --functio | \
- 
          
          
            --function | --function- | --function-r | --function-re | --function-rel | \
- 
          
          
            --function-relo | --function-reloc | --function-relocs)
- 
          
          
              warn=yes
- 
          
          
              bind_now=yes
- 
          
          
              shift
- 
          
          
              ;;
- 
          
          
            -v | --verb | --verbo | --verbos | --verbose)
- 
          
          
              verbose=yes
- 
          
          
              shift
- 
          
          
              ;;
- 
          
          
            -u | --u | --un | --unu | --unus | --unuse | --unused)
- 
          
          
              unused=yes
- 
          
          
              shift
- 
          
          
              ;;
- 
          
          
            --v | --ve | --ver)
- 
          
          
              echo >&2 $"ldd: option \`$1' is ambiguous"
- 
          
          
              exit 1
- 
          
          
              ;;
- 
          
          
            --)		# Stop option processing.
- 
          
          
              shift; break
- 
          
          
              ;;
- 
          
          
            -*)
- 
          
          
              echo >&2 'ldd:' $"unrecognized option" "\`$1'"
- 
          
          
              echo >&2 $"Try \`ldd --help' for more information."
- 
          
          
              exit 1
- 
          
          
              ;;
- 
          
          
            *)
- 
          1
          
              break
- 
          
          
              ;;
- 
          
          
            esac
- 
          
          
          done
- 
          
          
          - 
          
          
          nonelf ()
- 
          
          
          {
- 
          
          
            # Maybe extra code for non-ELF binaries.
- 
          
          
            return 1;
- 
          
          
          }
- 
          
          
          - 
          1
          
          add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now"
- 
          1
          
          add_env="$add_env LD_LIBRARY_VERSION=\$verify_out"
- 
          1
          
          add_env="$add_env LD_VERBOSE=$verbose"
- 
          1
          
          if test "$unused" = yes; then
- 
          
          
            add_env="$add_env LD_DEBUG=\"$LD_DEBUG${LD_DEBUG:+,}unused\""
- 
          
          
          fi
- 
          
          
          - 
          
          
          # The following use of cat is needed to make ldd work in SELinux
- 
          
          
          # environments where the executed program might not have permissions
- 
          
          
          # to write to the console/tty.  But only bash 3.x supports the pipefail
- 
          
          
          # option, and we don't bother to handle the case for older bash versions.
- 
          4
          
          if x=`set -o` && test "$x" != "${x#*pipefail}" && set -o pipefail ; then
- 
          
          
            try_trace() {
- 
          696
          
              eval $add_env '"$@"' | cat
- 
          
          
            }
- 
          
          
          else
- 
          
          
            try_trace() {
- 
          
          
              eval $add_env '"$@"'
- 
          
          
            }
- 
          
          
          fi
- 
          
          
          - 
          1
          
          case $# in
- 
          
          
          0)
- 
          
          
            echo >&2 'ldd:' $"missing file arguments"
- 
          
          
            echo >&2 $"Try \`ldd --help' for more information."
- 
          
          
            exit 1
- 
          
          
            ;;
- 
          
          
          1)
- 
          
          
            single_file=t
- 
          
          
            ;;
- 
          
          
          *)
- 
          1
          
            single_file=f
- 
          
          
            ;;
- 
          
          
          esac
- 
          
          
          - 
          1
          
          result=0
- 
          87
          
          for file do
- 
          
          
            # We don't list the file name when there is only one.
- 
          174
          
            test $single_file = t || echo "${file}:"
- 
          87
          
            case $file in
- 
          87
          
            */*) :
- 
          
          
                 ;;
- 
          
          
            *) file=./$file
- 
          
          
               ;;
- 
          
          
            esac
- 
          87
          
            if test ! -e "$file"; then
- 
          
          
              echo "ldd: ${file}:" $"No such file or directory" >&2
- 
          
          
              result=1
- 
          87
          
            elif test ! -f "$file"; then
- 
          
          
              echo "ldd: ${file}:" $"not regular file" >&2
- 
          
          
              result=1
- 
          87
          
            elif test -r "$file"; then
- 
          87
          
              RTLD=
- 
          87
          
              ret=1
- 
          174
          
              for rtld in ${RTLDLIST}; do
- 
          174
          
                if test -x $rtld; then
- 
          174
          
          	verify_out=`${rtld} --verify "$file"`
- 
          87
          
          	ret=$?
- 
          87
          
          	case $ret in
- 
          174
          
          	[02]) RTLD=${rtld}; break;;
- 
          
          
          	esac
- 
          
          
                fi
- 
          
          
              done
- 
          87
          
              case $ret in
- 
          
          
              0|2)
- 
          87
          
                try_trace "$RTLD" "$file" || result=1
- 
          
          
                ;;
- 
          
          
              1|126)
- 
          
          
                # This can be a non-ELF binary or no binary at all.
- 
          
          
                nonelf "$file" || {
- 
          
          
          	echo $"	not a dynamic executable"
- 
          
          
          	result=1
- 
          
          
                }
- 
          
          
                ;;
- 
          
          
              *)
- 
          
          
                echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($ret)" >&2
- 
          
          
                exit 1
- 
          
          
                ;;
- 
          
          
              esac
- 
          
          
            else
- 
          
          
              echo 'ldd:' $"error: you do not have read permission for" "\`$file'" >&2
- 
          
          
              result=1
- 
          
          
            fi
- 
          
          
          done
- 
          
          
          - 
          1
          
          exit $result
- 
          
          
          # Local Variables:
- 
          
          
          #  mode:ksh
- 
          
          
          # End:
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          function bundle_not_found()
- 
          
          
          {
- 
          3
          
            printf "%b" "$(tput setaf 1)ERROR: Gem bundler is not installed, run \`gem install bundler\` first.$(tput sgr0)\n"
- 
          1
          
            exit 127
- 
          
          
          }
- 
          
          
          - 
          
          
          # in rvm warn about missing gem
- 
          1
          
          if [[ -n "${GEM_HOME:-}" ]]
- 
          
          
          then
- 
          1
          
            bundle_not_found
- 
          
          
          else
- 
          
          
            current_bundle="$(dirname $(which $0))"
- 
          
          
            export PATH
- 
          
          
            PATH=":${PATH}:"
- 
          
          
            PATH="${PATH//:${current_bundle}:/:}"
- 
          
          
            PATH="${PATH#:}"
- 
          
          
            PATH="${PATH%:}"
- 
          
          
            if [[ -n "${current_bundle}" ]] && builtin command -v bundle >/dev/null 2>&1
- 
          
          
            then
- 
          
          
              builtin command bundle "$@"
- 
          
          
            else
- 
          
          
              bundle_not_found
- 
          
          
            fi
- 
          
          
          fi
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          22
          
          if (( ${rvm_ignore_rvmrc:=0} == 0 ))
- 
          
          
          then
- 
          11
          
            declare rvmrc
- 
          
          
          - 
          11
          
            rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
- 
          22
          
            if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
- 
          11
          
               then rvm_rvmrc_files+=( "${rvm_prefix}/.rvmrc" )
- 
          
          
            fi
- 
          
          
          - 
          33
          
            for rvmrc in "${rvm_rvmrc_files[@]}"
- 
          
          
            do
- 
          33
          
              if [[ -f "$rvmrc" ]]
- 
          
          
              then
- 
          22
          
                if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
- 
          
          
                then
- 
          
          
                  printf "%b" "
- 
          
          
            Error:
- 
          
          
              $rvmrc is for rvm settings only.
- 
          
          
              rvm CLI may NOT be called from within $rvmrc.
- 
          
          
              Skipping the loading of $rvmrc
- 
          
          
          "
- 
          
          
                  exit 1
- 
          
          
                else
- 
          11
          
                  source "$rvmrc"
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            done
- 
          11
          
            unset rvm_rvmrc_files
- 
          11
          
            unset rvmrc
- 
          
          
          fi
- 
          
          
          - 
          22
          
          export rvm_path
- 
          22
          
          if [[ -z "${rvm_path:-}" ]]
- 
          
          
          then
- 
          
          
            if (( UID == 0 )) && [[ -d "/usr/local/rvm" ]]
- 
          
          
            then rvm_path="/usr/local/rvm"
- 
          
          
            elif [[ -d "${HOME}/.rvm" ]]
- 
          
          
            then rvm_path="${HOME}/.rvm"
- 
          
          
            elif [[ -d "/usr/local/rvm" ]]
- 
          
          
            then rvm_path="/usr/local/rvm"
- 
          
          
            else echo "Can't find rvm install!" 1>&2 ; exit 1
- 
          
          
            fi
- 
          
          
          fi
- 
          
          
          - 
          
          
          # allow disabling check temporary
- 
          22
          
          : rvm_is_not_a_shell_function:${rvm_is_not_a_shell_function:=1}
- 
          22
          
          export rvm_is_not_a_shell_function
- 
          
          
          - 
          
          
          # if to prevent fork-bomb
- 
          22
          
          if source "${rvm_scripts_path:="$rvm_path/scripts"}/rvm"
- 
          
          
          then
- 
          22
          
            rvm "$@"
- 
          
          
          else
- 
          
          
            echo "Error sourcing RVM!"  1>&2
- 
          
          
            exit 1
- 
          
          
          fi
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          8
          
          export HOME="${HOME%%+(\/)}" # Remove trailing slashes if they exist on HOME
- 
          
          
          - 
          4
          
          if (( ${rvm_ignore_rvmrc:=0} == 0 ))
- 
          
          
          then
- 
          8
          
            for rvmrc in /etc/rvmrc "$HOME/.rvmrc"
- 
          
          
            do
- 
          8
          
              if [[ -f "$rvmrc" ]]
- 
          
          
              then
- 
          8
          
                if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
- 
          
          
                then
- 
          
          
                  printf "%b" "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
- 
          
          
                  return 1
- 
          
          
                else
- 
          4
          
                  source "$rvmrc"
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          fi
- 
          
          
          - 
          4
          
          export rvm_path
- 
          4
          
          if [[ -z "${rvm_path:-}" ]]
- 
          
          
          then
- 
          
          
            if (( UID == 0 )) && [[ -d "/usr/local/rvm" ]]
- 
          
          
            then rvm_path="/usr/local/rvm"
- 
          
          
            elif [[ -d "${HOME}/.rvm" ]]
- 
          
          
            then rvm_path="${HOME}/.rvm"
- 
          
          
            elif [[ -d "/usr/local/rvm" ]]
- 
          
          
            then rvm_path="/usr/local/rvm"
- 
          
          
            else echo "Can't find rvm install!" 1>&2 ; exit 1
- 
          
          
            fi
- 
          
          
          fi
- 
          
          
          - 
          4
          
          true ${rvm_scripts_path:="$rvm_path/scripts"}
- 
          
          
          - 
          
          
          __rvm_shell_lookup_script()
- 
          
          
          {
- 
          4
          
            local relative_scripts_dir directory
- 
          4
          
            if [[ -L $0 ]]
- 
          
          
            then relative_scripts_dir="$(dirname -- "$(dirname -- "$( readlink "$0")" )" )/scripts" #"
- 
          12
          
            else relative_scripts_dir="$(dirname -- "$(dirname -- "$0")")/scripts" #"
- 
          
          
            fi
- 
          
          
          - 
          4
          
            for directory in "$rvm_scripts_path" "$HOME/.rvm/scripts" "/usr/local/rvm/scripts" "$relative_scripts_dir"
- 
          
          
            do
- 
          8
          
              if [[ -d "$directory" && -s "$directory/rvm" ]]
- 
          
          
              then
- 
          4
          
                echo "$directory/rvm"
- 
          4
          
                return
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          4
          
          case $0 in
- 
          
          
            (*-rvm-env) selected_shell=${0%-rvm-env} ;;
- 
          4
          
            (*)         selected_shell=bash          ;;
- 
          
          
          esac
- 
          8
          
          selected_shell="$(basename "${selected_shell}")"
- 
          
          
          - 
          24
          
          if [[ -n "$1" && ! -f "$1" && -n "$(echo "$1" | GREP_OPTIONS="" \grep -v '^-')" ]]
- 
          
          
          then
- 
          
          
            rvm_shell_ruby_string="$1"
- 
          
          
            shift
- 
          8
          
          elif [[ "$1" == "--path" && "$2" =~ /* ]]
- 
          
          
          then
- 
          4
          
            if [[ -d "$2" ]]
- 
          
          
            then
- 
          4
          
              cd $2
- 
          
          
            else
- 
          
          
              rvm_shell_ruby_string="default"
- 
          
          
            fi
- 
          4
          
            shift 2
- 
          
          
          fi
- 
          
          
          - 
          8
          
          rvm_shell_rvm_path="$(__rvm_shell_lookup_script)"
- 
          4
          
          if [[ -n "$rvm_shell_rvm_path" ]]
- 
          
          
          then
- 
          4
          
            source "$rvm_shell_rvm_path"
- 
          
          
            # Setup as expected.
- 
          4
          
            if [[ -n "$rvm_shell_ruby_string" ]]
- 
          
          
            then
- 
          
          
              if ! rvm "$rvm_shell_ruby_string"
- 
          
          
              then
- 
          
          
                echo "Error: RVM was unable to use '$rvm_shell_ruby_string'" 1>&2
- 
          
          
                exit 1
- 
          
          
              fi
- 
          
          
            else
- 
          4
          
              __rvm_conditionally_do_with_env __rvm_rvmrc_tools load . >/dev/null 2>&1
- 
          
          
            fi
- 
          
          
          fi
- 
          
          
          - 
          4
          
          exec ${selected_shell} "$@"
 
      
        
  
  
  
    
      
        - 
          2
          
          export PATH ; PATH="/usr/local/rvm/gems/ruby-1.8.7-p371/bin:/usr/local/rvm/gems/ruby-1.8.7-p371@global/bin:/usr/local/rvm/rubies/ruby-1.8.7-p371/bin:/usr/local/rvm/bin:$PATH"
- 
          2
          
          export rvm_env_string ; rvm_env_string='ruby-1.8.7-p371'
- 
          2
          
          export rvm_path ; rvm_path='/usr/local/rvm'
- 
          2
          
          export rvm_ruby_string ; rvm_ruby_string='ruby-1.8.7-p371'
- 
          1
          
          unset rvm_gemset_name
- 
          2
          
          export RUBY_VERSION ; RUBY_VERSION='ruby-1.8.7-p371'
- 
          2
          
          export GEM_HOME ; GEM_HOME='/usr/local/rvm/gems/ruby-1.8.7-p371'
- 
          2
          
          export GEM_PATH ; GEM_PATH='/usr/local/rvm/gems/ruby-1.8.7-p371:/usr/local/rvm/gems/ruby-1.8.7-p371@global'
- 
          2
          
          export MY_RUBY_HOME ; MY_RUBY_HOME='/usr/local/rvm/rubies/ruby-1.8.7-p371'
- 
          2
          
          export IRBRC ; IRBRC='/usr/local/rvm/rubies/ruby-1.8.7-p371/.irbrc'
- 
          1
          
          unset MAGLEV_HOME
- 
          1
          
          unset RBXOPT
 
      
        
  
  
  
    
      
        - 
          2
          
          export PATH ; PATH="/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:$PATH"
- 
          2
          
          export rvm_env_string ; rvm_env_string='ruby-1.9.3-p392'
- 
          2
          
          export rvm_path ; rvm_path='/usr/local/rvm'
- 
          2
          
          export rvm_ruby_string ; rvm_ruby_string='ruby-1.9.3-p392'
- 
          1
          
          unset rvm_gemset_name
- 
          2
          
          export RUBY_VERSION ; RUBY_VERSION='ruby-1.9.3-p392'
- 
          2
          
          export GEM_HOME ; GEM_HOME='/usr/local/rvm/gems/ruby-1.9.3-p392'
- 
          2
          
          export GEM_PATH ; GEM_PATH='/usr/local/rvm/gems/ruby-1.9.3-p392:/usr/local/rvm/gems/ruby-1.9.3-p392@global'
- 
          2
          
          export MY_RUBY_HOME ; MY_RUBY_HOME='/usr/local/rvm/rubies/ruby-1.9.3-p392'
- 
          2
          
          export IRBRC ; IRBRC='/usr/local/rvm/rubies/ruby-1.9.3-p392/.irbrc'
- 
          1
          
          unset MAGLEV_HOME
- 
          1
          
          unset RBXOPT
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          if
- 
          
          
            [[ -f "/etc/gentoo-release" ||
- 
          
          
              "${RUBYOPT:-}" =~ "-rauto_gem"
- 
          2
          
            ]]
- 
          
          
          then
- 
          
          
            typeset __sitelib
- 
          
          
            __sitelib="$( $rvm_ruby_binary -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']" )"
- 
          
          
            if [[ -n "${__sitelib}" ]]
- 
          
          
            then touch "${__sitelib}/auto_gem.rb"
- 
          
          
            else echo "WARN: Installed ruby does not have valid 'sitelibdir', no 'auto_gem.rb' was created, please report a bug here: https://github.com/wayneeseguin/rvm/issues"
- 
          
          
            fi
- 
          
          
          fi
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          175
          
          . "${rvm_path}/scripts/functions/hooks/maglev"
- 
          
          
          - 
          
          
          if
- 
          175
          
            [[ "${rvm_ruby_string}" =~ "maglev" ]]
- 
          
          
          then
- 
          
          
            _maglev_gemstone start
- 
          
          
          fi
 
      
        
      
        
      
        
      
        
      
        
  
  
  
    
      
        - 
          4
          
          ALLOCA=""
- 
          4
          
          AR="ar"
- 
          4
          
          ARCHFILE=""
- 
          4
          
          ARCH_FLAG=""
- 
          4
          
          AS="as"
- 
          4
          
          ASFLAGS=""
- 
          4
          
          BASERUBY="ruby"
- 
          4
          
          BUILTIN_TRANSSRCS=" newline.c"
- 
          4
          
          CAPITARGET="nodoc"
- 
          4
          
          CC="gcc"
- 
          4
          
          CCDLFLAGS="-fPIC"
- 
          4
          
          CFLAGS=" -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -fPIC"
- 
          4
          
          CHDIR="cd -P"
- 
          4
          
          COMMON_HEADERS=""
- 
          4
          
          COMMON_LIBS=""
- 
          4
          
          COMMON_MACROS=""
- 
          4
          
          COUTFLAG="-o "
- 
          4
          
          CP="cp"
- 
          4
          
          CPP="gcc -E"
- 
          4
          
          CPPFLAGS="  "
- 
          4
          
          CPPOUTFILE="-o conftest.i"
- 
          4
          
          CXX="g++"
- 
          4
          
          CXXFLAGS=" -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long"
- 
          4
          
          DEFS=""
- 
          4
          
          DESTDIR=""
- 
          4
          
          DLDFLAGS=""
- 
          4
          
          DLDLIBS=" -lc"
- 
          4
          
          DLEXT="so"
- 
          4
          
          DLEXT2=""
- 
          4
          
          DLLWRAP=""
- 
          4
          
          DOT=""
- 
          4
          
          DOXYGEN=""
- 
          4
          
          ECHO_C=""
- 
          4
          
          ECHO_N="-n"
- 
          4
          
          ECHO_T=""
- 
          4
          
          EGREP="/bin/grep -E"
- 
          4
          
          ENABLE_SHARED="yes"
- 
          4
          
          EXECUTABLE_EXTS=""
- 
          4
          
          EXEEXT=""
- 
          4
          
          EXPORT_PREFIX=""
- 
          4
          
          EXTOUT=".ext"
- 
          4
          
          EXTSTATIC=""
- 
          4
          
          GCC="yes"
- 
          4
          
          GNU_LD="yes"
- 
          4
          
          GREP="/bin/grep"
- 
          4
          
          INSTALL="/usr/bin/install -c"
- 
          4
          
          INSTALLDOC="nodoc"
- 
          4
          
          INSTALL_DATA="/usr/bin/install -c -m 644"
- 
          4
          
          INSTALL_PROGRAM="/usr/bin/install -c"
- 
          4
          
          INSTALL_SCRIPT="/usr/bin/install -c"
- 
          4
          
          LDFLAGS="-L.  -rdynamic -Wl,-export-dynamic"
- 
          4
          
          LDSHARED="gcc -shared"
- 
          4
          
          LDSHAREDXX="g++ -shared"
- 
          4
          
          LIBEXT="a"
- 
          4
          
          LIBPATHENV="LD_LIBRARY_PATH"
- 
          4
          
          LIBPATHFLAG=" -L%1\$-s"
- 
          4
          
          LIBRUBY="libruby.so.1.9.1"
- 
          4
          
          LIBRUBYARG="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.2-p320/lib -L/usr/local/rvm/rubies/ruby-1.9.2-p320/lib -lruby"
- 
          4
          
          LIBRUBYARG_SHARED="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.2-p320/lib -L/usr/local/rvm/rubies/ruby-1.9.2-p320/lib -lruby"
- 
          4
          
          LIBRUBYARG_STATIC="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.2-p320/lib -L/usr/local/rvm/rubies/ruby-1.9.2-p320/lib -lruby-static"
- 
          4
          
          LIBRUBY_A="libruby-static.a"
- 
          4
          
          LIBRUBY_ALIASES="libruby.so.1.9 libruby.so"
- 
          4
          
          LIBRUBY_DLDFLAGS="-Wl,-soname,libruby.so.1.9"
- 
          4
          
          LIBRUBY_LDSHARED="gcc -shared"
- 
          4
          
          LIBRUBY_SO="libruby.so.1.9.1"
- 
          4
          
          LIBS="-lpthread -lrt -ldl -lcrypt -lm "
- 
          4
          
          LINK_SO=""
- 
          4
          
          LN_S="ln -s"
- 
          4
          
          MAINLIBS=""
- 
          4
          
          MAJOR="1"
- 
          4
          
          MAKEDIRS="/bin/mkdir -p"
- 
          4
          
          MAKEFILES="Makefile"
- 
          4
          
          MANTYPE="man"
- 
          4
          
          MINOR="9"
- 
          4
          
          MKDIR_P="/bin/mkdir -p"
- 
          4
          
          NM=""
- 
          4
          
          NROFF="/bin/false"
- 
          4
          
          OBJCOPY="objcopy"
- 
          4
          
          OBJDUMP="objdump"
- 
          4
          
          OBJEXT="o"
- 
          4
          
          OUTFLAG="-o "
- 
          4
          
          PACKAGE="ruby"
- 
          4
          
          PACKAGE_BUGREPORT=""
- 
          4
          
          PACKAGE_NAME=""
- 
          4
          
          PACKAGE_STRING=""
- 
          4
          
          PACKAGE_TARNAME=""
- 
          4
          
          PACKAGE_URL=""
- 
          4
          
          PACKAGE_VERSION=""
- 
          4
          
          PATCHLEVEL="320"
- 
          4
          
          PATH_SEPARATOR=":"
- 
          4
          
          PREP="miniruby"
- 
          4
          
          RANLIB="ranlib"
- 
          4
          
          RDOCTARGET="nodoc"
- 
          4
          
          RI_BASE_NAME="ri"
- 
          4
          
          RM="rm -f"
- 
          4
          
          RMALL="rm -fr"
- 
          4
          
          RMDIRS="\$(top_srcdir)/tool/rmdirs"
- 
          4
          
          RPATHFLAG=" -Wl,-R%1\$-s"
- 
          4
          
          RUBYW_BASE_NAME="rubyw"
- 
          4
          
          RUBYW_INSTALL_NAME=""
- 
          4
          
          RUBY_BASE_NAME="ruby"
- 
          4
          
          RUBY_INSTALL_NAME="ruby"
- 
          4
          
          RUBY_PROGRAM_VERSION="1.9.2"
- 
          4
          
          RUBY_RELEASE_DATE="2012-04-20"
- 
          4
          
          RUBY_SO_NAME="ruby"
- 
          4
          
          SET_MAKE=""
- 
          4
          
          SHELL="/bin/bash"
- 
          4
          
          SOLIBS="-lpthread -lrt -ldl -lcrypt -lm "
- 
          4
          
          STATIC=""
- 
          4
          
          STRIP="strip -S -x"
- 
          4
          
          TEENY="1"
- 
          4
          
          TEST_RUNNABLE="yes"
- 
          4
          
          THREAD_MODEL="pthread"
- 
          4
          
          TRY_LINK=""
- 
          4
          
          UNIVERSAL_ARCHNAMES=""
- 
          4
          
          UNIVERSAL_INTS=""
- 
          4
          
          WINDRES=""
- 
          4
          
          arch="x86_64-linux"
- 
          4
          
          archdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/x86_64-linux"
- 
          4
          
          bindir="/usr/local/rvm/rubies/ruby-1.9.2-p320/bin"
- 
          4
          
          build="x86_64-unknown-linux-gnu"
- 
          4
          
          build_alias=""
- 
          4
          
          build_cpu="x86_64"
- 
          4
          
          build_os="linux-gnu"
- 
          4
          
          build_vendor="unknown"
- 
          4
          
          cflags=" -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long"
- 
          4
          
          configure_args=" '--prefix=/usr/local/rvm/rubies/ruby-1.9.2-p320' '--disable-install-doc' '--enable-shared'"
- 
          4
          
          cppflags=""
- 
          4
          
          cxxflags=" -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long"
- 
          4
          
          datadir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share"
- 
          4
          
          datarootdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share"
- 
          4
          
          debugflags="-ggdb"
- 
          4
          
          docdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/doc/ruby"
- 
          4
          
          dvidir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/doc/ruby"
- 
          4
          
          exec_prefix="/usr/local/rvm/rubies/ruby-1.9.2-p320"
- 
          4
          
          host="x86_64-unknown-linux-gnu"
- 
          4
          
          host_alias=""
- 
          4
          
          host_cpu="x86_64"
- 
          4
          
          host_os="linux-gnu"
- 
          4
          
          host_vendor="unknown"
- 
          4
          
          htmldir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/doc/ruby"
- 
          4
          
          includedir="/usr/local/rvm/rubies/ruby-1.9.2-p320/include"
- 
          4
          
          infodir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/info"
- 
          4
          
          libdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib"
- 
          4
          
          libexecdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/libexec"
- 
          4
          
          localedir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/locale"
- 
          4
          
          localstatedir="/usr/local/rvm/rubies/ruby-1.9.2-p320/var"
- 
          4
          
          mandir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/man"
- 
          4
          
          oldincludedir="/usr/include"
- 
          4
          
          optflags="-O3"
- 
          4
          
          pdfdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/doc/ruby"
- 
          4
          
          prefix="/usr/local/rvm/rubies/ruby-1.9.2-p320"
- 
          4
          
          psdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/doc/ruby"
- 
          4
          
          ridir="/usr/local/rvm/rubies/ruby-1.9.2-p320/share/ri"
- 
          4
          
          ruby_install_name="ruby"
- 
          4
          
          ruby_version="1.9.1"
- 
          4
          
          rubyhdrdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1"
- 
          4
          
          rubylibdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1"
- 
          4
          
          rubylibprefix="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby"
- 
          4
          
          rubyw_install_name=""
- 
          4
          
          sbindir="/usr/local/rvm/rubies/ruby-1.9.2-p320/sbin"
- 
          4
          
          setup="Setup"
- 
          4
          
          sharedstatedir="/usr/local/rvm/rubies/ruby-1.9.2-p320/com"
- 
          4
          
          sitearch="x86_64-linux"
- 
          4
          
          sitearchdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/x86_64-linux"
- 
          4
          
          sitedir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby"
- 
          4
          
          sitehdrdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/site_ruby"
- 
          4
          
          sitelibdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1"
- 
          4
          
          sysconfdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/etc"
- 
          4
          
          target="x86_64-unknown-linux-gnu"
- 
          4
          
          target_alias=""
- 
          4
          
          target_cpu="x86_64"
- 
          4
          
          target_os="linux"
- 
          4
          
          target_vendor="unknown"
- 
          4
          
          topdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/x86_64-linux"
- 
          4
          
          try_header=""
- 
          4
          
          vendorarchdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1/x86_64-linux"
- 
          4
          
          vendordir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby"
- 
          4
          
          vendorhdrdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/vendor_ruby"
- 
          4
          
          vendorlibdir="/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/vendor_ruby/1.9.1"
- 
          4
          
          warnflags="-Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long"
 
      
        
  
  
  
    
      
        - 
          5
          
          ALLOCA=""
- 
          5
          
          AR="ar"
- 
          5
          
          ARCHFILE=""
- 
          5
          
          ARCH_FLAG=""
- 
          5
          
          AS="as"
- 
          5
          
          ASFLAGS=""
- 
          5
          
          BASERUBY="ruby"
- 
          5
          
          BUILTIN_TRANSSRCS=" newline.c"
- 
          5
          
          CAPITARGET="nodoc"
- 
          5
          
          CC="gcc"
- 
          5
          
          CCDLFLAGS="-fPIC"
- 
          5
          
          CFLAGS=" -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration  -fPIC"
- 
          5
          
          CHDIR="cd -P"
- 
          5
          
          COMMON_HEADERS=""
- 
          5
          
          COMMON_LIBS=""
- 
          5
          
          COMMON_MACROS=""
- 
          5
          
          COUTFLAG="-o "
- 
          5
          
          CP="cp"
- 
          5
          
          CPP="gcc -E"
- 
          5
          
          CPPFLAGS="  "
- 
          5
          
          CPPOUTFILE="-o conftest.i"
- 
          5
          
          CXX="g++"
- 
          5
          
          CXXFLAGS=" -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration"
- 
          5
          
          DEFS=""
- 
          5
          
          DESTDIR=""
- 
          5
          
          DLDFLAGS=""
- 
          5
          
          DLDLIBS=" -lc"
- 
          5
          
          DLEXT="so"
- 
          5
          
          DLEXT2=""
- 
          5
          
          DLLWRAP=""
- 
          5
          
          DOT=""
- 
          5
          
          DOXYGEN=""
- 
          5
          
          ECHO_C=""
- 
          5
          
          ECHO_N="-n"
- 
          5
          
          ECHO_T=""
- 
          5
          
          EGREP="/bin/grep -E"
- 
          5
          
          ENABLE_SHARED="yes"
- 
          5
          
          EXECUTABLE_EXTS=""
- 
          5
          
          EXEEXT=""
- 
          5
          
          EXPORT_PREFIX=""
- 
          5
          
          EXTOUT=".ext"
- 
          5
          
          EXTSTATIC=""
- 
          5
          
          GCC="yes"
- 
          5
          
          GNU_LD="yes"
- 
          5
          
          GREP="/bin/grep"
- 
          5
          
          INSTALL="/usr/bin/install -c"
- 
          5
          
          INSTALLDOC="nodoc"
- 
          5
          
          INSTALL_DATA="/usr/bin/install -c -m 644"
- 
          5
          
          INSTALL_PROGRAM="/usr/bin/install -c"
- 
          5
          
          INSTALL_SCRIPT="/usr/bin/install -c"
- 
          5
          
          LDFLAGS="-L.  -rdynamic -Wl,-export-dynamic"
- 
          5
          
          LDSHARED="gcc -shared"
- 
          5
          
          LDSHAREDXX="g++ -shared"
- 
          5
          
          LIBEXT="a"
- 
          5
          
          LIBPATHENV="LD_LIBRARY_PATH"
- 
          5
          
          LIBPATHFLAG=" -L%1\$-s"
- 
          5
          
          LIBRUBY="libruby.so.1.9.1"
- 
          5
          
          LIBRUBYARG="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p194/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p194/lib -lruby"
- 
          5
          
          LIBRUBYARG_SHARED="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p194/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p194/lib -lruby"
- 
          5
          
          LIBRUBYARG_STATIC="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p194/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p194/lib -lruby-static"
- 
          5
          
          LIBRUBY_A="libruby-static.a"
- 
          5
          
          LIBRUBY_ALIASES="libruby.so.1.9 libruby.so"
- 
          5
          
          LIBRUBY_DLDFLAGS="-Wl,-soname,libruby.so.1.9"
- 
          5
          
          LIBRUBY_LDSHARED="gcc -shared"
- 
          5
          
          LIBRUBY_RELATIVE="no"
- 
          5
          
          LIBRUBY_SO="libruby.so.1.9.1"
- 
          5
          
          LIBS="-lpthread -lrt -ldl -lcrypt -lm "
- 
          5
          
          LINK_SO=""
- 
          5
          
          LN_S="ln -s"
- 
          5
          
          MAINLIBS=""
- 
          5
          
          MAJOR="1"
- 
          5
          
          MAKEDIRS="/bin/mkdir -p"
- 
          5
          
          MAKEFILES="Makefile"
- 
          5
          
          MANTYPE="man"
- 
          5
          
          MINOR="9"
- 
          5
          
          MKDIR_P="/bin/mkdir -p"
- 
          5
          
          NM="nm"
- 
          5
          
          NROFF="/bin/false"
- 
          5
          
          NULLCMD=":"
- 
          5
          
          OBJCOPY="objcopy"
- 
          5
          
          OBJDUMP="objdump"
- 
          5
          
          OBJEXT="o"
- 
          5
          
          OUTFLAG="-o "
- 
          5
          
          PACKAGE="ruby"
- 
          5
          
          PACKAGE_BUGREPORT=""
- 
          5
          
          PACKAGE_NAME=""
- 
          5
          
          PACKAGE_STRING=""
- 
          5
          
          PACKAGE_TARNAME=""
- 
          5
          
          PACKAGE_URL=""
- 
          5
          
          PACKAGE_VERSION=""
- 
          5
          
          PATCHLEVEL="194"
- 
          5
          
          PATH_SEPARATOR=":"
- 
          5
          
          PKG_CONFIG=""
- 
          5
          
          PREP="miniruby"
- 
          5
          
          RANLIB="ranlib"
- 
          5
          
          RDOCTARGET="nodoc"
- 
          5
          
          RI_BASE_NAME="ri"
- 
          5
          
          RM="rm -f"
- 
          5
          
          RMALL="rm -fr"
- 
          5
          
          RMDIR="rmdir --ignore-fail-on-non-empty"
- 
          5
          
          RMDIRS="rmdir --ignore-fail-on-non-empty -p"
- 
          5
          
          RPATHFLAG=" -Wl,-R%1\$-s"
- 
          5
          
          RUBYW_BASE_NAME="rubyw"
- 
          5
          
          RUBYW_INSTALL_NAME=""
- 
          5
          
          RUBY_BASE_NAME="ruby"
- 
          5
          
          RUBY_INSTALL_NAME="ruby"
- 
          5
          
          RUBY_PROGRAM_VERSION="1.9.3"
- 
          5
          
          RUBY_RELEASE_DATE="2012-04-20"
- 
          5
          
          RUBY_SO_NAME="ruby"
- 
          5
          
          SET_MAKE=""
- 
          5
          
          SHELL="/bin/bash"
- 
          5
          
          SOLIBS="-lpthread -lrt -ldl -lcrypt -lm "
- 
          5
          
          STATIC=""
- 
          5
          
          STRIP="strip -S -x"
- 
          5
          
          SYMBOL_PREFIX=""
- 
          5
          
          TEENY="1"
- 
          5
          
          TEST_RUNNABLE="yes"
- 
          5
          
          THREAD_MODEL="pthread"
- 
          5
          
          TRY_LINK=""
- 
          5
          
          UNIVERSAL_ARCHNAMES=""
- 
          5
          
          UNIVERSAL_INTS=""
- 
          5
          
          USE_RUBYGEMS="YES"
- 
          5
          
          WERRORFLAG="-Werror"
- 
          5
          
          WINDRES=""
- 
          5
          
          arch="x86_64-linux"
- 
          5
          
          archdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-linux"
- 
          5
          
          bindir="/usr/local/rvm/rubies/ruby-1.9.3-p194/bin"
- 
          5
          
          build="x86_64-unknown-linux-gnu"
- 
          5
          
          build_alias=""
- 
          5
          
          build_cpu="x86_64"
- 
          5
          
          build_os="linux-gnu"
- 
          5
          
          build_vendor="unknown"
- 
          5
          
          cflags=" -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration"
- 
          5
          
          configure_args=" '--prefix=/usr/local/rvm/rubies/ruby-1.9.3-p194' '--disable-install-doc' '--enable-shared'"
- 
          5
          
          cppflags=""
- 
          5
          
          cxxflags=" -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration"
- 
          5
          
          datadir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share"
- 
          5
          
          datarootdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share"
- 
          5
          
          debugflags="-ggdb"
- 
          5
          
          docdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/doc/ruby"
- 
          5
          
          dvidir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/doc/ruby"
- 
          5
          
          exec="exec"
- 
          5
          
          exec_prefix="/usr/local/rvm/rubies/ruby-1.9.3-p194"
- 
          5
          
          host="x86_64-unknown-linux-gnu"
- 
          5
          
          host_alias=""
- 
          5
          
          host_cpu="x86_64"
- 
          5
          
          host_os="linux-gnu"
- 
          5
          
          host_vendor="unknown"
- 
          5
          
          htmldir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/doc/ruby"
- 
          5
          
          includedir="/usr/local/rvm/rubies/ruby-1.9.3-p194/include"
- 
          5
          
          infodir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/info"
- 
          5
          
          libdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib"
- 
          5
          
          libexecdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/libexec"
- 
          5
          
          localedir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/locale"
- 
          5
          
          localstatedir="/usr/local/rvm/rubies/ruby-1.9.3-p194/var"
- 
          5
          
          mandir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/man"
- 
          5
          
          oldincludedir="/usr/include"
- 
          5
          
          optflags="-O3"
- 
          5
          
          pdfdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/doc/ruby"
- 
          5
          
          prefix="/usr/local/rvm/rubies/ruby-1.9.3-p194"
- 
          5
          
          psdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/doc/ruby"
- 
          5
          
          ridir="/usr/local/rvm/rubies/ruby-1.9.3-p194/share/ri"
- 
          5
          
          ruby_install_name="ruby"
- 
          5
          
          ruby_pc="ruby-1.9.pc"
- 
          5
          
          ruby_version="1.9.1"
- 
          5
          
          rubyhdrdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1"
- 
          5
          
          rubylibdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1"
- 
          5
          
          rubylibprefix="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby"
- 
          5
          
          rubyw_install_name=""
- 
          5
          
          sbindir="/usr/local/rvm/rubies/ruby-1.9.3-p194/sbin"
- 
          5
          
          setup="Setup"
- 
          5
          
          sharedstatedir="/usr/local/rvm/rubies/ruby-1.9.3-p194/com"
- 
          5
          
          sitearch="x86_64-linux"
- 
          5
          
          sitearchdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux"
- 
          5
          
          sitedir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby"
- 
          5
          
          sitehdrdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/site_ruby"
- 
          5
          
          sitelibdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1"
- 
          5
          
          sysconfdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/etc"
- 
          5
          
          target="x86_64-unknown-linux-gnu"
- 
          5
          
          target_alias=""
- 
          5
          
          target_cpu="x86_64"
- 
          5
          
          target_os="linux"
- 
          5
          
          target_vendor="unknown"
- 
          5
          
          topdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-linux"
- 
          5
          
          try_header=""
- 
          5
          
          vendorarchdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/vendor_ruby/1.9.1/x86_64-linux"
- 
          5
          
          vendordir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/vendor_ruby"
- 
          5
          
          vendorhdrdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/vendor_ruby"
- 
          5
          
          vendorlibdir="/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/vendor_ruby/1.9.1"
- 
          5
          
          warnflags="-Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration"
 
      
        
  
  
  
    
      
        - 
          5
          
          ALLOCA=""
- 
          5
          
          AR="ar"
- 
          5
          
          ARCHFILE=""
- 
          5
          
          ARCH_FLAG=""
- 
          5
          
          AS="as"
- 
          5
          
          ASFLAGS=""
- 
          5
          
          BASERUBY="ruby"
- 
          5
          
          BUILTIN_TRANSSRCS=" newline.c"
- 
          5
          
          CAPITARGET="nodoc"
- 
          5
          
          CC="gcc"
- 
          5
          
          CCDLFLAGS="-fPIC"
- 
          5
          
          CFLAGS=" -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration  -fPIC"
- 
          5
          
          CHDIR="cd -P"
- 
          5
          
          COMMON_HEADERS=""
- 
          5
          
          COMMON_LIBS=""
- 
          5
          
          COMMON_MACROS=""
- 
          5
          
          COUTFLAG="-o "
- 
          5
          
          CP="cp"
- 
          5
          
          CPP="gcc -E"
- 
          5
          
          CPPFLAGS="  "
- 
          5
          
          CPPOUTFILE="-o conftest.i"
- 
          5
          
          CXX="g++"
- 
          5
          
          CXXFLAGS=" -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration"
- 
          5
          
          DEFS=""
- 
          5
          
          DESTDIR=""
- 
          5
          
          DLDFLAGS=""
- 
          5
          
          DLDLIBS=" -lc"
- 
          5
          
          DLEXT="so"
- 
          5
          
          DLEXT2=""
- 
          5
          
          DLLWRAP=""
- 
          5
          
          DOT=""
- 
          5
          
          DOXYGEN=""
- 
          5
          
          ECHO_C=""
- 
          5
          
          ECHO_N="-n"
- 
          5
          
          ECHO_T=""
- 
          5
          
          EGREP="/bin/grep -E"
- 
          5
          
          ENABLE_SHARED="yes"
- 
          5
          
          EXECUTABLE_EXTS=""
- 
          5
          
          EXEEXT=""
- 
          5
          
          EXPORT_PREFIX=""
- 
          5
          
          EXTOUT=".ext"
- 
          5
          
          EXTSTATIC=""
- 
          5
          
          GCC="yes"
- 
          5
          
          GNU_LD="yes"
- 
          5
          
          GREP="/bin/grep"
- 
          5
          
          INSTALL="/usr/bin/install -c"
- 
          5
          
          INSTALLDOC="nodoc"
- 
          5
          
          INSTALL_DATA="/usr/bin/install -c -m 644"
- 
          5
          
          INSTALL_PROGRAM="/usr/bin/install -c"
- 
          5
          
          INSTALL_SCRIPT="/usr/bin/install -c"
- 
          5
          
          LDFLAGS="-L.  -rdynamic -Wl,-export-dynamic"
- 
          5
          
          LDSHARED="gcc -shared"
- 
          5
          
          LDSHAREDXX="g++ -shared"
- 
          5
          
          LIBEXT="a"
- 
          5
          
          LIBPATHENV="LD_LIBRARY_PATH"
- 
          5
          
          LIBPATHFLAG=" -L%1\$-s"
- 
          5
          
          LIBRUBY="libruby.so.1.9.1"
- 
          5
          
          LIBRUBYARG="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p392/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p392/lib -lruby"
- 
          5
          
          LIBRUBYARG_SHARED="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p392/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p392/lib -lruby"
- 
          5
          
          LIBRUBYARG_STATIC="-Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p392/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p392/lib -lruby-static"
- 
          5
          
          LIBRUBY_A="libruby-static.a"
- 
          5
          
          LIBRUBY_ALIASES="libruby.so.1.9 libruby.so"
- 
          5
          
          LIBRUBY_DLDFLAGS="-Wl,-soname,libruby.so.1.9"
- 
          5
          
          LIBRUBY_LDSHARED="gcc -shared"
- 
          5
          
          LIBRUBY_RELATIVE="no"
- 
          5
          
          LIBRUBY_SO="libruby.so.1.9.1"
- 
          5
          
          LIBS="-lpthread -lrt -ldl -lcrypt -lm "
- 
          5
          
          LINK_SO=""
- 
          5
          
          LN_S="ln -s"
- 
          5
          
          MAINLIBS=""
- 
          5
          
          MAJOR="1"
- 
          5
          
          MAKEDIRS="/bin/mkdir -p"
- 
          5
          
          MAKEFILES="Makefile"
- 
          5
          
          MANTYPE="man"
- 
          5
          
          MINOR="9"
- 
          5
          
          MKDIR_P="/bin/mkdir -p"
- 
          5
          
          NM="nm"
- 
          5
          
          NROFF="/bin/false"
- 
          5
          
          NULLCMD=":"
- 
          5
          
          OBJCOPY=":"
- 
          5
          
          OBJDUMP="objdump"
- 
          5
          
          OBJEXT="o"
- 
          5
          
          OUTFLAG="-o "
- 
          5
          
          PACKAGE="ruby"
- 
          5
          
          PACKAGE_BUGREPORT=""
- 
          5
          
          PACKAGE_NAME=""
- 
          5
          
          PACKAGE_STRING=""
- 
          5
          
          PACKAGE_TARNAME=""
- 
          5
          
          PACKAGE_URL=""
- 
          5
          
          PACKAGE_VERSION=""
- 
          5
          
          PATCHLEVEL="392"
- 
          5
          
          PATH_SEPARATOR=":"
- 
          5
          
          PKG_CONFIG=""
- 
          5
          
          PLATFORM_DIR=""
- 
          5
          
          PREP="miniruby"
- 
          5
          
          RANLIB="ranlib"
- 
          5
          
          RDOCTARGET="nodoc"
- 
          5
          
          RI_BASE_NAME="ri"
- 
          5
          
          RM="rm -f"
- 
          5
          
          RMALL="rm -fr"
- 
          5
          
          RMDIR="rmdir --ignore-fail-on-non-empty"
- 
          5
          
          RMDIRS="rmdir --ignore-fail-on-non-empty -p"
- 
          5
          
          RPATHFLAG=" -Wl,-R%1\$-s"
- 
          5
          
          RUBYW_BASE_NAME="rubyw"
- 
          5
          
          RUBYW_INSTALL_NAME=""
- 
          5
          
          RUBY_BASE_NAME="ruby"
- 
          5
          
          RUBY_INSTALL_NAME="ruby"
- 
          5
          
          RUBY_PROGRAM_VERSION="1.9.3"
- 
          5
          
          RUBY_RELEASE_DATE="2013-02-22"
- 
          5
          
          RUBY_SO_NAME="ruby"
- 
          5
          
          SET_MAKE=""
- 
          5
          
          SHELL="/bin/bash"
- 
          5
          
          SOLIBS="-lpthread -lrt -ldl -lcrypt -lm "
- 
          5
          
          STATIC=""
- 
          5
          
          STRIP="strip -S -x"
- 
          5
          
          SYMBOL_PREFIX=""
- 
          5
          
          TEENY="1"
- 
          5
          
          TEST_RUNNABLE="yes"
- 
          5
          
          THREAD_MODEL="pthread"
- 
          5
          
          TRY_LINK=""
- 
          5
          
          UNIVERSAL_ARCHNAMES=""
- 
          5
          
          UNIVERSAL_INTS=""
- 
          5
          
          USE_RUBYGEMS="YES"
- 
          5
          
          WERRORFLAG="-Werror"
- 
          5
          
          WINDRES=""
- 
          5
          
          arch="x86_64-linux"
- 
          5
          
          archdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/x86_64-linux"
- 
          5
          
          bindir="/usr/local/rvm/rubies/ruby-1.9.3-p392/bin"
- 
          5
          
          build="x86_64-unknown-linux-gnu"
- 
          5
          
          build_alias=""
- 
          5
          
          build_cpu="x86_64"
- 
          5
          
          build_os="linux-gnu"
- 
          5
          
          build_vendor="unknown"
- 
          5
          
          cflags=" -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration"
- 
          5
          
          configure_args=" '--prefix=/usr/local/rvm/rubies/ruby-1.9.3-p392' '--with-zlib-dir=/usr/local/rvm/usr' '--disable-install-doc' '--enable-shared'"
- 
          5
          
          cppflags=""
- 
          5
          
          cxxflags=" -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration"
- 
          5
          
          datadir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share"
- 
          5
          
          datarootdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share"
- 
          5
          
          debugflags="-ggdb"
- 
          5
          
          docdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/doc/ruby"
- 
          5
          
          dvidir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/doc/ruby"
- 
          5
          
          exec="exec"
- 
          5
          
          exec_prefix="/usr/local/rvm/rubies/ruby-1.9.3-p392"
- 
          5
          
          host="x86_64-unknown-linux-gnu"
- 
          5
          
          host_alias=""
- 
          5
          
          host_cpu="x86_64"
- 
          5
          
          host_os="linux-gnu"
- 
          5
          
          host_vendor="unknown"
- 
          5
          
          htmldir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/doc/ruby"
- 
          5
          
          includedir="/usr/local/rvm/rubies/ruby-1.9.3-p392/include"
- 
          5
          
          infodir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/info"
- 
          5
          
          libdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib"
- 
          5
          
          libexecdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/libexec"
- 
          5
          
          localedir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/locale"
- 
          5
          
          localstatedir="/usr/local/rvm/rubies/ruby-1.9.3-p392/var"
- 
          5
          
          mandir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/man"
- 
          5
          
          oldincludedir="/usr/include"
- 
          5
          
          optflags="-O3"
- 
          5
          
          pdfdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/doc/ruby"
- 
          5
          
          prefix="/usr/local/rvm/rubies/ruby-1.9.3-p392"
- 
          5
          
          psdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/doc/ruby"
- 
          5
          
          ridir="/usr/local/rvm/rubies/ruby-1.9.3-p392/share/ri"
- 
          5
          
          ruby_install_name="ruby"
- 
          5
          
          ruby_pc="ruby-1.9.pc"
- 
          5
          
          ruby_version="1.9.1"
- 
          5
          
          rubyhdrdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/include/ruby-1.9.1"
- 
          5
          
          rubylibdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1"
- 
          5
          
          rubylibprefix="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby"
- 
          5
          
          rubyw_install_name=""
- 
          5
          
          sbindir="/usr/local/rvm/rubies/ruby-1.9.3-p392/sbin"
- 
          5
          
          setup="Setup"
- 
          5
          
          sharedstatedir="/usr/local/rvm/rubies/ruby-1.9.3-p392/com"
- 
          5
          
          sitearch="x86_64-linux"
- 
          5
          
          sitearchdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/x86_64-linux"
- 
          5
          
          sitedir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby"
- 
          5
          
          sitehdrdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/include/ruby-1.9.1/site_ruby"
- 
          5
          
          sitelibdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1"
- 
          5
          
          sysconfdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/etc"
- 
          5
          
          target="x86_64-unknown-linux-gnu"
- 
          5
          
          target_alias=""
- 
          5
          
          target_cpu="x86_64"
- 
          5
          
          target_os="linux"
- 
          5
          
          target_vendor="unknown"
- 
          5
          
          topdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/x86_64-linux"
- 
          5
          
          try_header=""
- 
          5
          
          vendorarchdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/vendor_ruby/1.9.1/x86_64-linux"
- 
          5
          
          vendordir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/vendor_ruby"
- 
          5
          
          vendorhdrdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/include/ruby-1.9.1/vendor_ruby"
- 
          5
          
          vendorlibdir="/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/vendor_ruby/1.9.1"
- 
          5
          
          warnflags="-Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration"
 
      
        
      
        
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          __rvm_usage() {
- 
          
          
            __rvm_pager_or_cat_v "${rvm_path:-$HOME/.rvm}/README"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_run_script()
- 
          
          
          {
- 
          14
          
            "$rvm_scripts_path/${1:-"$rvm_action"}" "${rvm_ruby_args[@]}"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_parse_args_find_known_flags()
- 
          
          
          {
- 
          148
          
            typeset _args_array_name _temp_var
- 
          148
          
            typeset -a _new_args
- 
          148
          
            _args_array_name="$1"
- 
          296
          
            (( $# == 0 )) || shift
- 
          148
          
            _new_args=()
- 
          
          
            while
- 
          394
          
              (( $# ))
- 
          
          
            do
- 
          246
          
              case "$1" in
- 
          
          
                (--verify-downloads)
- 
          
          
                  export "rvm_verify_downloads_flag"="${2:-}"
- 
          
          
                  shift
- 
          
          
                  ;;
- 
          
          
                (--force|--verbose|--debug|--quiet|--silent|--create)
- 
          8
          
                  export "rvm_${1#--}_flag=1"
- 
          
          
                  ;;
- 
          
          
                (--only-path)
- 
          
          
                  _temp_var="${1#--}"
- 
          
          
                  export "rvm_${_temp_var//-/_}_flag=1"
- 
          
          
                  ;;
- 
          
          
                (--32)
- 
          
          
                  rvm_architectures="${rvm_architectures:-},i386"
- 
          
          
                  rvm_architectures="${rvm_architectures##,}"
- 
          
          
                  rvm_disable_binary_flag=1
- 
          
          
                  ;;
- 
          
          
                (--64)
- 
          
          
                  rvm_architectures="${rvm_architectures:-},x86_64"
- 
          
          
                  rvm_architectures="${rvm_architectures##,}"
- 
          
          
                  rvm_disable_binary_flag=1
- 
          
          
                  ;;
- 
          
          
                (--universal)
- 
          
          
                  rvm_architectures="${rvm_architectures:-},i386,x86_64"
- 
          
          
                  rvm_architectures="${rvm_architectures##,}"
- 
          
          
                  rvm_disable_binary_flag=1
- 
          
          
                  ;;
- 
          
          
                (--patches|--patch)
- 
          
          
                  export -a rvm_patch_names
- 
          
          
                  __rvm_custom_separated_array rvm_patch_names , "${2:-}"
- 
          
          
                  rvm_patch_original_pwd="$PWD"
- 
          
          
                  rvm_disable_binary_flag=1
- 
          
          
                  shift
- 
          
          
                  ;;
- 
          
          
                (--autolibs=*)
- 
          
          
                  rvm_pretty_print_flag=${rvm_token#--color=}
- 
          
          
                  rvm_token="${rvm_token#--}"
- 
          
          
                  rvm_token="${rvm_token//-/_}"
- 
          
          
                  _string="${rvm_token#*=}"
- 
          
          
                  rvm_token="${rvm_token%%=*}"
- 
          
          
                  export "rvm_${rvm_token}_flag=${_string}"
- 
          
          
                  ;;
- 
          
          
                (--)
- 
          
          
                  shift
- 
          
          
                  _new_args+=( "$@" )
- 
          
          
                  shift $#
- 
          
          
                  ;;
- 
          
          
                (*)
- 
          242
          
                  _new_args+=( "$1" )
- 
          
          
                  ;;
- 
          
          
              esac
- 
          492
          
              (( $# == 0 )) || shift # check in case shifted already
- 
          
          
            done
- 
          296
          
            eval "${_args_array_name}+=( \"\${_new_args[@]}\" )"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_parse_args()
- 
          
          
          {
- 
          273
          
            typeset _string
- 
          273
          
            export rvm_ruby_string
- 
          
          
          - 
          273
          
            rvm_action="${rvm_action:-""}"
- 
          273
          
            rvm_parse_break=0
- 
          
          
          - 
          
          
            if
- 
          273
          
              [[ " $* " =~ " --trace " ]]
- 
          
          
            then
- 
          
          
              echo "$@"
- 
          
          
              __rvm_version
- 
          
          
            fi
- 
          
          
          - 
          
          
            while
- 
          486
          
              [[ -n "$next_token" ]]
- 
          
          
            do
- 
          412
          
              rvm_token="$next_token"
- 
          
          
              if
- 
          412
          
                (( $# > 0 ))
- 
          
          
              then
- 
          299
          
                next_token="$1"
- 
          299
          
                shift
- 
          
          
              else
- 
          113
          
                next_token=""
- 
          
          
              fi
- 
          
          
          - 
          412
          
              case "$rvm_token" in
- 
          
          
          - 
          
          
                [[:alnum:]]*|@*) # Commands, Rubies and Gemsets
- 
          350
          
                  case "$rvm_token" in
- 
          
          
                    use)
- 
          38
          
                      rvm_action="$rvm_token"
- 
          38
          
                      rvm_verbose_flag=1
- 
          
          
                      if
- 
          38
          
                        [[ "ruby" == "$next_token" ]]
- 
          
          
                      then
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    install|uninstall|reinstall|try_install)
- 
          24
          
                      export ${rvm_token}_flag=1
- 
          12
          
                      rvm_action=$rvm_token
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    gemset)
- 
          60
          
                      rvm_action=$rvm_token
- 
          60
          
                      rvm_ruby_gem_home="${GEM_HOME:-""}"
- 
          
          
          - 
          60
          
                      rvm_ruby_args=()
- 
          60
          
                      __rvm_parse_args_find_known_flags rvm_ruby_args  "$next_token" "$@"
- 
          60
          
                      : rvm_ruby_args:${#rvm_ruby_args[@]}:${rvm_ruby_args[*]}:
- 
          60
          
                      next_token="${rvm_ruby_args[__array_start]}"
- 
          60
          
                      rvm_gemset_name="${rvm_ruby_args[__array_start+1]}"
- 
          
          
          - 
          60
          
                      case "${next_token:-help}" in
- 
          
          
                        (help)
- 
          
          
                          true
- 
          
          
                          ;;
- 
          
          
                        (clear)
- 
          
          
                          __rvm_gemset_clear
- 
          
          
                          ;;
- 
          
          
                        (use|delete)
- 
          41
          
                          [[ "delete" != "$next_token" ]] || rvm_delete_flag=1
- 
          31
          
                          [[ "use"    != "$next_token" ]] || rvm_use_flag=1
- 
          
          
          - 
          24
          
                          case "$rvm_gemset_name" in
- 
          
          
                            *${rvm_gemset_separator:-"@"}*)
- 
          
          
                              rvm_ruby_string="${rvm_gemset_name%%${rvm_gemset_separator:-"@"}*}"
- 
          
          
                              rvm_gemset_name="${rvm_gemset_name##*${rvm_gemset_separator:-"@"}}"
- 
          
          
                              if
- 
          
          
                                [[ "${rvm_ruby_string:-""}" != "${rvm_gemset_name:-""}" ]]
- 
          
          
                              then
- 
          
          
                                rvm_ruby_string="$rvm_ruby_string${rvm_gemset_separator:-"@"}$rvm_gemset_name"
- 
          
          
                              fi
- 
          
          
                              rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator:-"@"}$rvm_gemset_name"
- 
          
          
                              ;;
- 
          
          
                            ("")
- 
          
          
                              rvm_error "Gemset was not given.\n  Usage:\n    rvm gemset $rvm_gemset_name <gemsetname>\n"
- 
          
          
                              return 1
- 
          
          
                              ;;
- 
          
          
                          esac
- 
          
          
                          ;;
- 
          
          
                        #~ (*)
- 
          
          
                          #~ # TODO where from do we get the rvm_gemset_name ?
- 
          
          
                          #~ if [[ "${rvm_ruby_string:-""}" != "${rvm_gemset_name:-""}" ]]
- 
          
          
                          #~ then __rvm_ruby_string
- 
          
          
                          #~ fi
- 
          
          
                          #~ ;;
- 
          
          
                      esac
- 
          60
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    gemdir|gempath|gemhome)
- 
          6
          
                      rvm_ruby_args=("$rvm_token")
- 
          6
          
                      rvm_action="gemset"
- 
          6
          
                      rvm_gemdir_flag=1
- 
          
          
                      if
- 
          6
          
                        [[ "system" == "$next_token" ]]
- 
          
          
                      then
- 
          
          
                        rvm_system_flag=1
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                      fi
- 
          
          
                      if
- 
          6
          
                        [[ "user" == "$next_token" ]]
- 
          
          
                      then
- 
          
          
                        rvm_user_flag=1
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    pkg)
- 
          
          
                      rvm_action="$rvm_token"
- 
          
          
                      __rvm_parse_args_find_known_flags rvm_ruby_args  "$next_token" "$@"
- 
          
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    do|exec)
- 
          
          
                      if
- 
          26
          
                        [[ -z "$next_token" ]]
- 
          
          
                      then
- 
          
          
                        rvm_action="error"
- 
          
          
                        rvm_error_message="'rvm $rvm_token' must be followed by arguments."
- 
          
          
                        break
- 
          
          
                      fi
- 
          26
          
                      rvm_action="do"
- 
          26
          
                      rvm_ruby_args=("$next_token" "$@")
- 
          26
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    gem|rake|ruby)
- 
          
          
                      [[ "$rvm_token" == "ruby" ]] &&
- 
          
          
                      case $rvm_action in
- 
          
          
                        install|reinstall|use|remove)
- 
          
          
                          rvm_ruby_string=ruby
- 
          
          
                          rvm_ruby_strings=ruby
- 
          
          
                          continue
- 
          
          
                        ;;
- 
          
          
                      esac
- 
          
          
                      # deprecated 2011.10.11 for RVM 1.9.0, removed 2012.09.13 for RVM 1.16.0
- 
          
          
                      rvm_action=error
- 
          
          
                      rvm_error_message="Please note that \`rvm $rvm_token ...\` was removed, try \`$rvm_token $next_token $*\` or \`rvm all do $rvm_token $next_token $*\` instead."
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer|env|unexport|automount|prepare)
- 
          7
          
                      rvm_action=$rvm_token
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    doctor)
- 
          
          
                      rvm_action=notes
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    mount)
- 
          1
          
                      rvm_action=$rvm_token
- 
          
          
                      while
- 
          1
          
                        [[ -n "${next_token:-}" ]] &&
- 
          
          
                        [[ -x "${next_token:-}" ||
- 
          
          
                          -d "${next_token:-}" ||
- 
          
          
                          "${next_token:-}" =~ ^http ||
- 
          
          
                          "${next_token:-}" =~ tar.bz2$
- 
          4
          
                        ]]
- 
          
          
                      do
- 
          
          
                        rvm_ruby_args=("$next_token" "${rvm_ruby_args[@]}")
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                      done
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    rm|remove)
- 
          3
          
                      rvm_action="remove"
- 
          3
          
                      rvm_remove_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    rtfm|RTFM|rvmrc|usage|help|inspect|list|ls|info|strings|get|current|docs|alias|rubygems|cleanup|tools|disk-usage|snapshot|repair|migrate|downgrade|upgrade|cron|group|switch|which|config-get|requirements)
- 
          88
          
                      case "$rvm_token" in
- 
          
          
                        (downgrade) rvm_action="upgrade" ;;
- 
          
          
                        (ls)    rvm_action="list" ;;
- 
          
          
                        (usage) rvm_action="help" ;;
- 
          
          
                        (RTFM)  rvm_action="rtfm" ;;
- 
          88
          
                        (*)     rvm_action="$rvm_token" ;;
- 
          
          
                      esac
- 
          88
          
                      rvm_ruby_args=()
- 
          88
          
                      __rvm_parse_args_find_known_flags rvm_ruby_args "$next_token" "$@"
- 
          88
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    user)
- 
          
          
                      rvm_action="tools"
- 
          
          
                      rvm_ruby_args=("$rvm_token" "$next_token" "$@")
- 
          
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    load-rvmrc)
- 
          
          
                      rvm_action="rvmrc"
- 
          
          
                      rvm_ruby_args=("load" "$next_token" "$@")
- 
          
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    benchmark|bench)
- 
          
          
                      rvm_action="benchmark"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    specs|tests)
- 
          
          
                      rvm_action="rake"
- 
          
          
                      rvm_ruby_args=("${rvm_token/%ss/s}")
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    export)
- 
          
          
                      if
- 
          2
          
                        [[ -n "$next_token" ]]
- 
          
          
                      then
- 
          2
          
                        rvm_export_args="$next_token$@"
- 
          2
          
                        rvm_action="export"
- 
          2
          
                        rvm_parse_break=1
- 
          
          
                      else
- 
          
          
                        rvm_action="error"
- 
          
          
                        rvm_error_message="rvm export must be followed by a NAME=VALUE argument"
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    alt*)
- 
          
          
                      rvm_action="help"
- 
          
          
                      rvm_ruby_args=("alt.md")
- 
          
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    wrapper)
- 
          22
          
                      rvm_action="wrapper"
- 
          22
          
                      rvm_ruby_string="$next_token" ;
- 
          22
          
                      rvm_wrapper_name="$1"
- 
          40
          
                      (( $# == 0 )) || shift
- 
          22
          
                      rvm_ruby_args=("$@") # list of binaries, or empty
- 
          22
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
                    reboot|damnit|wtf|argh|BOOM|boom|wth)
- 
          
          
                      rvm_action="reboot"
- 
          
          
                      ;;
- 
          
          
                    in)
- 
          
          
                      rvm_token="${next_token}"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      if
- 
          
          
                         __rvm_project_dir_check "$rvm_token"
- 
          
          
                      then
- 
          
          
                        export rvm_in_flag="$rvm_token"
- 
          
          
                        __rvm_rvmrc_tools try_to_read_ruby $rvm_token
- 
          
          
                      else
- 
          
          
                        export "rvm_in_flag"=1
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    *,*)
- 
          1
          
                      rvm_ruby_strings="$rvm_token"
- 
          1
          
                      [[ -n "${rvm_action:-""}" ]] ||
- 
          1
          
                        rvm_action="ruby" # Not sure if we really want to do this but we'll try it out.
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    ${rvm_gemset_separator:-"@"}*)
- 
          1
          
                      rvm_action="${rvm_action:-use}"
- 
          1
          
                      rvm_gemset_name="${rvm_token/*${rvm_gemset_separator:-"@"}/}"
- 
          1
          
                      rvm_ruby_string="${rvm_ruby_string:-""}"
- 
          1
          
                      rvm_ruby_strings="${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    *${rvm_gemset_separator:-"@"}*)
- 
          20
          
                      rvm_action="${rvm_action:-use}"
- 
          20
          
                      rvm_gemset_name="${rvm_token/*${rvm_gemset_separator:-"@"}/}"
- 
          20
          
                      rvm_ruby_string="$rvm_token"
- 
          20
          
                      rvm_ruby_strings="$rvm_token"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    *+*)
- 
          
          
                      rvm_action="${rvm_action:-use}"
- 
          
          
                      rvm_ruby_alias="${rvm_token/*+/}"
- 
          
          
                      rvm_ruby_string="${rvm_token/+*/}"
- 
          
          
                      rvm_ruby_strings="$rvm_ruby_string"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    *-*|+([[:digit:]]).+([[:digit:]])*)
- 
          58
          
                      rvm_action="${rvm_action:-use}"
- 
          58
          
                      rvm_ruby_string="$rvm_token"
- 
          58
          
                      rvm_ruby_strings="$rvm_token"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    opal*|jruby*|ree*|kiji*|macruby*|rbx*|rubinius*|goruby|mruby|ironruby*|default*|maglev*|topaz*|tcs*|jamesgolick*|ruby*|system|default|all)
- 
          5
          
                      rvm_action="${rvm_action:-use}"
- 
          5
          
                      case "$rvm_token" in
- 
          
          
                        (rubinius) rvm_token="rbx" ;;
- 
          
          
                      esac
- 
          5
          
                      rvm_ruby_interpreter="$rvm_token"
- 
          5
          
                      rvm_ruby_string="$rvm_token"
- 
          5
          
                      rvm_ruby_strings="$rvm_token"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    old)
- 
          
          
                      case "${rvm_action:-action-missing}" in
- 
          
          
                        remove)
- 
          
          
                          rvm_ruby_strings="old:${next_token:-}"
- 
          
          
                          next_token="${1:-}"
- 
          
          
                          (( $# == 0 )) || shift
- 
          
          
                          ;;
- 
          
          
                        action-missing)
- 
          
          
                          rvm_error_message="what do you want to do with old rubies? rvm can only remove old rubies."
- 
          
          
                          rvm_action="error"
- 
          
          
                          ;;
- 
          
          
                        *)
- 
          
          
                          rvm_error_message="rvm can not $rvm_action old rubies, rvm can only remove old rubies."
- 
          
          
                          rvm_action="error"
- 
          
          
                          ;;
- 
          
          
                      esac
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    *.rb) # we have a specified ruby script
- 
          
          
                      rvm_ruby_args=("$rvm_token")
- 
          
          
                      rvm_ruby_file="$rvm_token"
- 
          
          
                      if
- 
          
          
                        [[ -z "${rvm_action:-""}" || "$rvm_action" == "use" ]]
- 
          
          
                      then
- 
          
          
                        rvm_action="ruby"
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    *.gems)
- 
          
          
                      rvm_file_name="${rvm_token}"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    ("")
- 
          
          
                      rvm_action="error"
- 
          
          
                      rvm_error_message="Unrecognized command line argument(s): '$@'"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    *)
- 
          
          
                      if
- 
          
          
                        [[ "gemset" == "$rvm_action" ]]
- 
          
          
                      then
- 
          
          
                        rvm_gemset_name="${rvm_token/.gems/}"
- 
          
          
                        rvm_file_name="$rvm_gemset_name.gems"
- 
          
          
                      elif
- 
          
          
                        [[ -f "$rvm_rubies_path/$rvm_token" || -L "$rvm_rubies_path/$rvm_token" ]] # ruby || alias
- 
          
          
                      then
- 
          
          
                        rvm_ruby_string=$rvm_token
- 
          
          
                        rvm_ruby_strings="$rvm_token"
- 
          
          
                        rvm_action="${rvm_action:-use}"
- 
          
          
                      elif
- 
          
          
                        __rvm_project_dir_check "$rvm_token"
- 
          
          
                      then
- 
          
          
                        __rvm_rvmrc_tools try_to_read_ruby $rvm_token
- 
          
          
                      else
- 
          
          
                        rvm_action="error"
- 
          
          
                        rvm_error_message="Unrecognized command line argument: '$rvm_token'"
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
                  esac
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                -*) # Flags
- 
          56
          
                  case "$rvm_token" in
- 
          
          
                    -S)
- 
          
          
                      rvm_action="ruby"
- 
          
          
                      rvm_ruby_args=("$rvm_token" "$next_token" "$@")
- 
          
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -e)
- 
          
          
                      rvm_action="ruby"
- 
          
          
                      IFS="\n"
- 
          
          
                      rvm_ruby_args=("$rvm_token" "'$next_token $@'")
- 
          
          
                      IFS=" "
- 
          
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -v|--version)
- 
          
          
                      if [[ -z "$next_token" ]] ; then
- 
          
          
                        rvm_action="version"
- 
          
          
                      else
- 
          
          
                        rvm_ruby_version="$next_token"
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -n|--name)
- 
          
          
                      rvm_ruby_name="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      #TODO: ??? rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --branch)
- 
          
          
                      rvm_ruby_repo_branch="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --repository|--repo|--url)
- 
          
          
                      rvm_ruby_repo_url="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -r|--remote|--binary|--latest-binary)
- 
          1
          
                      rvm_remote_flag=1
- 
          1
          
                      if [[ "$rvm_token" == "--latest-binary" ]]
- 
          
          
                      then rvm_latest_binary_flag=1
- 
          
          
                      fi
- 
          
          
                      while
- 
          2
          
                        [[ -n "${next_token:-}" ]] &&
- 
          
          
                        [[ "${next_token:-}" =~ ^http ||
- 
          
          
                          "${next_token:-}" =~ tar.bz2$ ||
- 
          
          
                          "${next_token:-}" =~ ":"
- 
          2
          
                        ]]
- 
          
          
                      do
- 
          1
          
                        rvm_ruby_args=("$next_token" "${rvm_ruby_args[@]}")
- 
          1
          
                        next_token="${1:-}"
- 
          1
          
                        (( $# == 0 )) || shift
- 
          
          
                      done
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --ree-options)
- 
          
          
                      if
- 
          
          
                        [[ -n "$next_token" ]]
- 
          
          
                      then
- 
          
          
                        __rvm_custom_separated_array rvm_ree_options , "${next_token}"
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                      else
- 
          
          
                        rvm_action="error"
- 
          
          
                        rvm_error_message="--ree-options *must* be followed by... well... comma,separated,list,of,options."
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --patches|--patch)
- 
          
          
                      export -a rvm_patch_names
- 
          
          
                      __rvm_custom_separated_array rvm_patch_names , "$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      rvm_patch_original_pwd="$PWD"
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --arch|--archflags)
- 
          
          
                      rvm_architectures="${rvm_architectures:-},${next_token#-arch }" ;
- 
          
          
                      rvm_architectures="${rvm_architectures##,}" ;
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --with-arch=*)
- 
          
          
                      rvm_architectures="${rvm_architectures:-},${rvm_token#--with-arch=}" ;
- 
          
          
                      rvm_architectures="${rvm_architectures##,}" ;
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --32)
- 
          
          
                      rvm_architectures="${rvm_architectures:-},i386" ;
- 
          
          
                      rvm_architectures="${rvm_architectures##,}" ;
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --64)
- 
          
          
                      rvm_architectures="${rvm_architectures:-},x86_64" ;
- 
          
          
                      rvm_architectures="${rvm_architectures##,}" ;
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --universal)
- 
          
          
                      rvm_architectures="${rvm_architectures:-},i386,x86_64" ;
- 
          
          
                      rvm_architectures="${rvm_architectures##,}" ;
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --bin)
- 
          
          
                      if
- 
          
          
                        [[ "update" == "${rvm_action:-""}" ]]
- 
          
          
                      then
- 
          
          
                        rvm_bin_flag=1
- 
          
          
                      else
- 
          
          
                        rvm_bin_path="$next_token"
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --rdoc|--yard)
- 
          
          
                      rvm_docs_type="$rvm_token"
- 
          
          
                      rvm_docs_type
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -f|--file)
- 
          
          
                      rvm_action="ruby"
- 
          
          
                      rvm_ruby_file="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --passenger)
- 
          
          
                      rvm_log "NOTE: If you are using Passenger 3 you no longer need the passenger_ruby,\nuse the wrapper script for your ruby instead (see 'rvm wrapper')"
- 
          
          
                      rvm_wrapper_name="${rvm_token/--/}"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --editor)
- 
          
          
                      rvm_wrapper_name="${rvm_token/--/}"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --symlink)
- 
          
          
                      rvm_warn "--symlink has been removed, please see 'rvm wrapper'."
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -h|--help)
- 
          
          
                      rvm_action=help
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -l|--level)
- 
          
          
                      rvm_ruby_patch_level="p$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --sha|--make|--make-install)
- 
          
          
                      rvm_token=${rvm_token#--}
- 
          
          
                      rvm_token=${rvm_token//-/_}
- 
          
          
                      export "rvm_ruby_${rvm_token}"="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --nice|--sdk|--autoconf-flags|--proxy)
- 
          
          
                      rvm_token=${rvm_token#--}
- 
          
          
                      rvm_token=${rvm_token//-/_}
- 
          
          
                      export "rvm_${rvm_token}"="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --disable-llvm|--disable-jit)
- 
          
          
                      rvm_llvm_flag=0
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --enable-llvm|--enable-jit)
- 
          
          
                      rvm_llvm_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --install)
- 
          12
          
                      rvm_install_on_use_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --autolibs=*)
- 
          
          
                      rvm_pretty_print_flag=${rvm_token#--color=}
- 
          
          
                      rvm_token="${rvm_token#--}"
- 
          
          
                      rvm_token="${rvm_token//-/_}"
- 
          
          
                      _string="${rvm_token#*=}"
- 
          
          
                      rvm_token="${rvm_token%%=*}"
- 
          
          
                      export "rvm_${rvm_token}_flag=${_string}"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --color=*)
- 
          
          
                      rvm_pretty_print_flag=${rvm_token#--color=}
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --pretty)
- 
          
          
                      rvm_pretty_print_flag=auto
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --1.8|--1.9|--18|--19)
- 
          
          
                      rvm_token=${rvm_token#--}
- 
          
          
                      rvm_token=${rvm_token//\./}
- 
          
          
                      export "rvm_${rvm_token}_flag"=1
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --rvmrc|--versions-conf|--ruby-version)
- 
          2
          
                      rvm_token=${rvm_token#--}
- 
          2
          
                      rvm_token=${rvm_token//-/_}
- 
          4
          
                      export rvm_rvmrc_flag="${rvm_token}"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --head|--static)
- 
          
          
                      rvm_token=${rvm_token#--}
- 
          
          
                      rvm_token=${rvm_token//-/_}
- 
          
          
                      export "rvm_${rvm_token}_flag"=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --self|--gem|--reconfigure|--default|--force|--export|--summary|--latest|--yaml|--json|--archive|--shebang|--env|--path|--cron|--tail|--delete|--verbose|--import|--sticky|--create|--gems|--docs|--skip-autoreconf|--force-autoconf|--auto|--autoinstall-bundler|--disable-binary|--ignore-gemsets|--skip-gemsets|--debug|--quiet|--silent|--skip-openssl|--fuzzy)
- 
          38
          
                      rvm_token=${rvm_token#--}
- 
          38
          
                      rvm_token=${rvm_token//-/_}
- 
          76
          
                      export "rvm_${rvm_token}_flag"=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --rubygems)
- 
          
          
                      rvm_token=${rvm_token#--}
- 
          
          
                      rvm_token=${rvm_token//-/_}
- 
          
          
                      export "rvm_${rvm_token}_version"="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --dump-environment|--verify-downloads)
- 
          
          
                      rvm_token=${rvm_token#--}
- 
          
          
                      rvm_token=${rvm_token//-/_}
- 
          
          
                      export "rvm_${rvm_token}_flag"="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --clang)
- 
          
          
                      export CC=clang
- 
          
          
                      #TODO: ??? rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -M)
- 
          
          
                      if
- 
          
          
                        [[ -n "$next_token" ]]
- 
          
          
                      then
- 
          
          
                        __rvm_custom_separated_array rvm_make_flags , "${next_token}"
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                        rvm_disable_binary_flag=1
- 
          
          
                      else
- 
          
          
                        rvm_action="error"
- 
          
          
                        rvm_error_message="--make *must* be followed by make flags."
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -j)
- 
          
          
                      if
- 
          2
          
                        [[ -n "$next_token" ]]
- 
          
          
                      then
- 
          2
          
                        rvm_make_flags+=( -j$next_token )
- 
          2
          
                        next_token="${1:-}"
- 
          2
          
                        (( $# == 0 )) || shift
- 
          
          
                      else
- 
          
          
                        rvm_action="error"
- 
          
          
                        rvm_error_message="-j *must* be followed by an integer (normally the # of CPU's in your machine)."
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --with-rubies)
- 
          
          
                      rvm_ruby_strings="$next_token"
- 
          
          
                      next_token="${1:-}"
- 
          
          
                      (( $# == 0 )) || shift
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    -C|--configure)
- 
          
          
                      if
- 
          
          
                        [[ -n "$next_token" ]]
- 
          
          
                      then
- 
          
          
                        __rvm_custom_separated_array rvm_configure_flags , "${next_token}"
- 
          
          
                        next_token="${1:-}"
- 
          
          
                        (( $# == 0 )) || shift
- 
          
          
                        rvm_disable_binary_flag=1
- 
          
          
                      else
- 
          
          
                        rvm_action="error"
- 
          
          
                        rvm_error_message="--configure *must* be followed by configure flags."
- 
          
          
                      fi
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --movable)
- 
          
          
                      rvm_make_flags+=( -j3 )
- 
          
          
                      rvm_configure_flags+=( --enable-load-relative --sysconfdir=/etc )
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --with-*|--without-*|--enable-*|--disable-*)
- 
          
          
                      rvm_configure_flags+=( "$rvm_token" )
- 
          
          
                      rvm_disable_binary_flag=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --trace)
- 
          
          
                      export rvm_trace_flag=1
- 
          
          
                      set -o xtrace
- 
          
          
                      [[ -n "${ZSH_VERSION:-""}" ]] ||
- 
          
          
                      {
- 
          
          
                        set -o errtrace
- 
          
          
                        export PS4="+ \$(date \"+%s.%N\") \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()}  \${LINENO} > "
- 
          
          
                      }
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    --)
- 
          1
          
                      if [[ "${rvm_action}" == *install ]]
- 
          
          
                      then rvm_configure_flags+=( "$next_token" "$@" )
- 
          1
          
                      else rvm_ruby_args=( "$next_token" "$@" )
- 
          
          
                      fi
- 
          1
          
                      rvm_disable_binary_flag=1
- 
          1
          
                      rvm_parse_break=1
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    *)
- 
          
          
                      rvm_action="error"
- 
          
          
                      rvm_error_message="Unrecognized command line flag: '$rvm_token'"
- 
          
          
                  esac
- 
          
          
          - 
          
          
                  ;;
- 
          
          
          - 
          
          
                *)
- 
          
          
                  if
- 
          6
          
                    __rvm_project_dir_check "$rvm_token"
- 
          
          
                  then
- 
          6
          
                    __rvm_rvmrc_tools try_to_read_ruby "$rvm_token"
- 
          
          
                  else
- 
          
          
                    rvm_action="error"
- 
          
          
                    rvm_error_message="Unrecognized command line argument(s): '$rvm_token $@'"
- 
          
          
                  fi
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
          - 
          426
          
              if [[ -z "${rvm_action:-""}" && -n "${rvm_ruby_string:-""}" ]]
- 
          
          
              then rvm_action="use"
- 
          
          
              fi
- 
          1037
          
              if [[ "error" == "${rvm_action:-""}" || ${rvm_parse_break:-0} -eq 1 || -n "${rvm_error_message:-""}" ]]
- 
          199
          
              then break
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          - 
          273
          
          : rvm_ruby_args:${#rvm_ruby_args[@]}:${rvm_ruby_args[*]}:
- 
          
          
            if
- 
          273
          
              [[ -n "${rvm_error_message:-""}" ]]
- 
          
          
            then
- 
          
          
              rvm_error "$rvm_error_message ( see: 'rvm usage' )"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_run_wrapper()
- 
          
          
          ( # ( = subprocess
- 
          4
          
            file="$1"
- 
          4
          
            action="${2:-}"
- 
          4
          
            shift 2
- 
          4
          
            rubies_string="${1:-}"
- 
          4
          
            export -a args
- 
          4
          
            args=( $@ )
- 
          4
          
            source "$rvm_scripts_path"/$file
- 
          
          
          )
- 
          
          
          - 
          
          
          rvm()
- 
          
          
          {
- 
          
          
            if
- 
          273
          
              __rvm_has_opt "posix"
- 
          
          
            then
- 
          
          
              echo "RVM can not be run with \`set -o posix\`, please turn it off and try again."
- 
          
          
              return 100
- 
          
          
            fi
- 
          
          
          - 
          273
          
            typeset result current_result
- 
          273
          
            export -a rvm_ruby_args >/dev/null 2>/dev/null
- 
          273
          
            rvm_ruby_args=()
- 
          
          
          - 
          
          
            if
- 
          273
          
              (( ${rvm_ignore_rvmrc:=0} == 0 ))
- 
          
          
            then
- 
          1006
          
              [[ -n "${rvm_stored_umask:-}" ]] || export rvm_stored_umask=$(umask)
- 
          262
          
              rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
- 
          
          
              if
- 
          262
          
                [[ -n "${rvm_prefix:-}" ]] &&
- 
          262
          
                [[ ! "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
- 
          
          
              then
- 
          262
          
                rvm_rvmrc_files+=( "${rvm_prefix}/.rvmrc" )
- 
          
          
              fi
- 
          786
          
              for rvmrc in "${rvm_rvmrc_files[@]}"
- 
          
          
              do
- 
          
          
                if
- 
          786
          
                  [[ -f "$rvmrc" ]]
- 
          
          
                then
- 
          
          
                  if
- 
          524
          
                    GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
- 
          
          
                  then
- 
          
          
                    printf "%b" "
- 
          
          
          Error:
- 
          
          
                  $rvmrc is for rvm settings only.
- 
          
          
                  rvm CLI may NOT be called from within $rvmrc.
- 
          
          
                  Skipping the loading of $rvmrc"
- 
          
          
                    return 1
- 
          
          
                  else
- 
          262
          
                    source "$rvmrc"
- 
          
          
                  fi
- 
          
          
                fi
- 
          
          
              done
- 
          262
          
              unset rvm_rvmrc_files
- 
          
          
            fi
- 
          
          
          - 
          819
          
            disk_version="$(cat "$rvm_path/VERSION") ($(cat "$rvm_path/RELEASE" 2>/dev/null))"
- 
          
          
            if
- 
          
          
              [[ -s "$rvm_path/VERSION" &&
- 
          
          
                "${rvm_version:-}" != "${disk_version:-}" &&
- 
          
          
                "reload" != "${1:-}"
- 
          546
          
              ]]
- 
          
          
            then
- 
          
          
              if
- 
          
          
                (( ${rvm_auto_reload_flag:-0} ))
- 
          
          
              then
- 
          
          
                __rvm_project_rvmrc_lock=0
- 
          
          
                rvm_reload_flag=1
- 
          
          
                source "${rvm_scripts_path:-${rvm_path}/scripts}/rvm"
- 
          
          
              else
- 
          
          
                printf "%b" "
- 
          
          
          A RVM version ${disk_version} is installed yet ${rvm_version} is loaded.
- 
          
          
          Please do one of the following:
- 
          
          
            * 'rvm reload'
- 
          
          
            * open a new shell
- 
          
          
            * 'echo rvm_auto_reload_flag=1 >> ~/.rvmrc' # for auto reload with msg.
- 
          
          
            * 'echo rvm_auto_reload_flag=2 >> ~/.rvmrc' # for silent auto reload.
- 
          
          
          - 
          
          
          "
- 
          
          
                return 1
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          273
          
            __rvm_initialize
- 
          273
          
            __rvm_setup
- 
          
          
          - 
          273
          
            next_token="$1"
- 
          546
          
            (( $# == 0 )) || shift
- 
          273
          
            __rvm_parse_args "$@"
- 
          273
          
            (( rvm_trace_flag == 0 )) ||
- 
          
          
            {
- 
          
          
              export PS4
- 
          
          
              if [[ -n "$ZSH_VERSION" ]]
- 
          
          
              then PS4="%F{red}%x:%I %F{green}%N:%i%F{white} %_"
- 
          
          
              else PS4="+ \$(date \"+%s.%N\") \${BASH_SOURCE##\${rvm_path:-}} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()}  \${LINENO} > "
- 
          
          
              fi
- 
          
          
              set -x
- 
          
          
            }
- 
          273
          
            result=$?
- 
          273
          
          : rvm_ruby_args:${#rvm_ruby_args[@]}:${rvm_ruby_args[*]}:
- 
          
          
          - 
          273
          
            (( result )) ||
- 
          273
          
            case "${rvm_action:=usage}" in
- 
          
          
              use)
- 
          46
          
                if rvm_is_a_shell_function
- 
          45
          
                then __rvm_use
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              switch)
- 
          
          
                if rvm_is_a_shell_function
- 
          
          
                then __rvm_switch "${rvm_ruby_args[@]}"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              srcdir)
- 
          
          
                __rvm_source_dir
- 
          
          
                ;;
- 
          
          
              inspect|usage|strings|version)
- 
          
          
                __rvm_${rvm_action}
- 
          
          
                ;;
- 
          
          
              ls|list)
- 
          5
          
                "$rvm_scripts_path/list" "${rvm_ruby_args[@]}"
- 
          
          
                ;;
- 
          
          
              # TODO: Make debug run in the current environment, issues with not exported vars.
- 
          
          
              debug)
- 
          
          
                rvm_is_not_a_shell_function="${rvm_is_not_a_shell_function}" "$rvm_scripts_path/info" '' debug
- 
          
          
                ;;
- 
          
          
              info)
- 
          
          
                rvm_is_not_a_shell_function="${rvm_is_not_a_shell_function}" "$rvm_scripts_path/${rvm_action}" "${rvm_ruby_args[@]}"
- 
          
          
                ;;
- 
          
          
              benchmark|reset)
- 
          1
          
                source "$rvm_scripts_path/functions/${rvm_action}"
- 
          1
          
                __rvm_${rvm_action}
- 
          
          
                ;;
- 
          
          
              update)
- 
          
          
                printf "%b" "ERROR: rvm update has been removed. See 'rvm get' and rvm 'rubygems' CLI API instead\n"
- 
          
          
                ;;
- 
          
          
              reboot)
- 
          
          
                source "$rvm_scripts_path/functions/cleanup"
- 
          
          
                __rvm_reboot
- 
          
          
                ;;
- 
          
          
              implode|seppuku)
- 
          
          
                source "$rvm_scripts_path/functions/implode"
- 
          
          
                __rvm_implode
- 
          
          
                ;;
- 
          
          
          - 
          
          
              get)
- 
          
          
                next_token="${1:-}"
- 
          
          
                (( $# == 0 )) || shift
- 
          
          
                [[ "$next_token" == "${rvm_action}" ]] && shift
- 
          
          
          - 
          
          
                tmpdir="${TMPDIR:-/tmp}"
- 
          
          
                \cp -f "$rvm_scripts_path/get" "$tmpdir/$$"
- 
          
          
                if
- 
          
          
                  bash "$tmpdir/$$" "${rvm_ruby_args[@]}"
- 
          
          
                then
- 
          
          
                  rvm_reload_flag=1
- 
          
          
                else
- 
          
          
                  rvm_error "Could not update RVM, get some help at #rvm IRC channel at freenode servers."
- 
          
          
                fi
- 
          
          
                \rm -f $tmpdir/$$
- 
          
          
                ;;
- 
          
          
          - 
          
          
              current)
- 
          36
          
                __rvm_env_string
- 
          
          
                ;;
- 
          
          
          - 
          
          
              help|rtfm|env|list|monitor|notes|pkg|requirements)
- 
          3
          
                next_token="${1:-}"
- 
          6
          
                (( $# == 0 )) || shift
- 
          5
          
                if (( $# )) && [[ "$next_token" == "${rvm_action}" ]] #TODO why is this check here ???
- 
          
          
                then shift
- 
          
          
                fi
- 
          3
          
                "$rvm_scripts_path/${rvm_action}" "${rvm_ruby_args[@]}"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              cleanup|tools|snapshot|disk-usage|repair|alias|docs|rubygems|migrate|cron|group)
- 
          14
          
                __rvm_run_script "$rvm_action" "${rvm_ruby_args[@]}"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              upgrade)
- 
          
          
                __rvm_run_wrapper upgrade "$rvm_action" "${rvm_ruby_args[@]}"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              wrapper)
- 
          22
          
                "$rvm_scripts_path/wrapper" "$rvm_ruby_string" "$rvm_wrapper_name" "${rvm_ruby_args[@]}"
- 
          22
          
                result=$?
- 
          22
          
                unset rvm_wrapper_name
- 
          
          
                ;;
- 
          
          
          - 
          
          
              do)
- 
          26
          
                old_rvm_ruby_string=${rvm_ruby_string:-}
- 
          26
          
                unset rvm_ruby_string
- 
          26
          
                export rvm_ruby_strings
- 
          
          
          - 
          
          
                (
- 
          26
          
                  if [[ -n "${rvm_in_flag}" && -d "${rvm_in_flag}" ]]
- 
          
          
                  then __rvm_cd "${rvm_in_flag}"
- 
          
          
                  fi
- 
          26
          
                  "$rvm_scripts_path/set" "$rvm_action" "${rvm_ruby_args[@]}"
- 
          
          
                )
- 
          26
          
                result=$?
- 
          
          
          - 
          
          
                # Restore the state pre-sets.
- 
          50
          
                [[ -n "$old_rvm_ruby_string" ]] && rvm_ruby_string=$old_rvm_ruby_string
- 
          
          
          - 
          26
          
                unset old_rvm_ruby_string
- 
          
          
                ;;
- 
          
          
          - 
          
          
              rvmrc)
- 
          33
          
                __rvm_rvmrc_tools "${rvm_ruby_args[@]}"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              config-get)
- 
          
          
                typeset __ruby __var
- 
          
          
                __ruby=$( which ruby )
- 
          
          
                for __var in "${rvm_ruby_args[@]}"
- 
          
          
                do
- 
          
          
                  __rvm_ruby_config_get "${__var}" "${__ruby}"
- 
          
          
                done
- 
          
          
                ;;
- 
          
          
          - 
          
          
              gemset)
- 
          
          
                if
- 
          66
          
                  [[ ${rvm_use_flag:-0} -eq 1 ]]
- 
          
          
                then
- 
          7
          
                  if rvm_is_a_shell_function
- 
          7
          
                  then __rvm_gemset_use
- 
          
          
                  fi
- 
          
          
                else
- 
          59
          
                  export rvm_ruby_strings
- 
          59
          
                  "$rvm_scripts_path/gemsets" "${rvm_ruby_args[@]}"
- 
          59
          
                  result=$?
- 
          59
          
                  rvm_ruby_strings=""
- 
          
          
                  if
- 
          59
          
                    rvm_is_a_shell_function no_warning
- 
          
          
                  then
- 
          
          
                    # Clear the gemset.
- 
          
          
                    if
- 
          52
          
                      [[ ${rvm_delete_flag:-0} -eq 1 ]]
- 
          
          
                    then
- 
          
          
                      if
- 
          15
          
                        [[ "${GEM_HOME:-""}" == "${GEM_HOME%%${rvm_gemset_separator:-@}*}${rvm_gemset_separator:-@}${rvm_gemset_name}" ]]
- 
          
          
                      then
- 
          5
          
                        rvm_delete_flag=0
- 
          5
          
                        __rvm_use "@default"
- 
          
          
                      fi
- 
          15
          
                      unset gem_prefix
- 
          
          
                    elif
- 
          37
          
                      [[ "${rvm_ruby_args[*]}" =~ ^rename ]]
- 
          
          
                    then
- 
          1
          
                      typeset _command _from _to
- 
          1
          
                      read _command _from _to <<<"${rvm_ruby_args[*]}"
- 
          
          
                      if
- 
          1
          
                        [[ "${GEM_HOME:-""}" == "${GEM_HOME%%${rvm_gemset_separator:-@}*}${rvm_gemset_separator:-@}${_from}" ]]
- 
          
          
                      then
- 
          1
          
                        __rvm_use "@${_to}"
- 
          
          
                      fi
- 
          
          
                    fi
- 
          
          
                  fi
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              reload)
- 
          
          
                rvm_reload_flag=1
- 
          
          
                ;;
- 
          
          
          - 
          
          
              tests|specs)
- 
          
          
                rvm_action="rake"
- 
          
          
                __rvm_do
- 
          
          
                ;;
- 
          
          
          - 
          
          
              remove)
- 
          3
          
                export rvm_path
- 
          3
          
                if [[ -n "${rvm_ruby_strings}" ]]
- 
          3
          
                then __rvm_run_wrapper manage "$rvm_action" "${rvm_ruby_strings//*-- }"
- 
          
          
                else __rvm_run_wrapper manage "$rvm_action"
- 
          
          
                fi
- 
          3
          
                __rvm_use default
- 
          
          
                ;;
- 
          
          
              fetch|uninstall|reinstall)
- 
          
          
                export rvm_path
- 
          
          
                if [[ -n "${rvm_ruby_strings}" ]]
- 
          
          
                then __rvm_run_wrapper manage "$rvm_action" "${rvm_ruby_strings//*-- }"
- 
          
          
                else __rvm_run_wrapper manage "$rvm_action"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              try_install|install)
- 
          12
          
                export rvm_path
- 
          12
          
                if [[ -n "${rvm_ruby_strings}" ]]
- 
          
          
                then
- 
          12
          
                  typeset save_ruby
- 
          36
          
                  selected_ruby="$( __rvm_select && echo $rvm_env_string )"
- 
          
          
                  if
- 
          12
          
                    [[ -z "${selected_ruby}" ]]
- 
          
          
                  then
- 
          
          
                    rvm_error "Could not detect ruby version/name for installation, please be more specific."
- 
          
          
                    false #report error
- 
          
          
                  elif
- 
          12
          
                    (( ${rvm_force_flag:-0} == 0 )) &&
- 
          36
          
                    "$rvm_scripts_path"/list strings | GREP_OPTIONS="" \grep "^${selected_ruby%${rvm_gemset_separator:-'@'}*}$" > /dev/null
- 
          
          
                  then
- 
          
          
                    rvm_log "Already installed ${selected_ruby%${rvm_gemset_separator:-'@'}*}.
- 
          
          
          To reinstall use:
- 
          
          
          - 
          
          
              rvm reinstall ${rvm_ruby_strings}
- 
          11
          
          "
- 
          
          
                  else
- 
          1
          
                    __rvm_run_wrapper manage install "${rvm_ruby_strings}"
- 
          
          
                  fi
- 
          
          
                else
- 
          
          
                  rvm_error "Can not use or install 'all' rubies."
- 
          
          
                  false #report error
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              mount|automount|prepare)
- 
          2
          
                "${rvm_scripts_path}/external" "$rvm_action" "$rvm_ruby_string" "${rvm_ruby_args[@]}"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              export)
- 
          2
          
                __rvm_export "$rvm_export_args"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              unexport)
- 
          2
          
                __rvm_unset_exports
- 
          
          
                ;;
- 
          
          
          - 
          
          
              error)
- 
          
          
                false
- 
          
          
                ;;
- 
          
          
          - 
          
          
              answer)
- 
          
          
                source "$rvm_scripts_path/functions/fun"
- 
          
          
                __rvm_Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything ; result=42
- 
          
          
                ;;
- 
          
          
          - 
          
          
              question)
- 
          
          
                source "$rvm_scripts_path/functions/fun"
- 
          
          
                __rvm_ultimate_question ; result=42
- 
          
          
                ;;
- 
          
          
          - 
          
          
              which)
- 
          
          
                __rvm_which "${rvm_ruby_args[@]}"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              *)
- 
          
          
                rvm_error "unknown action '$rvm_action'"
- 
          
          
                false # result
- 
          
          
                ;;
- 
          
          
            esac
- 
          273
          
            current_result=$? # Use the result of first found error
- 
          526
          
            (( result )) || result=${current_result}
- 
          
          
          - 
          273
          
            (( result )) ||
- 
          284
          
            case "$rvm_action" in
- 
          
          
              reinstall|try_install|install)
- 
          
          
                if
- 
          36
          
                  [[ $(find $rvm_rubies_path -maxdepth 1 -mindepth 1 -type d 2>/dev/null | wc -l) -eq 1 ]] &&
- 
          
          
                  [[ ! -f "${rvm_environments_path}/default" ]] &&
- 
          
          
                  rvm_is_a_shell_function no_warning
- 
          
          
                then
- 
          
          
                  rvm_log ""
- 
          
          
                  rvm_verbose_flag=0 rvm_default_flag=1 __rvm_use
- 
          
          
                fi
- 
          
          
              ;;
- 
          
          
            esac
- 
          273
          
            current_result=$? # Use the result of first found error
- 
          521
          
            (( result )) || result=${current_result}
- 
          
          
          - 
          273
          
            typeset __local_rvm_trace_flag
- 
          273
          
            __local_rvm_trace_flag=${rvm_trace_flag:-0}
- 
          
          
          - 
          
          
            if
- 
          273
          
              [[ ${rvm_reload_flag:-0} -eq 1 ]]
- 
          
          
            then
- 
          
          
              if
- 
          
          
                [[ -s "$rvm_scripts_path/rvm" ]]
- 
          
          
               then
- 
          
          
                __rvm_project_rvmrc_lock=0
- 
          
          
                source "$rvm_scripts_path/rvm"
- 
          
          
              else
- 
          
          
                echo "rvm not found in $rvm_path, please install and run 'rvm reload'"
- 
          
          
                __rvm_teardown
- 
          
          
              fi
- 
          
          
            else
- 
          273
          
              __rvm_teardown
- 
          
          
            fi
- 
          
          
          - 
          273
          
            if (( __local_rvm_trace_flag > 0 ))
- 
          
          
            then
- 
          
          
              set +o verbose
- 
          
          
              set +o xtrace
- 
          
          
              [[ -n "${ZSH_VERSION:-""}" ]] || set +o errtrace
- 
          
          
            fi
- 
          
          
          - 
          273
          
            return ${result:-0}
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          # set colors, separate multiple selections with comma, order is not important
- 
          
          
          # using bold in one definition requires resetting it in others with offbold
- 
          
          
          # using background in one color requires resetting it in others with bdefault
- 
          
          
          # example:
- 
          
          
          #   rvm_error_color=bold,red
- 
          
          
          #   rvm_notify_color=offbold,green
- 
          
          
          - 
          5
          
          case "${TERM:-dumb}" in
- 
          
          
            (dumb|unknown) exit 0 ;;
- 
          
          
          esac
- 
          10
          
          builtin command -v tput >/dev/null && tput sgr0 >/dev/null || exit 0
- 
          
          
          - 
          5
          
          for color in ${1//,/ }
- 
          
          
          do
- 
          5
          
            case "${color:-}" in
- 
          
          
              # regular colors
- 
          
          
              black)    tput setaf 0
- 
          
          
                ;;
- 
          1
          
              red)      tput setaf 1
- 
          
          
                ;;
- 
          1
          
              green)    tput setaf 2
- 
          
          
                ;;
- 
          1
          
              yellow)   tput setaf 3
- 
          
          
                ;;
- 
          
          
              blue)     tput setaf 4
- 
          
          
                ;;
- 
          1
          
              magenta)  tput setaf 5
- 
          
          
                ;;
- 
          
          
              cyan)     tput setaf 6
- 
          
          
                ;;
- 
          
          
              white)    tput setaf 7
- 
          
          
                ;;
- 
          
          
          - 
          
          
              # emphasized (bolded) colors
- 
          
          
              bold)     tput smso
- 
          
          
                ;;
- 
          
          
              offbold)  tput rmso
- 
          
          
                ;;
- 
          
          
          - 
          
          
              # background colors
- 
          
          
              bblack)   tput setab 0
- 
          
          
                ;;
- 
          
          
              bred)     tput setab 1
- 
          
          
                ;;
- 
          
          
              bgreen)   tput setab 2
- 
          
          
                ;;
- 
          
          
              byellow)  tput setab 3
- 
          
          
                ;;
- 
          
          
              bblue)    tput setab 4
- 
          
          
                ;;
- 
          
          
              bmagenta) tput setab 5
- 
          
          
                ;;
- 
          
          
              bcyan)    tput setab 6
- 
          
          
                ;;
- 
          
          
              bwhite)   tput setab 7
- 
          
          
                ;;
- 
          
          
          - 
          
          
              # Defaults
- 
          
          
              default)  tput setaf 9
- 
          
          
                ;;
- 
          
          
              bdefault) tput setab 9
- 
          
          
                ;;
- 
          
          
              # Reset
- 
          1
          
              *)        tput sgr0
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          done
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          usage()
- 
          
          
          {
- 
          
          
            printf "%b" "
- 
          
          
          - 
          
          
            Usage:
- 
          
          
          - 
          
          
              db database_file {{key}} {{value}} # set
- 
          
          
              db database_file {{key}}           # get
- 
          
          
              db database_file {{key}} unset     # unset
- 
          
          
          - 
          
          
          " >&2
- 
          
          
          }
- 
          
          
          - 
          1027
          
          if [[ -f "$1" ]]
- 
          
          
          then
- 
          1027
          
            database_file="$1"
- 
          1027
          
            shift
- 
          1027
          
            if [[ ! -f "$database_file" ]]
- 
          
          
            then
- 
          
          
              directory=$(dirname "$database_file")
- 
          
          
          - 
          
          
              [[ -d "$directory" ]] || mkdir -p "$directory"
- 
          
          
          - 
          
          
              touch "$database_file"
- 
          
          
            fi
- 
          
          
          else
- 
          
          
            printf "%b" "\n\nDatabase file $1 does not exist.\n\n" >&2
- 
          
          
            exit 1
- 
          
          
          fi
- 
          
          
          - 
          1027
          
          key="$1"
- 
          1027
          
          shift
- 
          
          
          - 
          1027
          
          if [[ -z "$key" ]]
- 
          
          
          then
- 
          
          
            usage
- 
          
          
            exit 1
- 
          
          
          else
- 
          1027
          
            if (( ${escape_flag:-0} ))
- 
          
          
            then
- 
          3054
          
              escaped_key="$(\printf "%b" "$key" | \sed -e 's#\\#\\#g' -e 's#/#\\/#g' -e 's#\.#\.#g')"
- 
          
          
            else
- 
          9
          
              escaped_key="$key"
- 
          
          
            fi
- 
          
          
          - 
          1027
          
            value="$*"
- 
          
          
          - 
          2054
          
            if [[ "unset" == "$value" || "delete" == "$value" ]]
- 
          
          
            then
- 
          22
          
              \sed -e "s#^$escaped_key=.*\$##"  -e '/^$/d' "$database_file" \
- 
          
          
                > "$database_file.new"
- 
          
          
          - 
          22
          
              \mv -f "$database_file.new" "$database_file"
- 
          
          
            else
- 
          1005
          
              if [[ -z "$value" ]]
- 
          
          
              then # get
- 
          989
          
                [[ -s "${database_file}" ]] || exit 0 # File is empty, nothing to get.
- 
          
          
          - 
          989
          
                \awk -F= '/^'"$escaped_key"'=/' "$database_file" \
- 
          989
          
                  | \sed -e "s#^$escaped_key=##" -e '/^$/d'
- 
          
          
              else # set
- 
          16
          
                \sed -e "s#^$escaped_key=.*\$##" -e '/^$/d' "$database_file" > "$database_file.new"
- 
          
          
          - 
          16
          
                \mv -f "$database_file.new" "$database_file"
- 
          
          
          - 
          32
          
                if [[ -z "$(awk -F= "/^'"$escaped_key"'=/{print $2}" "$database_file")" ]]
- 
          
          
                then # append
- 
          16
          
                  echo "$escaped_key=$value" >> "$database_file"
- 
          
          
                else # overwrite
- 
          
          
                  __rvm_sed_i "$dtabase_file" -e "s#^$escaped_key=.*\$#$escaped_key=$value#"
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          fi
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          3
          
          source "$rvm_scripts_path/base"
- 
          
          
          - 
          6
          
          environment_file_path="$rvm_environments_path/$(__rvm_env_string)"
- 
          
          
          # Echo the path or environment file.
- 
          
          
          if
- 
          5
          
            [[ "$rvm_path_flag" == "1" || "$*" =~ "--path" ]]
- 
          
          
          then
- 
          2
          
            echo "$environment_file_path"
- 
          
          
          elif
- 
          2
          
            [[ "$rvm_cron_flag" == "1" || "$*" =~ "--cron" ]]
- 
          
          
          then
- 
          
          
            cat "$environment_file_path" |
- 
          
          
              GREP_OPTIONS="" \grep -Eo "[^ ]+=[^;]+" |
- 
          
          
              sed -e 's/\$PATH/'"${PATH//\//\/}"'/' -e 's/\${PATH}/'"${PATH//\//\/}"'/'
- 
          
          
          else
- 
          1
          
            cat "$environment_file_path"
- 
          
          
          fi
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          2
          
          url="$1"
- 
          2
          
          archive="$2"
- 
          
          
          - 
          2
          
          shift ||
- 
          
          
            rvm_fail "BUG: $0 called without an argument :/"
- 
          
          
          - 
          2
          
          builtin command -v curl > /dev/null ||
- 
          
          
            rvm_fail "rvm requires curl. curl was not found in your current PATH."
- 
          
          
          - 
          2
          
          rvm_base_except="selector"
- 
          2
          
          source "$rvm_scripts_path/base"
- 
          
          
          - 
          
          
          # handled by teardown - scripts/functions/environment:314
- 
          
          
          __rvm_cleanup_download()
- 
          
          
          {
- 
          
          
            [[ -f "$archive" ]] && __rvm_rm_rf "$archive"
- 
          
          
          }
- 
          
          
          - 
          2
          
          __rvm_cd "$rvm_archives_path"
- 
          
          
          - 
          4
          
          [[ -n "$archive" ]] || archive=$(basename "$url")
- 
          2
          
          fetch_command="curl ${rvm_proxy:+-x}${rvm_proxy:-} -f -L --create-dirs -C - -o ${archive}"
- 
          
          
          if
- 
          2
          
            (( ${rvm_debug_flag:-0} == 0 )) &&
- 
          2
          
            (( ${rvm_trace_flag:-0} == 0 )) &&
- 
          2
          
            rvm_is_a_shell_function no_warning
- 
          
          
          then
- 
          2
          
            fetch_command+=" --progress-bar"
- 
          
          
          fi
- 
          2
          
          rvm_debug "Fetching: $url"
- 
          2
          
          rvm_debug "Fetch command: $fetch_command"
- 
          
          
          - 
          2
          
          download=1
- 
          2
          
          try_ftp=0
- 
          2
          
          result=0
- 
          2
          
          retry=0
- 
          
          
          - 
          2
          
          __rvm_checksum_read "$url" "$archive"
- 
          
          
          - 
          2
          
          __rvm_checksum_any || (( ${rvm_verify_downloads_flag:-0} > 0 )) ||
- 
          
          
            rvm_fail "There is no checksum for '$url' or '$archive', it's not possible to validate it.
- 
          
          
          This could be because your RVM install's list of versions is out of date. You may want to
- 
          
          
          update your list of rubies by running 'rvm get stable' and try again.
- 
          
          
          If that does not resolve the issue and you wish to continue with unverified download
- 
          
          
          add '--verify-downloads 1' after the command.
- 
          
          
          "
- 
          
          
          - 
          
          
          if
- 
          2
          
            [[ -e "$archive" ]]
- 
          
          
          then
- 
          
          
            # Check first if we have the correct archive
- 
          
          
            if
- 
          2
          
              __rvm_checksum_validate_file "$rvm_archives_path/${archive}"
- 
          
          
            then
- 
          2
          
              rvm_debug "Archive checksum matched, not downloading"
- 
          2
          
              download=0
- 
          
          
            else
- 
          
          
              case $? in
- 
          
          
                (1) rvm_warn "Archive checksum not found, downloading again." ;;
- 
          
          
                (*) rvm_warn "Archive checksum did not match, downloading again." ;;
- 
          
          
              esac
- 
          
          
              download=1
- 
          
          
            fi
- 
          
          
          else
- 
          
          
            rvm_debug "No archive, downloading"
- 
          
          
            download=1
- 
          
          
          fi
- 
          
          
          - 
          
          
          if
- 
          2
          
            (( download > 0 ))
- 
          
          
          then
- 
          
          
            \rm -f $archive
- 
          
          
            if
- 
          
          
              eval $fetch_command \"$url\"
- 
          
          
            then
- 
          
          
              true
- 
          
          
            else
- 
          
          
              result=$?
- 
          
          
              case "$result" in
- 
          
          
                (22|78)
- 
          
          
                  rvm_error "The requested url does not exist($result): '$url'"
- 
          
          
                  try_ftp=1
- 
          
          
                  ;;
- 
          
          
                (18)
- 
          
          
                  rvm_error "Partial file($result). Only a part of the file was transferred. Removing partial and re-trying."
- 
          
          
                  \rm -f "$archive"
- 
          
          
                  retry=1
- 
          
          
                  ;;
- 
          
          
                (33)
- 
          
          
                  rvm_debug "Server does not support 'range' command($result), removing '$archive'"
- 
          
          
                  \rm -f "$archive"
- 
          
          
                  retry=1
- 
          
          
                  ;;
- 
          
          
                (*)
- 
          
          
                  rvm_error "There was an error($result), please check ${rvm_log_path}/$rvm_ruby_string/*.log. Next we'll try to fetch via http."
- 
          
          
                  try_ftp=1
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
              if
- 
          
          
                [[ $try_ftp -eq 1 ]]
- 
          
          
              then
- 
          
          
                rvm_log "Trying ftp:// URL instead."
- 
          
          
                url="${url/http:/ftp:/}"
- 
          
          
              fi
- 
          
          
              if
- 
          
          
                [[ $try_ftp -eq 1 || $retry -eq 1 ]]
- 
          
          
              then
- 
          
          
                eval $fetch_command \"$url\"
- 
          
          
                result=$?
- 
          
          
              fi
- 
          
          
              (( result == 0 )) ||
- 
          
          
                rvm_fail "There was an error($result), please check ${rvm_log_path}/$rvm_ruby_string/*.log" $result
- 
          
          
            fi
- 
          
          
          fi
- 
          
          
          - 
          
          
          # Check if we have downloaded the correct archive
- 
          
          
          if
- 
          2
          
            __rvm_checksum_validate_file "$rvm_archives_path/${archive}"
- 
          
          
          then
- 
          2
          
            rvm_debug "Downloaded archive checksum matched."
- 
          
          
          else
- 
          
          
            result=$?
- 
          
          
            if
- 
          
          
             (( result==1 && ${rvm_verify_downloads_flag:-0}>0 ))
- 
          
          
            then
- 
          
          
              rvm_warn "No checksum for downloaded archive, recording checksum in user configuration."
- 
          
          
              __rvm_checksum_calculate_file "$archive"
- 
          
          
              __rvm_checksum_write          "$archive"
- 
          
          
            elif
- 
          
          
             (( result>1  && ${rvm_verify_downloads_flag:-0}>1 ))
- 
          
          
            then
- 
          
          
              rvm_warn "Downloaded archive checksum did not match!"
- 
          
          
            elif
- 
          
          
             (( result == 1 ))
- 
          
          
            then
- 
          
          
              rvm_fail "Downloaded archive checksum could not be verified!
- 
          
          
          If you wish to continue with unverified download add '--verify-downloads 1' after the command.
- 
          
          
          "
- 
          
          
            else
- 
          
          
              \rm -f $archive
- 
          
          
              rvm_fail "Downloaded archive checksum did not match, archive was removed!
- 
          
          
          If you wish to continue with not matching download add '--verify-downloads 2' after the command.
- 
          
          
          "
- 
          
          
            fi
- 
          
          
          fi
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment()
- 
          
          
          {
- 
          1
          
            typeset __type
- 
          1
          
            typeset -a __types
- 
          
          
            __types=(
- 
          
          
              requirements osx_gcc architectures gcc47 bison smartos sunos openbsd
- 
          
          
              flags_docs flags_tcltk flags_shared_static flags_threads
- 
          1
          
            )
- 
          12
          
            for __type in "${__types[@]}"
- 
          
          
            do
- 
          12
          
              rvm_debug "__rvm_setup_compile_environment_${__type} $1"
- 
          12
          
              __rvm_setup_compile_environment_${__type} "$1" || return $?
- 
          
          
            done
- 
          2
          
            rvm_debug "found compiler: $( __rvm_found_compiler )"
- 
          
          
          }
- 
          
          
          - 
          
          
          # 2.0.0+
- 
          
          
          __ruby_clang_ok()
- 
          
          
          {
- 
          
          
            case "$1" in
- 
          
          
              ruby-2*|ruby-head*) return 0 ;;
- 
          
          
            esac
- 
          
          
            return 1
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_osx_gcc_42()
- 
          
          
          {
- 
          
          
            if
- 
          
          
              [[ -x /usr/local/bin/gcc-4.2 ]] # HomeBrew
- 
          
          
            then
- 
          
          
              export CC=/usr/local/bin/gcc-4.2
- 
          
          
            elif
- 
          
          
              [[ -x /opt/local/bin/gcc-apple-4.2 ]] # MacPorts
- 
          
          
            then
- 
          
          
              export CC=/opt/local/bin/gcc-apple-4.2
- 
          
          
            elif
- 
          
          
              __rvm_which gcc-apple-4.2 > /dev/null # MacPorts via PATH
- 
          
          
            then
- 
          
          
              export CC=gcc-apple-4.2
- 
          
          
            elif
- 
          
          
              __rvm_which gcc-4.2 > /dev/null # Any gcc-4.2
- 
          
          
            then
- 
          
          
              export CC=gcc-4.2
- 
          
          
            elif
- 
          
          
              [[ -x /usr/bin/gcc-4.2 ]] # OSX-GCC-Installer / Xcode - might be LLVM
- 
          
          
            then
- 
          
          
              export CC=/usr/bin/gcc-4.2
- 
          
          
            elif
- 
          
          
              __rvm_compiler_is_llvm
- 
          
          
            then
- 
          
          
              export CC=clang
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_osx_gcc()
- 
          
          
          {
- 
          3
          
            [[ "Darwin" == "$(uname)" ]] || return 0
- 
          
          
          - 
          
          
            if __rvm_array_contains "*debug*" "${rvm_patch_names[@]}"
- 
          
          
            then rvm_force_autoconf_flag=1
- 
          
          
            fi
- 
          
          
          - 
          
          
            typeset selected_compiler
- 
          
          
            if
- 
          
          
              selected_compiler="$( __rvm_selected_compiler )"
- 
          
          
            then
- 
          
          
              case "${rvm_autolibs_flag:=1}" in
- 
          
          
                (0) rvm_debug "User selected compiler: $selected_compiler"
- 
          
          
                  ;;
- 
          
          
                (1) rvm_warn  "Warning: found user selected compiler '$selected_compiler', this will suppress RVM auto detection mechanisms."
- 
          
          
                  ;;
- 
          
          
                (*) rvm_error "Warning: found user selected compiler '$selected_compiler', this will suppress RVM auto detection mechanisms."
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            else
- 
          
          
              case "$1" in
- 
          
          
                (ruby-2*|ruby-head*)
- 
          
          
                  export CC=clang
- 
          
          
                  ;;
- 
          
          
                (ruby*|ree*)
- 
          
          
                  __rvm_setup_compile_environment_osx_gcc_42
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_bison()
- 
          
          
          {
- 
          
          
            # TODO: what should we do for autolibs=1 ? should it fail or just warn when bison is missing
- 
          1
          
            (( ${rvm_autolibs_flag:=1} > 0 )) || return 0
- 
          1
          
            case "$1" in
- 
          
          
              (ruby*|ree*|rbx*)
- 
          1
          
                __rvm_check_for_bison ||
- 
          
          
                {
- 
          
          
                  result=$?
- 
          
          
                  rvm_error "Bison required but not found. Halting."
- 
          
          
                  return $result
- 
          
          
                }
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_architectures_default()
- 
          
          
          {
- 
          
          
            typeset _architecture _architectures_string
- 
          
          
            typeset -a _architectures _flags
- 
          
          
          - 
          
          
            _architectures=()
- 
          
          
            for _architecture in ${rvm_architectures//,/ }
- 
          
          
            do _architectures+=( -arch "${_architecture}" )
- 
          
          
            done
- 
          
          
            _architectures_string="${_architectures[*]}"
- 
          
          
          - 
          
          
            _flags=(
- 
          
          
              CFLAGS="${_architectures_string}"
- 
          
          
              CCFLAGS="${_architectures_string}"
- 
          
          
              CXXFLAGS="${_architectures_string}"
- 
          
          
              LDFLAGS="${_architectures_string}"
- 
          
          
            )
- 
          
          
            __rvm_update_configure_env "${_flags[@]}"
- 
          
          
            rvm_configure_flags+=( --disable-dependency-tracking )
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_architectures_ruby_osx()
- 
          
          
          {
- 
          
          
            typeset _architecture _architectures_string
- 
          
          
            typeset -a _architectures _flags
- 
          
          
          - 
          
          
            _architectures=()
- 
          
          
            for _architecture in ${rvm_architectures//,/ }
- 
          
          
            do _architectures+=( -arch "${_architecture}" )
- 
          
          
            done
- 
          
          
            _architectures_string="${_architectures[*]}"
- 
          
          
          - 
          
          
            _flags=(
- 
          
          
              MACOSX_DEPLOYMENT_TARGET="$( sw_vers -productVersion | awk -F'.' '{print $1"."$2}' )"
- 
          
          
              CFLAGS="${_architectures_string} -g -Os -pipe -no-cpp-precomp"
- 
          
          
              CCFLAGS="${_architectures_string} -g -Os -pipe"
- 
          
          
              CXXFLAGS="${_architectures_string} -g -Os -pipe"
- 
          
          
              LDFLAGS="${_architectures_string} -bind_at_load"
- 
          
          
              LDSHARED="cc ${_architectures_string} -dynamiclib -undefined suppress -flat_namespace"
- 
          
          
            )
- 
          
          
            __rvm_update_configure_env "${_flags[@]}"
- 
          
          
            __rvm_array_contains "*osx-arch-fix*" "${rvm_patch_names[@]}" || rvm_patch_names+=( osx-arch-fix )
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_architectures()
- 
          
          
          {
- 
          2
          
            [[ -n "${rvm_architectures:-}" ]] || return 0
- 
          
          
            case "$1" in
- 
          
          
              ruby-1.9*|ruby-2*|ruby-head*)
- 
          
          
                # Ruby 1.9+ supports the easy way
- 
          
          
                rvm_configure_flags+=( --with-arch="${rvm_architectures}" )
- 
          
          
                ;;
- 
          
          
              ruby*|ree*)
- 
          
          
                case "$(uname)" in
- 
          
          
                  (Darwin)
- 
          
          
                    __rvm_setup_compile_environment_architectures_ruby_osx
- 
          
          
                    ;;
- 
          
          
                  (*)
- 
          
          
                    __rvm_setup_compile_environment_architectures_default
- 
          
          
                    ;;
- 
          
          
                esac
- 
          
          
                ;;
- 
          
          
              *)
- 
          
          
                __rvm_setup_compile_environment_architectures_default
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_gcc47()
- 
          
          
          {
- 
          1
          
            __rvm_compiler_is_gcc47 || return 0
- 
          1
          
            __rvm_string_match "$1" "ruby-1.8.*" "ree*" || return 0
- 
          
          
          - 
          
          
            # -g -O2 from 1.8.7-p370 is not enough, need all the flags to fix it
- 
          1
          
            __rvm_update_configure_env CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_smartos()
- 
          
          
          {
- 
          3
          
            [[ "$(uname -v)" =~ ^joyent ]] || return 0
- 
          
          
            __rvm_update_configure_opt_dir "$1" "/opt/local" # TODO do we needed the next line?
- 
          
          
            __rvm_update_configure_env CCFLAGS="-I/opt/local/include"
- 
          
          
            __rvm_add_to_path prepend "/opt/local/gnu/bin"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_sunos()
- 
          
          
          {
- 
          3
          
            [[ "$(uname -s)" == "SunOS" ]] || return 0
- 
          
          
            case "$1" in
- 
          
          
              ruby-1.9*|ruby-2*)
- 
          
          
                # Temporary solution for this bug http://bugs.ruby-lang.org/issues/5384
- 
          
          
                rvm_configure_flags+=( ac_cv_func_dl_iterate_phdr=no )
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          - 
          
          
          __rvm_setup_compile_environment_openbsd()
- 
          
          
          {
- 
          3
          
            [[ "$(uname)" == "OpenBSD"     ]] || return 0
- 
          
          
            if
- 
          
          
              [[  -z "${AUTOCONF_VERSION:-}" ]]
- 
          
          
            then
- 
          
          
              export AUTOCONF_VERSION
- 
          
          
              AUTOCONF_VERSION="$( ls -1 /usr/local/bin/autoreconf-* | sort | tail -n 1 )"
- 
          
          
              AUTOCONF_VERSION="${AUTOCONF_VERSION##*-}"
- 
          
          
            fi
- 
          
          
            if
- 
          
          
              [[  -z "${AUTOMAKE_VERSION:-}" ]]
- 
          
          
            then
- 
          
          
              export AUTOMAKE_VERSION
- 
          
          
              AUTOMAKE_VERSION="$( ls -1 /usr/local/bin/automake-* | sort | tail -n 1 )"
- 
          
          
              AUTOMAKE_VERSION="${AUTOMAKE_VERSION##*-}"
- 
          
          
            fi
- 
          
          
            # https://github.com/wayneeseguin/rvm/issues/1581
- 
          
          
            rvm_configure_env+=( sh )
- 
          
          
            case "$1" in
- 
          
          
              ruby-1.9*|ruby-2*)
- 
          
          
                # Temporary solution for this bug http://bugs.ruby-lang.org/issues/5384
- 
          
          
                rvm_configure_flags+=( ac_cv_func_dl_iterate_phdr=no )
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_flags_docs()
- 
          
          
          {
- 
          
          
            if
- 
          1
          
              (( ${rvm_docs_flag:-0} == 1 ))
- 
          
          
            then
- 
          
          
              true # enabled by default
- 
          
          
            else
- 
          1
          
              case "$1" in
- 
          
          
                (ruby*|ree*)
- 
          1
          
                  rvm_configure_flags+=( --disable-install-doc )
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            fi
- 
          1
          
            true # OSX --trace FIX
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_flags_tcltk()
- 
          
          
          {
- 
          3
          
            [[ "Darwin" == "$(uname)" ]] || return 0
- 
          
          
          - 
          
          
            case "$1" in
- 
          
          
              (ruby*|ree*)
- 
          
          
                [[ " ${rvm_configure_flags[*]} " =~ " --with-tcl "    ]] ||
- 
          
          
                [[ " ${rvm_configure_flags[*]} " =~ " --with-tk "     ]] ||
- 
          
          
                [[ " ${rvm_configure_flags[*]} " =~ " --without-tcl " ]] ||
- 
          
          
                [[ " ${rvm_configure_flags[*]} " =~ " --without-tk "  ]] ||
- 
          
          
                rvm_configure_flags+=( --without-tcl --without-tk )
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
            true # OSX --trace FIX
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_flags_shared_static()
- 
          
          
          {
- 
          
          
            if
- 
          1
          
              (( ${rvm_static_flag:-0} == 1 ))
- 
          
          
            then
- 
          
          
              case "$1" in
- 
          
          
                (openssl*)  rvm_configure_flags+=( no-shared )
- 
          
          
                  ;;
- 
          
          
                (ncurses*)  rvm_configure_flags+=( --without-shared )
- 
          
          
                  ;;
- 
          
          
                (rbx*|rubinius*) true # no flag yet for rbx!
- 
          
          
                  ;;
- 
          
          
                (*)         rvm_configure_flags+=( --disable-shared )
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            else
- 
          1
          
              case "$1" in
- 
          
          
                (openssl*)  rvm_configure_flags+=( shared )
- 
          
          
                  ;;
- 
          
          
                (readline*) rvm_configure_flags+=( --disable-static --enable-shared )
- 
          
          
                  ;;
- 
          
          
                (ncurses*)  rvm_configure_flags+=( --with-shared )
- 
          
          
                  ;;
- 
          
          
                (rbx*|rubinius*) true # no flag yet for rbx!
- 
          
          
                  ;;
- 
          1
          
                (*)         rvm_configure_flags+=( --enable-shared )
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            fi
- 
          1
          
            true # OSX --trace FIX
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_detect_max_threads()
- 
          
          
          {
- 
          
          
            case "$(uname)" in
- 
          
          
              (Darwin|FreeBSD)
- 
          
          
                sysctl -n hw.ncpu
- 
          
          
                ;;
- 
          
          
              (*)
- 
          
          
                cat /proc/cpuinfo 2>/dev/null | (grep vendor_id || echo 'one';) | wc -l
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_flags_threads()
- 
          
          
          {
- 
          1
          
            case "$1" in
- 
          
          
              (openssl*)
- 
          
          
                # Don't use -j option for make OpenSSL
- 
          
          
                __rvm_remove_from_array rvm_make_flags "-j*" "${rvm_make_flags[@]}"
- 
          
          
                rvm_make_flags+=( -j1 )
- 
          
          
                ;;
- 
          
          
              (*)
- 
          1
          
                [[ " ${rvm_make_flags[*]}" =~ " -j" ]] || rvm_make_flags+=( -j$(__rvm_detect_max_threads) )
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_setup_compile_environment_requirements_iterate()
- 
          
          
          {
- 
          1
          
            typeset -a list
- 
          1
          
            typeset element
- 
          
          
          - 
          1
          
            list=( update-system rvm )
- 
          1
          
            if (( $# ))
- 
          1
          
            then list+=( "$@" )
- 
          
          
            else list+=( ruby )
- 
          
          
            fi
- 
          
          
          - 
          3
          
            for element in "${list[@]}"
- 
          3
          
            do requirements_$_system_name "${element}" || return $?
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          #
- 
          
          
          # rvm_autolibs_flag
- 
          
          
          # - 0 - disabled
- 
          
          
          # - 1 - use libs, do not install - default
- 
          
          
          # - 2 - use libs, install if missing, fallback to 1 if brew not writable
- 
          
          
          # - 3 - 2 + install package manager if not available
- 
          
          
          # - 4 - 3 + error out if brew not writable, no fallback
- 
          
          
          #
- 
          
          
          __rvm_setup_compile_environment_requirements()
- 
          
          
          {
- 
          1
          
            (( ${rvm_autolibs_flag:=1} > 0 )) || return 0
- 
          
          
          - 
          1
          
            __rvm_detect_system
- 
          1
          
            [[ -s "$rvm_scripts_path/functions/requirements/$_system_name" ]] ||
- 
          
          
            {
- 
          
          
              rvm_error "Requirements support for $_system_name/$_system_version/$_system_arch is not implemented yet,
- 
          
          
                report a bug here => https://github.com/wayneeseguin/rvm/issues"
- 
          
          
              return 1
- 
          
          
            }
- 
          
          
          - 
          1
          
            rvm_log "Installing requirements for $_system_name/$_system_version/$_system_arch, might require sudo password"
- 
          1
          
            source "$rvm_scripts_path/functions/requirements/$_system_name"
- 
          
          
          - 
          1
          
            __rvm_setup_compile_environment_requirements_iterate "$@"
- 
          
          
          }
- 
          
          
          - 
          
          
          #### Helpers for: requirements_$_system_name
- 
          
          
          - 
          
          
          __rvm_filter_installed_packages_reset()
- 
          
          
          {
- 
          2
          
            packages_installed=()
- 
          2
          
            packages_missing=()
- 
          2
          
            packages_to_install=()
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_filter_installed_package_check()
- 
          
          
          {
- 
          
          
            if
- 
          29
          
              "$1" "$2"
- 
          
          
            then
- 
          29
          
              packages_installed+=( "$2" )
- 
          
          
            else
- 
          
          
              case "$rvm_autolibs_flag" in
- 
          
          
                (0|1)  packages_missing+=( "$2" ) ;; # just ignore
- 
          
          
                (*) packages_to_install+=( "$2" ) ;; # 2+
- 
          
          
              esac
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_filter_installed_packages_summary()
- 
          
          
          {
- 
          2
          
            (( ${#packages_installed[@]} == 0 )) ||
- 
          
          
            {
- 
          2
          
              _list="${packages_installed[*]}"
- 
          2
          
              rvm_debug "Found required packages: ${_list// /, }."
- 
          
          
            }
- 
          2
          
            (( ${#packages_missing[@]} == 0 )) ||
- 
          
          
            {
- 
          
          
              _list="${packages_missing[*]}"
- 
          
          
              if (( rvm_autolibs_flag == 0 ))
- 
          
          
              then rvm_debug "Missing required packages: ${_list// /, }."
- 
          
          
              else rvm_warn "Missing required packages: ${_list// /, }."
- 
          
          
              fi
- 
          
          
            }
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_filter_installed_packages_install()
- 
          
          
          {
- 
          2
          
            (( ${#packages_to_install[@]} == 0 )) ||
- 
          
          
            {
- 
          
          
              _list="${packages_to_install[*]}"
- 
          
          
              __rvm_log_command package_install_${_list// /_} "Installing required packages: ${_list// /, }." \
- 
          
          
                "$1" "${packages_to_install[@]}" ||
- 
          
          
                return $?
- 
          
          
            }
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_filter_installed_packages()
- 
          
          
          {
- 
          2
          
            typeset _package_installed_cmd _packages_install_cmd _package_name _list
- 
          
          
          - 
          2
          
            _package_installed_cmd="requirements_$1_lib_installed"
- 
          2
          
            _package_install_cmd="requirements_$1_libs_install"
- 
          2
          
            shift
- 
          
          
          - 
          2
          
            __rvm_filter_installed_packages_reset
- 
          29
          
            for _package_name
- 
          29
          
            do __rvm_filter_installed_package_check "${_package_installed_cmd}" "${_package_name}"
- 
          
          
            done
- 
          2
          
            __rvm_filter_installed_packages_summary
- 
          2
          
            __rvm_filter_installed_packages_install "${_package_install_cmd}"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_try_sudo()
- 
          
          
          {
- 
          1
          
            typeset -a command_to_run
- 
          1
          
            command_to_run=()
- 
          1
          
            case "$rvm_autolibs_flag" in
- 
          
          
              (0|1)
- 
          1
          
                (( UID == 0 )) || return 0 # do not run nothing if it would require sudo
- 
          
          
                ;;
- 
          
          
              (*)
- 
          
          
                (( UID == 0 )) || command_to_run+=( sudo )
- 
          
          
                ;;
- 
          
          
            esac
- 
          1
          
            "${command_to_run[@]}" "$@"
- 
          
          
          }
 
      
        
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          # Query the rvm key-value database for a specific key
- 
          
          
          # Allow overrides from user specifications in $rvm_user_path/db
- 
          
          
          __rvm_db()
- 
          
          
          {
- 
          339
          
            typeset value key variable
- 
          
          
          - 
          339
          
            key=${1:-""}
- 
          339
          
            key=${key#go} # Support for goruby - remove the go
- 
          339
          
            variable=${2:-""}
- 
          
          
          - 
          339
          
            if [[ -f "$rvm_user_path/db" ]] ; then
- 
          678
          
              value="$("$rvm_scripts_path/db" "$rvm_user_path/db" "$key")"
- 
          
          
            fi
- 
          
          
          - 
          339
          
            if [[ -z "$value" ]] ; then
- 
          678
          
              value="$("$rvm_scripts_path/db" "$rvm_path/config/db" "$key")"
- 
          
          
            fi
- 
          
          
          - 
          339
          
            if [[ -n "$value" ]] ; then
- 
          330
          
              if [[ -z "$variable" ]] ; then
- 
          330
          
                echo $value
- 
          
          
              else
- 
          
          
                eval "$variable='$value'"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          339
          
            return 0
- 
          
          
          }
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          __rvm_env_string()
- 
          
          
          {
- 
          481
          
            typeset _path _string
- 
          
          
          - 
          481
          
            _path="${GEM_HOME:-""}"
- 
          
          
          - 
          481
          
            _string="${_path//*gems\//}"
- 
          481
          
            _string="${_string//\/*/}"
- 
          
          
          - 
          481
          
            printf "%b" "${_string:-system}\n"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_expand_ruby_string()
- 
          
          
          {
- 
          26
          
            typeset string current_ruby
- 
          
          
          - 
          26
          
            string="$1"
- 
          
          
          - 
          130
          
            case "${string:-all}" in
- 
          
          
          - 
          
          
              all)
- 
          
          
                "$rvm_scripts_path/list" strings | \tr ' ' "\n"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              all-gemsets)
- 
          
          
                "$rvm_scripts_path/list" gemsets strings
- 
          
          
                ;;
- 
          
          
          - 
          
          
              default-with-rvmrc|rvmrc)
- 
          
          
                "$rvm_scripts_path/tools" path-identifier "$PWD"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              all-rubies|rubies)
- 
          
          
                "$rvm_scripts_path/list" rubies strings
- 
          
          
                ;;
- 
          
          
          - 
          
          
              current-ruby|gemsets)
- 
          
          
                current_ruby="$(__rvm_env_string)"
- 
          
          
                current_ruby="${current_ruby%@*}"
- 
          
          
          - 
          
          
                rvm_silence_logging=1 "$rvm_scripts_path/gemsets" list strings \
- 
          
          
                  | \sed "s/ (default)//; s/^/$current_ruby${rvm_gemset_separator:-@}/ ; s/@default// ;"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              current)
- 
          
          
                __rvm_env_string
- 
          
          
                ;;
- 
          
          
          - 
          
          
              aliases)
- 
          
          
                awk -F= '{print $string}' < "$rvm_path/config/alias"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              *)
- 
          104
          
                __rvm_ruby_strings_exist $( echo "$string" | \tr "," "\n" | __rvm_strip )
- 
          
          
                ;;
- 
          
          
          - 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_become()
- 
          
          
          {
- 
          
          
            # set rvm_rvmrc_flag=0 to not create .rvmrc in random places of code
- 
          76
          
            typeset string rvm_rvmrc_flag
- 
          76
          
            string="$1"
- 
          76
          
            rvm_rvmrc_flag=0
- 
          
          
          - 
          76
          
            [[ -n "$string" ]] && {
- 
          69
          
              rvm_ruby_string="$string"
- 
          69
          
              rvm_gemset_name=""
- 
          
          
            }
- 
          
          
          - 
          90
          
            __rvm_use >/dev/null || return $?
- 
          
          
          - 
          62
          
            rvm_ruby_string="${rvm_ruby_string}${rvm_gemset_name:+${rvm_gemset_separator:-'@'}}${rvm_gemset_name:-}"
- 
          
          
          - 
          62
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_ensure_has_environment_files()
- 
          
          
          {
- 
          190
          
            typeset environment_id file_name directory identifier variable value variables
- 
          
          
          - 
          380
          
            environment_id="$(__rvm_env_string)"
- 
          
          
          - 
          190
          
            file_name="${rvm_environments_path}/$environment_id"
- 
          
          
          - 
          190
          
            if [[ ! -d "$rvm_environments_path" ]]
- 
          
          
            then
- 
          
          
              \mkdir -p "$rvm_environments_path"
- 
          
          
            fi
- 
          
          
          - 
          558
          
            if [[ ! -s "$file_name" ]] || ! GREP_OPTIONS="" \grep 'rvm_env_string=' "$file_name" >/dev/null
- 
          
          
            then
- 
          6
          
              \rm -f "$file_name"
- 
          6
          
              printf "%b" \
- 
          
          
                "export PATH ; PATH=\"${rvm_ruby_gem_home}/bin:${rvm_ruby_global_gems_path}/bin:${rvm_ruby_home}/bin:${rvm_bin_path}:\$PATH\"\n" \
- 
          
          
                > "$file_name"
- 
          
          
          - 
          66
          
              for variable in rvm_env_string rvm_path rvm_ruby_string rvm_gemset_name \
- 
          
          
                RUBY_VERSION GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC MAGLEV_HOME RBXOPT
- 
          
          
              do
- 
          132
          
                eval "export $variable"
- 
          132
          
                eval "value=\${${variable}:-""}"
- 
          66
          
                if [[ -n "$value" ]]
- 
          
          
                then
- 
          52
          
                  printf "export %b ; %b='%b'\n" "${variable}" "${variable}" "${value}" >> "$file_name"
- 
          
          
                else
- 
          14
          
                  printf "unset %b\n" "${variable}" >> "$file_name"
- 
          
          
                fi
- 
          
          
              done
- 
          
          
            fi
- 
          
          
          - 
          
          
            # Next, ensure we have default wrapper files. Also, prevent it from recursing.
- 
          190
          
            if (( ${rvm_create_default_wrappers:=0} == 1 )) ||
- 
          190
          
              [[ ! -f "$rvm_wrappers_path/$environment_id/ruby" ]]
- 
          
          
            then
- 
          
          
              # We need to generate wrappers for both the default gemset and the global gemset.
- 
          138
          
              for identifier in "$environment_id" "${environment_id//@*/}@global"
- 
          
          
              do
- 
          138
          
                rvm_create_default_wrappers=1
- 
          
          
          - 
          138
          
                directory="$rvm_wrappers_path/$identifier"
- 
          
          
          - 
          276
          
                if [[ ! -L "$directory" && ! -d "$directory" ]]; then
- 
          19
          
                  \mkdir -p "$directory"
- 
          
          
          - 
          19
          
                  "$rvm_scripts_path/wrapper" "$identifier" &> /dev/null
- 
          
          
                fi
- 
          
          
              done
- 
          69
          
              rvm_create_default_wrappers=0
- 
          
          
            fi
- 
          
          
          - 
          190
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          # Write the bin/ wrapper script for currently selected ruby.
- 
          
          
          # TODO: Adjust binscript to be able to handle all rubies,
- 
          
          
          #       not just the standard interpreteres.
- 
          
          
          __rvm_generate_wrappers()
- 
          
          
          {
- 
          2
          
            "$rvm_scripts_path/wrapper" "$rvm_ruby_string" --no-links --all
- 
          
          
          }
- 
          
          
          - 
          
          
          # Runs a command in a given env.
- 
          
          
          __rvm_with()
- 
          
          
          (
- 
          4
          
            __rvm_use "$1"
- 
          4
          
            shift
- 
          4
          
            "$@" || return $?
- 
          
          
          )
- 
          
          
          - 
          
          
          __rvm_gemset_pristine()
- 
          
          
          {
- 
          3
          
            __rvm_log_command "gemset.pristine" "Making gemset $1 pristine." \
- 
          
          
              __rvm_with "$1" "$rvm_scripts_path/gemsets" pristine
- 
          
          
          }
- 
          
          
          - 
          
          
          __variables_definition()
- 
          
          
          {
- 
          628
          
            typeset -a __variables_list __array_list
- 
          628
          
            typeset __method
- 
          
          
          - 
          628
          
            __method="$1"
- 
          
          
          - 
          
          
            # NOTE: Removing rvm_bin_path here causes system wide installations to generate
- 
          
          
            # a corrupt PATH, breaking the RVM installation.
- 
          
          
            __variables_list=(
- 
          
          
              rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag
- 
          
          
              rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag
- 
          
          
              rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_dump_environment_flag rvm_verbose_flag
- 
          
          
              rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag
- 
          
          
              rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_disable_binary_flag
- 
          
          
              rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag
- 
          
          
              rvm_verify_downloads_flag rvm_skip_openssl_flag rvm_gems_cache_path rvm_gems_path
- 
          
          
              rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_gems_cache_path rvm_archives_path
- 
          
          
              rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path
- 
          
          
              rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path
- 
          
          
              rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path
- 
          
          
              rvm_wrappers_path rvm_externals_path rvm_stored_errexit rvm_ruby_strings rvm_ruby_binary
- 
          
          
              rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version
- 
          
          
              rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version
- 
          
          
              rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_tag rvm_ruby_sha
- 
          
          
              rvm_ruby_version rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args
- 
          
          
              rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name __rvm_env_loaded next_token
- 
          
          
              rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args
- 
          
          
              rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_tar_command rvm_tar_options
- 
          
          
              rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag
- 
          
          
              rvm_codesign_identity rvm_expected_gemset_name rvm_with_gems rvm_without_gems
- 
          
          
              rvm_ignore_dotfiles_flag rvm_latest_binary_flag rvm_fuzzy_flag rvm_autolibs_flag
- 
          628
          
            )
- 
          
          
          - 
          
          
            __array_list=(
- 
          
          
              rvm_patch_names rvm_ree_options rvm_autoconf_flags
- 
          628
          
            )
- 
          
          
          - 
          628
          
            case "${__method}" in
- 
          332
          
              (export) export -a "${__array_list[@]}" ;;
- 
          296
          
              (unset)  unset     "${__array_list[@]}" ;;
- 
          
          
              (*)
- 
          
          
                rvm_error "Unknown action given to __variables_definition: ${__method}"
- 
          
          
                return 1
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          628
          
            ${__method} "${__variables_list[@]}"
- 
          
          
          }
- 
          
          
          - 
          
          
          # Set shell options that RVM needs temporarily, these are reverted by __rvm_teardown.
- 
          
          
          # see the top of ./scripts/initialize for settings that are needed all the time.
- 
          
          
          # Setup must be always called after initialize, otherwise it does nothing ... except exporting.
- 
          
          
          __rvm_setup()
- 
          
          
          {
- 
          332
          
            __variables_definition export
- 
          
          
          - 
          
          
            # Setup only on first load.
- 
          332
          
            if (( __rvm_env_loaded != 1 ))
- 
          36
          
            then return 0
- 
          
          
            fi
- 
          
          
          - 
          592
          
            if [[ -n "${BASH_VERSION:-}" ]] && ! __function_on_stack cd pushd popd
- 
          
          
            then
- 
          287
          
              trap 'status=$? ; __rvm_teardown_final ; set +x ; return $status' 0 1 2 3 15
- 
          
          
            fi
- 
          
          
          - 
          296
          
            if [[ -n "${ZSH_VERSION:-}" ]]
- 
          
          
            then
- 
          
          
              export rvm_zsh_clobber rvm_zsh_nomatch
- 
          
          
              # Set clobber for zsh users, for compatibility with bash's append operator ( >> file ) behavior
- 
          
          
              if setopt | GREP_OPTIONS="" \grep -s '^noclobber$' >/dev/null 2>&1
- 
          
          
              then rvm_zsh_clobber=0
- 
          
          
              else rvm_zsh_clobber=1
- 
          
          
              fi
- 
          
          
              setopt clobber
- 
          
          
              # Set no_nomatch so globs that don't match any files don't print out a warning
- 
          
          
              if setopt | GREP_OPTIONS="" \grep -s '^nonomatch$' >/dev/null 2>&1
- 
          
          
              then rvm_zsh_nomatch=0
- 
          
          
              else rvm_zsh_nomatch=1
- 
          
          
              fi
- 
          
          
              setopt no_nomatch
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_teardown()
- 
          
          
          {
- 
          332
          
            if builtin command -v __rvm_cleanup_tmp >/dev/null 2>&1
- 
          
          
            then
- 
          332
          
              __rvm_cleanup_tmp
- 
          
          
            fi
- 
          
          
          - 
          332
          
            export __rvm_env_loaded
- 
          
          
            # if __rvm_env_loaded is not set - detect it via rvm_tmp_path
- 
          332
          
            : __rvm_env_loaded:${__rvm_env_loaded:=${rvm_tmp_path:+1}}:
- 
          
          
            # if not loaded then fallback to 0
- 
          332
          
            : __rvm_env_loaded:${__rvm_env_loaded:=0}:
- 
          
          
            # decrease load count counter
- 
          332
          
            : __rvm_env_loaded:$(( __rvm_env_loaded-=1 )):
- 
          
          
            #skip teardown when already done or when not yet finished
- 
          664
          
            if [[ -z "${rvm_tmp_path:-}" ]] || (( __rvm_env_loaded > 0 ))
- 
          
          
            then
- 
          36
          
              return 0
- 
          
          
            fi
- 
          
          
          - 
          296
          
            if [[ -n "${BASH_VERSION:-}" ]]
- 
          
          
            then
- 
          296
          
              trap - 0 1 2 3 15 # Clear all traps, we do not want to go into an loop.
- 
          
          
            fi
- 
          
          
          - 
          296
          
            if [[ -n "${ZSH_VERSION:-""}" ]]
- 
          
          
            then
- 
          
          
              # If rvm_zsh_clobber is 0 then "setopt" contained "noclobber" before rvm performed "setopt clobber".
- 
          
          
              (( rvm_zsh_clobber == 0 )) && setopt noclobber
- 
          
          
              # If rvm_zsh_nomatch is 0 then "setopt" contained "nonomatch" before rvm performed "setopt nonomatch".
- 
          
          
              (( rvm_zsh_nomatch == 0 )) || setopt nomatch
- 
          
          
          - 
          
          
              unset rvm_zsh_clobber rvm_zsh_nomatch
- 
          
          
            fi
- 
          
          
          - 
          296
          
            if [[ -n "${rvm_stored_umask:-}" ]]
- 
          
          
            then
- 
          296
          
              umask ${rvm_stored_umask}
- 
          296
          
              unset rvm_stored_umask
- 
          
          
            fi
- 
          
          
          - 
          296
          
            if [[ "${rvm_stored_errexit:-""}" == "1" ]]
- 
          
          
            then set -e
- 
          
          
            fi
- 
          
          
          - 
          296
          
            __variables_definition unset
- 
          
          
          - 
          296
          
            if builtin command -v __rvm_cleanup_download >/dev/null 2>&1
- 
          
          
            then
- 
          
          
              __rvm_cleanup_download
- 
          
          
            fi
- 
          
          
          - 
          296
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_teardown_final()
- 
          
          
          {
- 
          
          
            __rvm_env_loaded=1
- 
          
          
            unset __rvm_project_rvmrc_lock
- 
          
          
            __rvm_teardown
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_do_with_env_before()
- 
          
          
          {
- 
          26
          
            if [[ -n "${rvm_scripts_path:-}" || -n "${rvm_path:-}" ]]
- 
          
          
            then
- 
          
          
              # Load env - setup all required variables, __rvm_teardown is called on the end
- 
          13
          
              source "${rvm_scripts_path:-"$rvm_path/scripts"}/initialize"
- 
          13
          
              __rvm_setup
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_do_with_env_after()
- 
          
          
          {
- 
          13
          
            __rvm_teardown
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_do_with_env()
- 
          
          
          {
- 
          4
          
            typeset result
- 
          
          
          - 
          4
          
            __rvm_do_with_env_before
- 
          
          
          - 
          4
          
            "$@"
- 
          4
          
            result=$?
- 
          
          
          - 
          4
          
            __rvm_do_with_env_after
- 
          
          
          - 
          4
          
            return ${result:-0}
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_conditionally_do_with_env()
- 
          
          
          {
- 
          198
          
            if (( __rvm_env_loaded > 0 ))
- 
          
          
            then
- 
          194
          
              "$@"
- 
          
          
            else
- 
          4
          
              __rvm_do_with_env "$@"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_ensure_is_a_function()
- 
          
          
          {
- 
          139
          
            if [[ ${rvm_reload_flag:=0} == 1 ]] || ! is_a_function rvm
- 
          
          
            then
- 
          276
          
              for script in version selector selector_gemsets cd cli override_gem
- 
          
          
              do
- 
          276
          
                if [[ -f "$rvm_scripts_path/$script" ]]
- 
          
          
                then
- 
          276
          
                  source "$rvm_scripts_path/$script"
- 
          
          
                else
- 
          
          
                  printf "%b" \
- 
          
          
          "WARNING:
- 
          
          
                  Could not source '$rvm_scripts_path/$script' as file does not exist.
- 
          
          
                  RVM will likely not work as expected.\n"
- 
          
          
                fi
- 
          
          
              done
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_call_with_restored_umask()
- 
          
          
          {
- 
          
          
            rvm_umask="$(umask)"
- 
          
          
          - 
          
          
            if [[ -n "${rvm_stored_umask:-}" ]];
- 
          
          
            then
- 
          
          
              umask ${rvm_stored_umask}
- 
          
          
            fi
- 
          
          
          - 
          
          
            "$@"
- 
          
          
          - 
          
          
            umask "${rvm_umask}"
- 
          
          
            unset rvm_umask
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          __rvm_current_gemset()
- 
          
          
          {
- 
          
          
            # Fetch the current gemset via GEM_HOME
- 
          14
          
            typeset current_gemset
- 
          14
          
            current_gemset="${GEM_HOME:-}"
- 
          
          
          - 
          
          
            # We only care about the stuff to the right of the separator.
- 
          14
          
            current_gemset="${current_gemset##*${rvm_gemset_separator:-@}}"
- 
          
          
          - 
          14
          
            if [[ "${current_gemset}" == "${GEM_HOME:-}" ]] ; then
- 
          9
          
              echo ''
- 
          
          
            else
- 
          5
          
              echo "${current_gemset}"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_using_gemset_globalcache()
- 
          
          
          {
- 
          236
          
            "$rvm_scripts_path/db" "$rvm_user_path/db" \
- 
          472
          
              "use_gemset_globalcache" | GREP_OPTIONS="" \grep '^true$' >/dev/null 2>&1
- 
          236
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_current_gemcache_dir()
- 
          
          
          {
- 
          12
          
            if __rvm_using_gemset_globalcache; then
- 
          
          
              echo "$rvm_gems_cache_path"
- 
          
          
            else
- 
          12
          
              echo "${rvm_ruby_gem_home:-"$GEM_HOME"}/cache"
- 
          
          
            fi
- 
          12
          
            return 0
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          __rvm_load_rvmrc()
- 
          
          
          {
- 
          831
          
            typeset _file
- 
          831
          
            typeset -a rvm_rvmrc_files
- 
          831
          
            if (( ${rvm_ignore_rvmrc:=0} == 1 ))
- 
          
          
            then
- 
          7
          
              return 0
- 
          
          
            fi
- 
          
          
          - 
          863
          
            [[ -n "${rvm_stored_umask:-}" ]] || export rvm_stored_umask=$(umask)
- 
          
          
          - 
          824
          
            rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
- 
          1648
          
            if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
- 
          824
          
               then rvm_rvmrc_files+=( "${rvm_prefix}/.rvmrc" )
- 
          
          
            fi
- 
          2472
          
            for _file in "${rvm_rvmrc_files[@]}"
- 
          
          
            do
- 
          2472
          
              if [[ -s "$_file" ]]
- 
          
          
              then
- 
          1648
          
                if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$_file" >/dev/null 2>&1
- 
          
          
                then
- 
          
          
                  rvm_error "
- 
          
          
          $_file is for rvm settings only.
- 
          
          
          rvm CLI may NOT be called from within $_file.
- 
          
          
          Skipping the loading of $_file
- 
          
          
          "
- 
          
          
                  return 1
- 
          
          
                else
- 
          824
          
                  source "$_file"
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            done
- 
          824
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          # Initialize rvm, ensuring that the path and directories are as expected.
- 
          
          
          __rvm_initialize()
- 
          
          
          {
- 
          273
          
            true ${rvm_scripts_path:="$rvm_path/scripts"}
- 
          273
          
            source "$rvm_scripts_path/base"
- 
          
          
          - 
          273
          
            __rvm_clean_path
- 
          273
          
            __rvm_conditionally_add_bin_path
- 
          273
          
            export PATH
- 
          
          
          - 
          273
          
            if [[ ! -d "${rvm_tmp_path:-/tmp}" ]]
- 
          
          
            then
- 
          
          
              command mkdir -p "${rvm_tmp_path}"
- 
          
          
            fi
- 
          
          
          - 
          273
          
            return 0
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          __rvm_record_install()
- 
          
          
          {
- 
          2
          
            [[ -n "$1" ]] || return
- 
          
          
          - 
          2
          
            typeset recorded_ruby_name rvm_install_record_file
- 
          4
          
            recorded_ruby_name="$( "$rvm_scripts_path/tools" strings "$1" )"
- 
          2
          
            rvm_install_record_file="$rvm_user_path/installs"
- 
          
          
          - 
          2
          
            [[ -f "$rvm_install_record_file" ]] || \touch "$rvm_install_record_file"
- 
          2
          
            __rvm_sed_i "$rvm_install_record_file" -e "/^$recorded_ruby_name/d"
- 
          
          
          - 
          
          
            #TODO: use `for` so  rvm_configure_flags are quoted properly
- 
          2
          
            printf "%b" "$recorded_ruby_name -- ${rvm_configure_flags[*]}\n" >> "$rvm_install_record_file"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remove_install_record()
- 
          
          
          {
- 
          3
          
            typeset recorded_ruby_name rvm_install_record_file
- 
          6
          
            recorded_ruby_name="$( "$rvm_scripts_path/tools" strings "$1" )"
- 
          3
          
            rvm_install_record_file="$rvm_user_path/installs"
- 
          
          
          - 
          3
          
            if [[ -s "$rvm_install_record_file" ]]
- 
          3
          
            then __rvm_sed_i "$rvm_install_record_file" -e "/^$recorded_ruby_name/d"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_recorded_install_command()
- 
          
          
          {
- 
          
          
            typeset recorded_ruby_name
- 
          
          
            recorded_ruby_name="$( "$rvm_scripts_path/tools" strings "$1" )"
- 
          
          
            recorded_ruby_name=${recorded_ruby_name%%${rvm_gemset_seperator:-"@"}*}
- 
          
          
          - 
          
          
            [[ -n "$recorded_ruby_name" ]] || return 1
- 
          
          
          - 
          
          
            if
- 
          
          
              [[ -s "$rvm_user_path/installs" ]] &&
- 
          
          
              GREP_OPTIONS="" \grep "^$recorded_ruby_name " "$rvm_user_path/installs" >/dev/null 2>&1
- 
          
          
            then
- 
          
          
              GREP_OPTIONS="" \grep "^$recorded_ruby_name " "$rvm_user_path/installs" | head -n 1
- 
          
          
            else
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          # Create the irbrc for the currently selected ruby installation.
- 
          
          
          __rvm_irbrc()
- 
          
          
          {
- 
          2
          
            if [[ -d "$rvm_ruby_home" && ! -s "$rvm_ruby_irbrc" ]] ; then
- 
          1
          
              \cp "$rvm_scripts_path/irbrc" "$rvm_ruby_irbrc"
- 
          
          
            fi
- 
          1
          
            return $?
- 
          
          
          }
- 
          
          
          
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          # Emits a number of patches to STDOUT, each on a new line
- 
          
          
          # Expands patchsets etc.
- 
          
          
          #TODO: Lookup default patches on rvm_ruby_string heirarchy.
- 
          
          
          __rvm_current_patch_names()
- 
          
          
          {
- 
          1
          
            typeset _variable patch_level_separator level name expanded_name
- 
          1
          
            _variable="${1:-}"
- 
          
          
            # Need variable for ${x%...}
- 
          1
          
            patch_level_separator="%"
- 
          1
          
            for name in "${rvm_patch_names[@]}" default
- 
          1
          
            do
- 
          1
          
              rvm_debug "Trying patch '$name'."
- 
          1
          
              [[ -n "${name:-}" ]] || continue
- 
          
          
          - 
          1
          
              if __rvm_string_match "${name}" "*${patch_level_separator}*"
- 
          
          
              then level="${name##*${patch_level_separator}}"
- 
          1
          
              else level=1
- 
          
          
              fi
- 
          1
          
              name="${name%${patch_level_separator}*}"
- 
          1
          
              rvm_debug "Patch name '$name'."
- 
          
          
              while
- 
          3
          
                read -r expanded_name
- 
          
          
              do
- 
          2
          
                rvm_debug "Patch expanded_name '$expanded_name'."
- 
          6
          
                [[ -z "${expanded_name}" ]] || eval "${_variable}+=( \"\${expanded_name}\" )"
- 
          
          
              done < <(
- 
          
          
                __rvm_expand_patch_name "$name" "$level"
- 
          
          
              )
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_apply_patches()
- 
          
          
          {
- 
          1
          
            typeset patch_name patch_level_separator patch_fuzziness patch_level source_directory full_patch_path _save_dir
- 
          1
          
            typeset -a patches
- 
          1
          
            patches=()
- 
          1
          
            patch_level_separator="%"
- 
          1
          
            patch_fuzziness="25" # max fuziness that makes sense is 3 (or there are patches with bigger context ?)
- 
          1
          
            result=0
- 
          1
          
            source_directory="${1:-"${rvm_src_path}/$rvm_ruby_string"}"
- 
          1
          
            (( $# == 0 )) || shift
- 
          
          
          - 
          1
          
            _save_dir="$PWD"
- 
          1
          
            __rvm_cd "$source_directory"
- 
          1
          
            case "${1:-all}" in
- 
          1
          
              (all) __rvm_current_patch_names patches ;;
- 
          
          
              (*) patches=( "$@" ) ;;
- 
          
          
            esac
- 
          1
          
            rvm_debug "All found patches(${#patches[*]}): ${patches[*]}."
- 
          
          
          - 
          2
          
            for patch_name in "${patches[@]}"
- 
          
          
            do
- 
          2
          
              if __rvm_string_match "${patch_name}" "*${patch_level_separator}*"
- 
          
          
              then patch_level="${patch_name##*${patch_level_separator}}"
- 
          2
          
              else patch_level=1
- 
          
          
              fi
- 
          2
          
              patch_name="${patch_name%${patch_level_separator}*}"
- 
          
          
          - 
          4
          
              full_patch_path="$(__rvm_lookup_full_patch_path "$patch_name")"
- 
          2
          
              rvm_debug "Patch full path '$full_patch_path'."
- 
          
          
              if
- 
          2
          
                [[ -z "${full_patch_path:-}" ]]
- 
          
          
              then
- 
          
          
                rvm_warn "Patch '$patch_name' not found."
- 
          
          
                result=1
- 
          
          
              elif
- 
          2
          
                ! __rvm_apply_patch "${patch_name}" "$full_patch_path" "$patch_fuzziness" "$patch_level"
- 
          
          
              then
- 
          
          
                result=1
- 
          
          
              fi
- 
          
          
            done
- 
          1
          
            __rvm_cd "${_save_dir}"
- 
          1
          
            return ${result:-0}
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_apply_patch_prepare()
- 
          
          
          {
- 
          
          
            if
- 
          2
          
              __rvm_string_match "${_full_patch_path}" "http://*" "https://*"
- 
          
          
            then
- 
          
          
              _local_patch_path="$(
- 
          
          
                mktemp ${TMPDIR:-/tmp}/tmp.XXXXXXXXXXXXXXXXXX
- 
          
          
              )"
- 
          
          
              rvm_log "Fetching patch ${_full_patch_path}"
- 
          
          
              (
- 
          
          
                unset curl
- 
          
          
                \curl ${rvm_proxy:+-x}${rvm_proxy:-} -f -L --create-dirs -sS -C - -o "${_local_patch_path}" "${_full_patch_path}"
- 
          
          
              )
- 
          
          
            else
- 
          2
          
              _local_patch_path="${_full_patch_path}"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_apply_patch_remove()
- 
          
          
          {
- 
          
          
            if
- 
          2
          
              __rvm_string_match "${_full_patch_path}" "http://*" "https://*"
- 
          
          
            then
- 
          
          
              \rm -f "${_local_patch_path}"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_apply_patch()
- 
          
          
          {
- 
          2
          
            typeset _patch_name _full_patch_path _local_patch_path _patch_fuzziness _patch_level
- 
          2
          
            _patch_name="$1"
- 
          2
          
            _full_patch_path="$2"
- 
          2
          
            _patch_fuzziness="$3"
- 
          2
          
            _patch_level="$4"
- 
          
          
          - 
          
          
            if
- 
          2
          
              [[ -r "patches.list" ]] &&
- 
          2
          
              GREP_OPTIONS="" \grep "${_patch_name}" "patches.list" >/dev/null
- 
          
          
            then
- 
          
          
              rvm_warn "Patch ${_patch_name} was already applied."
- 
          
          
            else
- 
          2
          
              __rvm_apply_patch_prepare
- 
          2
          
              touch "patches.list"
- 
          2
          
              __rvm_log_command "patch.apply.${_patch_name##*\/}" "Applying patch ${_full_patch_path}" \
- 
          
          
                patch -F ${_patch_fuzziness} -p${_patch_level} -N -f -i "${_local_patch_path}" &&
- 
          2
          
              printf "%b" "${_patch_name}\n" >> "patches.list"
- 
          2
          
              __rvm_apply_patch_remove
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_install_source()
- 
          
          
          {
- 
          1
          
            true ${rvm_ruby_selected_flag:=0}
- 
          
          
          - 
          1
          
            typeset directory db_configure_flags
- 
          1
          
            typeset -a autoconf_flags
- 
          
          
          - 
          1
          
            (( rvm_ruby_selected_flag )) || __rvm_select
- 
          
          
          - 
          1
          
            rvm_log "Installing Ruby from source to: $rvm_ruby_home, this may take a while depending on your cpu(s)..."
- 
          1
          
            __rvm_cd "${rvm_src_path}"
- 
          
          
          - 
          1
          
            if __rvm_fetch_ruby
- 
          1
          
            then true
- 
          
          
            else
- 
          
          
              result=$?
- 
          
          
              rvm_error "There has been an error fetching the ruby interpreter. Halting the installation."
- 
          
          
              return $result
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if __rvm_cd "${rvm_src_path}/$rvm_ruby_string"
- 
          1
          
            then true
- 
          
          
            else
- 
          
          
              result=$?
- 
          
          
              rvm_error "Source directory is missing.  \nDid the download or extraction fail?  \nHalting the installation."
- 
          
          
              return $result
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if [[ -d "${rvm_path}/usr" ]]
- 
          
          
            then
- 
          1
          
              __rvm_add_to_path prepend "${rvm_path}/usr/bin"
- 
          1
          
              builtin hash -r
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if (( ${rvm_static_flag:-0} == 1 ))
- 
          
          
            then
- 
          
          
              if [[ -s "ext/Setup" ]]
- 
          
          
              then
- 
          
          
                echo 'option nodynamic' >> ext/Setup
- 
          
          
                rvm_log "Setting option nodynamic (static)."
- 
          
          
              else
- 
          
          
                rvm_log "
- 
          
          
                You asked for static Ruby compilation however the file ext/Setup
- 
          
          
                appears to be missing from the source directory
- 
          
          
                ${rvm_src_path}/$rvm_ruby_string
- 
          
          
                please investigate this, continuing installation regardless.
- 
          
          
                "
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if __rvm_apply_patches
- 
          1
          
            then true
- 
          
          
            else
- 
          
          
              result="$?"
- 
          
          
              rvm_error "There has been an error applying the specified patches. Halting the installation."
- 
          
          
              return $result
- 
          
          
            fi
- 
          
          
          - 
          
          
            if
- 
          1
          
              (( ${rvm_force_autoconf_flag:-0} == 1 )) || {
- 
          1
          
                [[ -z "${rvm_ruby_configure:-}" ]] &&
- 
          
          
                [[ ! -s "${rvm_src_path}/$rvm_ruby_string/configure" ||
- 
          
          
                  "${rvm_src_path}/$rvm_ruby_string/configure.in" -nt "${rvm_src_path}/$rvm_ruby_string/configure"
- 
          2
          
                ]]
- 
          
          
              }
- 
          
          
            then
- 
          
          
              if
- 
          
          
                builtin command -v autoreconf > /dev/null
- 
          
          
              then
- 
          
          
                if (( ${rvm_force_autoconf_flag:-0} == 1 ))
- 
          
          
                then autoconf_flags+=( -f )
- 
          
          
                fi
- 
          
          
                __rvm_log_command "autoreconf" "$rvm_ruby_string - #autoreconf${autoconf_flags:-}" autoreconf "${autoconf_flags[@]}"
- 
          
          
              else
- 
          
          
                rvm_error "rvm requires autoreconf to install the selected ruby interpreter however autoreconf was not found in the PATH."
- 
          
          
                return 1
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          
          
            if
- 
          1
          
              [[ -n "${rvm_ruby_configure:-""}" ]]
- 
          
          
            then
- 
          
          
              if __rvm_log_command "configure" "$rvm_ruby_string - #configuring" "$rvm_ruby_configure"
- 
          
          
              then true
- 
          
          
              else
- 
          
          
                result=$?
- 
          
          
                rvm_error "There has been an error while configuring. Halting the installation."
- 
          
          
                return $result
- 
          
          
              fi
- 
          
          
            elif
- 
          1
          
              [[ -s ./configure ]]
- 
          
          
            then
- 
          1
          
              rvm_configure_flags=( --prefix="$rvm_ruby_home"  "${rvm_configure_flags[@]}" )
- 
          
          
          - 
          1
          
              __rvm_db "${rvm_ruby_interpreter}_configure_flags" db_configure_flags
- 
          1
          
              if [[ -n "${ZSH_VERSION:-}" ]]
- 
          
          
              then rvm_configure_flags=( ${=db_configure_flags} "${rvm_configure_flags[@]}" )
- 
          1
          
              else rvm_configure_flags=( ${db_configure_flags}  "${rvm_configure_flags[@]}" )
- 
          
          
              fi
- 
          1
          
              __rvm_array_prepend_or_ignore rvm_configure_env CFLAGS= " " "-O3"
- 
          1
          
              __rvm_array_prepend_or_ignore rvm_configure_env CCFLAGS= " " "-O3"
- 
          1
          
              __rvm_array_prepend_or_ignore rvm_configure_env CXXFLAGS= " " "-O3"
- 
          1
          
              __rvm_log_command "configure" "$rvm_ruby_string - #configuring" \
- 
          
          
                "${rvm_configure_env[@]}" ./configure "${rvm_configure_flags[@]}" ||
- 
          
          
              {
- 
          
          
                result=$?
- 
          
          
                rvm_error "There has been an error while running configure. Halting the installation."
- 
          
          
                return $result
- 
          
          
              }
- 
          
          
            else
- 
          
          
              rvm_error "Skipping configure step, 'configure' does not exist, did autoreconf not run successfully?"
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if __rvm_log_command "make" "$rvm_ruby_string - #compiling" ${rvm_ruby_make:-make} "${rvm_make_flags[@]}"
- 
          1
          
            then true
- 
          
          
            else
- 
          
          
              result=$?
- 
          
          
              rvm_error "There has been an error while running make. Halting the installation."
- 
          
          
              return $result
- 
          
          
            fi
- 
          
          
          - 
          1
          
            __rvm_rm_rf "$PWD/.ext/rdoc" # WTF?
- 
          
          
          - 
          1
          
            rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"}
- 
          
          
          - 
          1
          
            if __rvm_run "install" "$rvm_ruby_make_install" "$rvm_ruby_string - #installing "
- 
          1
          
            then true
- 
          
          
            else
- 
          
          
              result=$?
- 
          
          
              rvm_error "There has been an error while running make install. Halting the installation."
- 
          
          
              return $result
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if [[ -s "${rvm_src_path}/$rvm_ruby_string/patches.list" ]]
- 
          1
          
            then \cp -f "${rvm_src_path}/$rvm_ruby_string/patches.list" "$rvm_ruby_home/patches.list"
- 
          
          
            fi
- 
          
          
          - 
          1
          
            case "${rvm_ruby_string:-""}" in
- 
          
          
              ruby-1.8.4|ruby-1.8.5-*)
- 
          
          
                typeset libdir
- 
          
          
                libdir="$rvm_ruby_home/lib"
- 
          
          
                if
- 
          
          
                  [[ -d "${libdir}64" ]]
- 
          
          
                then
- 
          
          
                  \rm -rf "${libdir}"
- 
          
          
                  ln -s "${libdir}64" "${libdir}"
- 
          
          
                fi
- 
          
          
              ;;
- 
          
          
            esac
- 
          
          
          - 
          1
          
            case " ${rvm_configure_flags[*]} " in
- 
          
          
              (*[[:space:]]--program-suffix=*)
- 
          
          
                typeset program_suffix
- 
          
          
                program_suffix="${rvm_configure_flags[*]}"
- 
          
          
                program_suffix="${program_suffix#*--program-suffix=}"
- 
          
          
                program_suffix="${program_suffix%%[\' ]*}"
- 
          
          
                __rvm_log_command "link.ruby" "$rvm_ruby_string - #linking ruby${program_suffix} -> ruby " \
- 
          
          
                  ln -s "$rvm_ruby_home/bin/ruby${program_suffix}" "$rvm_ruby_home/bin/ruby"
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          2
          
            rvm_create_flag=1 __rvm_use &&
- 
          1
          
              "$rvm_scripts_path/rubygems" ${rvm_rubygems_version:-latest} &&
- 
          1
          
              __rvm_generate_wrappers &&
- 
          1
          
              __rvm_log_command "chmod.bin" "" chmod +x "$rvm_ruby_home/bin"/* &&
- 
          1
          
              __rvm_post_install ||
- 
          
          
              return $?
- 
          
          
          - 
          1
          
            rvm_log "Install of $rvm_ruby_string - #complete "
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_install_ruby_try_remote()
- 
          
          
          {
- 
          1
          
            : rvm_disable_binary_flag:${rvm_disable_binary_flag:=0}: rvm_remote_flag:${rvm_remote_flag:=0}:
- 
          1
          
            (( rvm_disable_binary_flag )) ||
- 
          
          
            {
- 
          1
          
              rvm_log "Searching for binary rubies, this might take some time."
- 
          1
          
              typeset __rvm_ruby_url
- 
          2
          
              __rvm_ruby_url="$( __rvm_remote_server_path "${rvm_ruby_string}" )"
- 
          
          
              if
- 
          1
          
                [[ -z "${__rvm_ruby_url}" ]]
- 
          
          
              then
- 
          
          
                  if
- 
          1
          
                    (( rvm_remote_flag ))
- 
          
          
                  then
- 
          
          
                    rvm_error "Requested binary installation but no rubies are available to download, consider skipping --binary flag."
- 
          
          
                    return 1
- 
          
          
                  else
- 
          
          
                    rvm_warn "No binary rubies available for: $(__rvm_system_path -)/${rvm_ruby_string}.
- 
          2
          
          Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies."
- 
          
          
                  fi
- 
          
          
              else
- 
          
          
                  if
- 
          
          
                    rvm_remote_flag=1 "${rvm_scripts_path}/external" mount "${__rvm_ruby_url}" "${rvm_ruby_string}"
- 
          
          
                  then
- 
          
          
                    return 0
- 
          
          
                  else
- 
          
          
                    __rvm_rm_rf "$rvm_rubies_path/$rvm_ruby_string" # cleanup so standard installation works
- 
          
          
                    rvm_warn "Mounting remote ruby failed, trying to compile."
- 
          
          
                  fi
- 
          
          
              fi
- 
          
          
            }
- 
          1
          
            return 2 # continue with compilation
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_install_ruby()
- 
          
          
          {
- 
          1
          
            true ${rvm_head_flag:=0} ${rvm_ruby_selected_flag:=0}
- 
          1
          
            typeset binary __rvm_ruby_name ruby_install_type
- 
          
          
          - 
          
          
            if
- 
          1
          
              (( rvm_ruby_selected_flag == 0 ))
- 
          
          
            then
- 
          1
          
              __rvm_ruby_name="$rvm_ruby_name"
- 
          1
          
              __rvm_select || return $?
- 
          
          
              if
- 
          1
          
                [[ -n "$__rvm_ruby_name" ]]
- 
          
          
              then
- 
          
          
                __rvm_select || return $? # second detection for -n verification
- 
          
          
                if
- 
          
          
                  [[ "$__rvm_ruby_name" != "$detected_rvm_ruby_name" ]]
- 
          
          
                then
- 
          
          
                  rvm_error "
- 
          
          
          The used ruby name (-n) is not valid, it was matched as:
- 
          
          
          - 
          
          
          $( env | GREP_OPTIONS="" \grep "^rvm.*=$__rvm_ruby_name$" || printf "# Was not used at all\n")
- 
          
          
          - 
          
          
          for more details on selecting names please visit:
- 
          
          
          https://rvm.io/rubies/named/
- 
          
          
          " #" fix escaping
- 
          
          
                  return 1
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if [[ -n "${RUBYOPT:-""}" ]]
- 
          
          
            then
- 
          
          
              ruby_options="$RUBYOPT"
- 
          
          
              unset RUBYOPT
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if __rvm_install_ruby_try_remote
- 
          
          
            then return 0
- 
          1
          
            else (( $? == 2 )) || return 1 # 2 => continue with compilation
- 
          
          
            fi
- 
          
          
          - 
          1
          
            if __rvm_check_for_compiler
- 
          1
          
            then true # sok
- 
          
          
            else return $?
- 
          
          
            fi
- 
          
          
          - 
          1
          
            case "${rvm_ruby_interpreter}" in
- 
          
          
              opal|macruby|ree|jruby|maglev|goruby|rubinius|ironruby|ruby|mruby|topaz)
- 
          1
          
                ruby_install_type=$rvm_ruby_interpreter
- 
          
          
                ;;
- 
          
          
              rbx)      ruby_install_type=rubinius ;;
- 
          
          
              ir)       ruby_install_type=ironruby ;;
- 
          
          
              kiji|tcs|jamesgolick) ruby_install_type=ruby     ;;
- 
          
          
              default)
- 
          
          
                rvm_error "a ruby interpreter to install must be specified and not simply 'default'."
- 
          
          
                ;;
- 
          
          
              *)
- 
          
          
                rvm_error "Either the ruby interpreter is unknown or there was an error!."
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          1
          
            export -a rvm_configure_env
- 
          2
          
            [[ -n "${rvm_configure_env[*]}" ]] || rvm_configure_env=() # zsh can assume empty var => ( '' )
- 
          
          
          - 
          1
          
            source "$rvm_scripts_path/functions/manage/${ruby_install_type}"
- 
          1
          
            ${ruby_install_type}_install || return $?
- 
          
          
          - 
          
          
            # Record the Ruby's configuration to a file, key=value format.
- 
          1
          
            __rvm_ruby_config_save "$rvm_ruby_home/bin/ruby"
- 
          1
          
            __rvm_fix_group_permissions "$rvm_ruby_home"
- 
          
          
          - 
          1
          
            rvm_hook="after_install"
- 
          1
          
            source "$rvm_scripts_path/hook"
- 
          
          
          - 
          1
          
            if [[ -n "$ruby_options" ]]
- 
          
          
            then
- 
          
          
              RUBYOPT="$ruby_options"
- 
          
          
              export RUBYOPT
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_fetch_from_git_revision_or_sha()
- 
          
          
          {
- 
          
          
            typeset result
- 
          
          
            if
- 
          
          
              [[ -n "$rvm_ruby_revision" ]]
- 
          
          
            then
- 
          
          
              (
- 
          
          
                __rvm_cd "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
                [[ "$rvm_ruby_revision" != "head" ]] || rvm_ruby_revision="master"
- 
          
          
                git checkout -f "${rvm_ruby_revision}"
- 
          
          
              )
- 
          
          
            elif
- 
          
          
              [[ -n "${rvm_ruby_sha:-}" ]]
- 
          
          
            then
- 
          
          
              (
- 
          
          
                __rvm_cd "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
                git checkout -f "${rvm_ruby_sha}"
- 
          
          
              )
- 
          
          
            fi
- 
          
          
            result=$?
- 
          
          
            if
- 
          
          
              (( result > 0 ))
- 
          
          
            then
- 
          
          
              rvm_error "There has been an error while trying to checkout the source branch.\nHalting the installation."
- 
          
          
              return $result
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_git_clean_repo()
- 
          
          
          {
- 
          
          
            git checkout -f master
- 
          
          
            git reset --hard HEAD
- 
          
          
            \rm -fr .git/rebase-apply
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_fetch_from_github()
- 
          
          
          {
- 
          
          
            __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
- 
          
          
            if
- 
          
          
              [[ -d "${rvm_repos_path}/${rvm_ruby_interpreter}/.git" ]]
- 
          
          
            then
- 
          
          
              typeset existing_uri
- 
          
          
              existing_uri="$(
- 
          
          
                __rvm_cd "${rvm_repos_path}/${rvm_ruby_interpreter}" >/dev/null
- 
          
          
                git remote -v 2>/dev/null | awk '/^origin.*fetch/ {print $2}'
- 
          
          
              )"
- 
          
          
              if
- 
          
          
                [[ "$rvm_ruby_repo_url" != "$existing_uri" ]]
- 
          
          
              then
- 
          
          
                \rm -rf "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          
          
            if
- 
          
          
              [[ ! -d "${rvm_repos_path}/${rvm_ruby_interpreter}/.git" ]]
- 
          
          
            then
- 
          
          
              if [[ -d "${rvm_repos_path}/${rvm_ruby_interpreter}" ]]
- 
          
          
              then \rm -rf "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
              fi
- 
          
          
              __rvm_cd "$rvm_home"
- 
          
          
              if
- 
          
          
                ! __rvm_log_command "$1.repo" "Cloning $rvm_ruby_repo_url" \
- 
          
          
                  git clone --depth ${rvm_git_clone_depth:-1} "$rvm_ruby_repo_url" "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
              then
- 
          
          
                rvm_ruby_repo_http_url="${rvm_ruby_repo_url//git:/http:}"
- 
          
          
                rvm_log "Could not fetch $rvm_ruby_repo_url - trying $rvm_ruby_repo_http_url"
- 
          
          
          - 
          
          
                __rvm_log_command "$1.repo" "Cloning $rvm_ruby_repo_http_url" \
- 
          
          
                  git clone --depth ${rvm_git_clone_depth:-1} "$rvm_ruby_repo_http_url" "${rvm_repos_path}/${rvm_ruby_interpreter}" ||
- 
          
          
                  return $?
- 
          
          
              fi
- 
          
          
            else
- 
          
          
              typeset branch
- 
          
          
              branch="${rvm_ruby_repo_branch:-"master"}"
- 
          
          
              __rvm_cd "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
          - 
          
          
              __rvm_log_command "$1.clean" "Cleaning git repo" __rvm_git_clean_repo
- 
          
          
              __rvm_log_command "$1.fetch" "Fetching from origin" git fetch origin
- 
          
          
            fi
- 
          
          
          - 
          
          
            (
- 
          
          
              remote="origin"
- 
          
          
              __rvm_cd "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
          - 
          
          
              if
- 
          
          
                [[ -z "$(git branch | awk "/$rvm_ruby_repo_branch$/")" ]]
- 
          
          
              then
- 
          
          
                git checkout -b "$rvm_ruby_repo_branch" --track "$remote/$rvm_ruby_repo_branch" 2>/dev/null
- 
          
          
              elif
- 
          
          
                 [[ -z "$(git branch | awk "/\* $rvm_ruby_repo_branch$/")" ]]
- 
          
          
              then
- 
          
          
                if ! git checkout $rvm_ruby_repo_branch 2>/dev/null
- 
          
          
                then
- 
          
          
                  rvm_error "Branch $remote/$rvm_ruby_repo_branch not found."
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
              __rvm_log_command "$1.pull" "Pulling from origin $branch" git pull origin $branch
- 
          
          
            )
- 
          
          
          - 
          
          
            __rvm_fetch_from_git_revision_or_sha || return $?
- 
          
          
          - 
          
          
            if [[ -n "${rvm_ruby_string}" ]]
- 
          
          
            then __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
- 
          
          
            fi
- 
          
          
          - 
          
          
            __rvm_log_command "$1.copy" "Copying from repo to source..." \
- 
          
          
              \cp -Rf "${rvm_repos_path}/${rvm_ruby_interpreter}/" "${rvm_src_path}/$rvm_ruby_string"
- 
          
          
            if
- 
          
          
              [[ -f "${rvm_src_path}/$rvm_ruby_string"/.git  ]]
- 
          
          
            then
- 
          
          
              __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"/.git
- 
          
          
              ln -sf "${rvm_repos_path}/${rvm_ruby_interpreter}"/.git "${rvm_src_path}/$rvm_ruby_string"/.git
- 
          
          
            elif
- 
          
          
              [[ -f "${rvm_src_path}/$rvm_ruby_string"/.svn  ]]
- 
          
          
            then
- 
          
          
              __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"/.svn
- 
          
          
              ln -sf "${rvm_repos_path}/${rvm_ruby_interpreter}"/.svn "${rvm_src_path}/$rvm_ruby_string"/.svn
- 
          
          
            fi
- 
          
          
          - 
          
          
            __rvm_cd "${rvm_src_path}/$rvm_ruby_string"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_fetch_ruby()
- 
          
          
          {
- 
          1
          
            typeset _current_command
- 
          
          
          - 
          1
          
            if (( ${rvm_ruby_selected_flag:=0} == 0 ))
- 
          
          
            then __rvm_select
- 
          
          
            fi
- 
          
          
          - 
          
          
            if
- 
          1
          
              (( ${rvm_head_flag:=0} == 0 )) &&
- 
          3
          
              [[ -z "${rvm_ruby_tag:-}" && -z "${rvm_ruby_revision:-}" && -z "${rvm_ruby_sha:-}" ]]
- 
          
          
            then
- 
          1
          
              rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_string"}"
- 
          1
          
              rvm_ruby_package_file="${rvm_ruby_package_file:-"$rvm_ruby_package_name"}"
- 
          
          
          - 
          1
          
              case "$rvm_ruby_string" in
- 
          
          
                (ruby-1.8.4*) rvm_archive_extension="${rvm_archive_extension:-tar.gz}"  ;;
- 
          1
          
                (ruby-*)      rvm_archive_extension="${rvm_archive_extension:-tar.bz2}" ;;
- 
          
          
                (*)           rvm_archive_extension="${rvm_archive_extension:-tar.gz}"  ;;
- 
          
          
              esac
- 
          
          
          - 
          2
          
              case "$rvm_ruby_interpreter" in
- 
          
          
                (ruby)
- 
          2
          
                  rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_release_version}.${rvm_ruby_major_version}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
- 
          
          
                  ;;
- 
          
          
                (ree)
- 
          
          
                  rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
- 
          
          
                  ;;
- 
          
          
                (jruby)
- 
          
          
                  rvm_error "Trying to compile jruby from binary package - this is a bug, please report to RVM."
- 
          
          
                  return 198
- 
          
          
                  ;;
- 
          
          
                (maglev)
- 
          
          
                  true # Should already be set from selector
- 
          
          
                  ;;
- 
          
          
                (*)
- 
          
          
                  rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
          - 
          1
          
              rvm_log "$rvm_ruby_string - #downloading ${rvm_ruby_package_file}, this may take a while depending on your connection..."
- 
          1
          
              "$rvm_scripts_path/fetch" "${rvm_ruby_url}" ||
- 
          
          
                return $?
- 
          
          
          - 
          
          
              # Remove the directory if it is empty -- empty how?
- 
          2
          
              [[ -d "${rvm_src_path}/$rvm_ruby_string" ]] && rmdir "${rvm_src_path}/$rvm_ruby_string" 2>/dev/null || true
- 
          
          
          - 
          
          
              if
- 
          1
          
                [[ ! -d "${rvm_src_path}/$rvm_ruby_string" ]]
- 
          
          
              then
- 
          1
          
                mkdir -p "${rvm_tmp_path:-/tmp}/rvm_src_$$"
- 
          
          
          - 
          1
          
                __rvm_log_command "extract" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string" \
- 
          
          
                  __rvm_package_extract "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" "${rvm_tmp_path:-/tmp}/rvm_src_$$" ||
- 
          
          
                case $? in
- 
          
          
                  199)
- 
          
          
                    rvm_error "\nUnrecognized archive format '$archive_format'"
- 
          
          
                    return 199
- 
          
          
                    ;;
- 
          
          
                  *)
- 
          
          
                    rvm_error "There has been an error while trying to extract the source. Halting the installation."
- 
          
          
                    return 1
- 
          
          
                    ;;
- 
          
          
                esac
- 
          
          
          - 
          1
          
                __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
- 
          
          
          - 
          
          
                \mv "$(
- 
          
          
                  find ${rvm_tmp_path:-/tmp}/rvm_src_$$ -mindepth 1 -maxdepth 1 -type d
- 
          1
          
                )" "${rvm_src_path}/$rvm_ruby_string"
- 
          1
          
          - 
          1
          
                __rvm_rm_rf "${rvm_tmp_path:-/tmp}/rvm_src_$$"
- 
          
          
          - 
          
          
                if
- 
          1
          
                  [[ -n "${rvm_ruby_name:-""}" && -d "${rvm_src_path}/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" ]]
- 
          
          
                then
- 
          
          
                  \mv "${rvm_src_path}/$(echo "$rvm_ruby_string" | sed -e 's/-n.*//')" "${rvm_src_path}/$rvm_ruby_string"
- 
          
          
                fi
- 
          1
          
                rvm_log "$rvm_ruby_string - #extracted to ${rvm_src_path}/$rvm_ruby_string"
- 
          
          
              else
- 
          
          
                rvm_log "$rvm_ruby_string - #extracted to ${rvm_src_path}/$rvm_ruby_string (already extracted)"
- 
          
          
              fi
- 
          
          
          - 
          1
          
              return 0
- 
          
          
            else # -head
- 
          
          
              mkdir -p "${rvm_repos_path}"
- 
          
          
          - 
          
          
              true ${rvm_ruby_url:="$rvm_ruby_repo_url"}
- 
          
          
          - 
          
          
              if
- 
          
          
                echo "$rvm_ruby_url" | GREP_OPTIONS="" \grep 'git' >/dev/null 2>&1
- 
          
          
              then # Using a  git url.
- 
          
          
                case "$rvm_ruby_interpreter" in
- 
          
          
                  ruby)
- 
          
          
                    # Determine Branch
- 
          
          
                    if [[ -z "${rvm_ruby_repo_branch:-}" ]]
- 
          
          
                    then
- 
          
          
                      if [[ -n "${rvm_ruby_major_version:-}" ]]
- 
          
          
                      then
- 
          
          
                        if [[ -n "${rvm_ruby_minor_version:-}" ]]
- 
          
          
                        then
- 
          
          
                          rvm_ruby_repo_branch="ruby_${rvm_ruby_release_version:-1}_${rvm_ruby_major_version}_${rvm_ruby_minor_version}"
- 
          
          
                        else
- 
          
          
                          rvm_ruby_repo_branch="ruby_${rvm_ruby_release_version:-1}_${rvm_ruby_major_version}"
- 
          
          
                        fi
- 
          
          
                      else
- 
          
          
                        rvm_ruby_repo_branch="trunk" # NOTE: Ruby Core team maps 'trunk' as HEAD
- 
          
          
                      fi
- 
          
          
                    fi
- 
          
          
                    ;;
- 
          
          
          - 
          
          
                  ree|jruby|maglev|*)
- 
          
          
                    rvm_ruby_repo_branch="${rvm_ruby_repo_branch:-"master"}"
- 
          
          
                    ;;
- 
          
          
          - 
          
          
                esac
- 
          
          
          - 
          
          
                # Clone if repository does not yet exist locally
- 
          
          
                if [[ ! -d "${rvm_repos_path}/${rvm_ruby_interpreter}/.git" ]]
- 
          
          
                then
- 
          
          
                  __rvm_rm_rf "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
          - 
          
          
                  rvm_ruby_repo_http_url="${rvm_ruby_repo_url//git:/https:}"
- 
          
          
          - 
          
          
                  typeset git_clone_options
- 
          
          
                  git_clone_options=()
- 
          
          
                  # do not use '--depth 1' be default, we need to allow getting different commits
- 
          
          
                  if [[ -n "${rvm_git_clone_depth:-}" ]]
- 
          
          
                  then git_clone_options+=( --depth ${rvm_git_clone_depth} )
- 
          
          
                  fi
- 
          
          
                  __rvm_log_command "git.clone.git"  "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..." \
- 
          
          
                    git clone "${git_clone_options[@]}" "$rvm_ruby_repo_url"      "${rvm_repos_path}/${rvm_ruby_interpreter}" ||
- 
          
          
                  __rvm_log_command "git.clone.http" "Cloning from $rvm_ruby_repo_http_url, this may take a while depending on your connection..." \
- 
          
          
                    git clone "${git_clone_options[@]}" "$rvm_ruby_repo_http_url" "${rvm_repos_path}/${rvm_ruby_interpreter}" ||
- 
          
          
                  return $?
- 
          
          
                else
- 
          
          
                  (
- 
          
          
                    __rvm_cd "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
                    typeset current_url
- 
          
          
                    current_url="$(git remote -v | awk '$1=="origin" && $3=="(fetch)" {print $2}')"
- 
          
          
                    [[ "$current_url" == "$rvm_ruby_repo_url" ]] || git remote set-url origin "$rvm_ruby_repo_url"
- 
          
          
                  )
- 
          
          
                fi
- 
          
          
          - 
          
          
                # Use the selected branch.
- 
          
          
                (
- 
          
          
                  __rvm_cd "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
          - 
          
          
                  remote="${remote:-origin}"
- 
          
          
                  branch=$(git symbolic-ref -q HEAD 2>/dev/null)
- 
          
          
                  branch=${branch##refs/heads/}
- 
          
          
          - 
          
          
                  git reset --hard HEAD # Ensure we are in a good state.
- 
          
          
                  git fetch "${remote}" # Download the latest updates locally.
- 
          
          
                  if
- 
          
          
                    [[ "$branch" == "${rvm_ruby_repo_branch}" ]]
- 
          
          
                  then
- 
          
          
                    git pull "${remote}" "${rvm_ruby_repo_branch}"
- 
          
          
                  else
- 
          
          
                    case "$(git branch 2>/dev/null)" in
- 
          
          
                      (*[[:space:]]${rvm_ruby_repo_branch}*)
- 
          
          
                        # Not already on the desired branch, but it does exist locally.
- 
          
          
                        git checkout -f "${rvm_ruby_repo_branch}" # Branch is local, checkout
- 
          
          
                        git pull "$remote" "${rvm_ruby_repo_branch}" # Bring local to latest
- 
          
          
                        ;;
- 
          
          
                      (*)
- 
          
          
                        # Desired branch does not exist locally.
- 
          
          
                        if
- 
          
          
                          git checkout -f -t "${remote}/${rvm_ruby_repo_branch}"
- 
          
          
                        then
- 
          
          
                          true
- 
          
          
                        else
- 
          
          
                          result=$?
- 
          
          
                          rvm_error "Branch $remote/$rvm_ruby_repo_branch not found."
- 
          
          
                          return $result
- 
          
          
                        fi
- 
          
          
                        ;;
- 
          
          
                    esac
- 
          
          
                  fi
- 
          
          
                  [[ -z "${rvm_ruby_tag:-}" ]] || git checkout -f -q ${rvm_ruby_tag#t} || return $?
- 
          
          
                )
- 
          
          
                result=$?
- 
          
          
                if (( result > 0 ))
- 
          
          
                then
- 
          
          
                  rvm_error "There has been an error while checking out branch ${rvm_ruby_repo_branch}.  \nHalting the installation."
- 
          
          
                  return $result
- 
          
          
                fi
- 
          
          
                __rvm_fetch_from_git_revision_or_sha || return $?
- 
          
          
              else
- 
          
          
                if
- 
          
          
                  [[ -n "${rvm_ruby_tag:-""}" ]]
- 
          
          
                then
- 
          
          
                  # TODO: Check if tag v is valid
- 
          
          
                  true "${rvm_ruby_url:="$rvm_ruby_repo_url/tags/$(echo "$rvm_ruby_tag" | sed 's/^t//')"}"
- 
          
          
                elif
- 
          
          
                  [[ -z "${rvm_ruby_version:-""}" && ${rvm_head_flag:-0} -eq 1 ]]
- 
          
          
                then
- 
          
          
                  true "${rvm_ruby_url:="$rvm_ruby_repo_url/trunk"}"
- 
          
          
                elif
- 
          
          
                  [[  "${rvm_ruby_major_version:-""}" == "9" ]]
- 
          
          
                then
- 
          
          
                  if
- 
          
          
                    [[ -z "${rvm_ruby_minor_version:-""}" || "${rvm_ruby_minor_version:-""}" = 3 ]]
- 
          
          
                  then
- 
          
          
                    true "${rvm_ruby_url:="$rvm_ruby_repo_url/trunk"}"
- 
          
          
                  else
- 
          
          
                    true "${rvm_ruby_url:="$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}_${rvm_ruby_minor_version}"}"
- 
          
          
                  fi
- 
          
          
                elif
- 
          
          
                  [[ -z "${rvm_ruby_minor_version:-""}" ||
- 
          
          
                    "${rvm_ruby_major_version:-""}.${rvm_ruby_minor_version:-""}" = "8.8"
- 
          
          
                  ]]
- 
          
          
                then
- 
          
          
                  true "${rvm_ruby_url:="$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}"}"
- 
          
          
                else
- 
          
          
                  "${rvm_ruby_url:="$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}_${rvm_ruby_minor_version}"}"
- 
          
          
                fi
- 
          
          
          - 
          
          
                rvm_rev=""
- 
          
          
                if
- 
          
          
                  [[ -n "${rvm_ruby_revision:-""}" ]]
- 
          
          
                then
- 
          
          
                  rvm_rev="-$rvm_ruby_revision"
- 
          
          
                fi
- 
          
          
                (
- 
          
          
                  __rvm_cd "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
                  if
- 
          
          
                    [[ -d "${rvm_repos_path}/${rvm_ruby_interpreter}/.svn" ]]
- 
          
          
                  then
- 
          
          
                    rvm_log "Updating ruby from $rvm_ruby_url"
- 
          
          
                    __rvm_run "svn.switch" "svn switch $rvm_ruby_url"
- 
          
          
                    __rvm_run "svn.update" "svn update"
- 
          
          
          - 
          
          
                    if [[ -n "${rvm_rev:-""}" ]]
- 
          
          
                    then
- 
          
          
                      __rvm_log_command "svn.checkout" "Checking out revision ${rvm_rev/-r/-r } from $rvm_ruby_url" \
- 
          
          
                        svn update -q ${rvm_rev/-r/-r }
- 
          
          
                    fi
- 
          
          
                  else
- 
          
          
                    __rvm_rm_rf "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
                    __rvm_log_command "svn.checkout" "Downloading source from ${rvm_ruby_url}." \
- 
          
          
                      svn checkout -q ${rvm_rev/-r/-r } "$rvm_ruby_url" "${rvm_repos_path}/${rvm_ruby_interpreter}"
- 
          
          
                  fi
- 
          
          
                )
- 
          
          
                result=$?
- 
          
          
                if (( result > 0 ))
- 
          
          
                then
- 
          
          
                  rvm_error "There has been an error while trying to fetch / update the source.  \nHalting the installation."
- 
          
          
                  return $result
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
              rvm_log "Copying from repo to src path..."
- 
          
          
              __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"
- 
          
          
              \cp -R "${rvm_repos_path}/${rvm_ruby_interpreter}" "${rvm_src_path}/$rvm_ruby_string"
- 
          
          
              __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"/.git
- 
          
          
              __rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string"/.svn
- 
          
          
            fi
- 
          
          
            return ${result:-0}
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_check_default()
- 
          
          
          {
- 
          
          
            typeset default_ruby_interpreter current_ruby_interpreter
- 
          
          
            default_ruby_interpreter="$( rvm alias show default 2>/dev/null )"
- 
          
          
            default_ruby_interpreter="${default_ruby_interpreter%%${rvm_gemset_separator:-"@"}*}"
- 
          
          
            current_ruby_interpreter="${rvm_ruby_string%%${rvm_gemset_separator:-"@"}*}"
- 
          
          
            if
- 
          
          
              [[ -n "$current_ruby_interpreter" ]] &&
- 
          
          
              [[ "$current_ruby_interpreter" == "$default_ruby_interpreter" ]]
- 
          
          
            then
- 
          
          
              __rvm_log_command 'default.restore' 'Removing default ruby interpreter' \
- 
          
          
                rvm use system --default
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_uninstall_ruby()
- 
          
          
          {
- 
          
          
            __rvm_remove_ruby uninstall
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remove_ruby()
- 
          
          
          {
- 
          6
          
            (( ${rvm_ruby_selected_flag:=0} )) || __rvm_select
- 
          3
          
            [[ -n "${rvm_ruby_string:-}"    ]] ||
- 
          
          
            {
- 
          
          
              rvm_error "Cannot ${1:-remove} unknown package '$rvm_ruby_string'"
- 
          
          
              return 1
- 
          
          
            }
- 
          
          
          - 
          3
          
            typeset _dir
- 
          6
          
            for _dir in "${rvm_src_path}" "${rvm_rubies_path}"
- 
          
          
            do
- 
          
          
              if
- 
          6
          
                [[ -d "${_dir}/$rvm_ruby_string" ]]
- 
          
          
              then
- 
          3
          
                __rvm_log_command "remove.${_dir##*/}" "Removing ${_dir}/$rvm_ruby_string..." __rvm_rm_rf "${_dir}/$rvm_ruby_string"
- 
          
          
              else
- 
          3
          
                rvm_log "${_dir}/$rvm_ruby_string has already been removed."
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          - 
          
          
            if
- 
          3
          
              [[ -e "${rvm_bin_path}/$rvm_ruby_string" ]]
- 
          
          
            then
- 
          2
          
              \rm -f "${rvm_bin_path}/$rvm_ruby_string"
- 
          
          
            fi
- 
          
          
            if
- 
          3
          
              [[ -d "${rvm_externals_path}/$rvm_ruby_string" ]]
- 
          
          
            then
- 
          
          
              __rvm_log_command "remove.external" "Removing ${rvm_externals_path}/$rvm_ruby_string..." \
- 
          
          
                __rvm_rm_rf "${rvm_externals_path}/$rvm_ruby_string"
- 
          
          
            fi
- 
          
          
          - 
          3
          
            __rvm_remove_install_record "$rvm_ruby_string"
- 
          3
          
            case "${1:-remove}" in
- 
          
          
              (remove)
- 
          3
          
                __rvm_remove_gemsets
- 
          3
          
                __rvm_remove_archives
- 
          3
          
                __rvm_remove_aliases
- 
          3
          
                __rvm_remove_wrappers
- 
          3
          
                __rvm_remove_environments
- 
          3
          
                __rvm_remove_binaries
- 
          
          
                ;;
- 
          
          
              (uninstall)
- 
          
          
                __rvm_remove_gemsets
- 
          
          
                __rvm_check_default
- 
          
          
                ;;
- 
          
          
              (reinstall)
- 
          
          
                true # nothing more to do here!
- 
          
          
                ;;
- 
          
          
            esac
- 
          3
          
            unset rvm_remove_flag
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_reinstall_ruby()
- 
          
          
          {
- 
          
          
            __rvm_remove_ruby reinstall &&
- 
          
          
            __rvm_install_ruby "$@" &&
- 
          
          
            __rvm_gemset_pristine_all "$rvm_ruby_string"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_gemset_pristine_all()
- 
          
          
          {
- 
          
          
            typeset destination_gemset
- 
          
          
            while read -r destination_gemset
- 
          
          
            do __rvm_gemset_pristine "$destination_gemset"
- 
          
          
            done < <(
- 
          
          
              "$rvm_scripts_path/list" gemsets strings | GREP_OPTIONS="" \grep -E "^$1(@.*)?$"
- 
          
          
            )
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remove_gemsets()
- 
          
          
          {
- 
          3
          
            typeset gemset gemsets
- 
          
          
            if
- 
          3
          
              (( ${rvm_gems_flag:=0} == 1 ))
- 
          
          
            then
- 
          3
          
              rvm_log "Removing $rvm_ruby_string gemsets..."
- 
          
          
          - 
          6
          
              gemsets=( $(find -L "${rvm_gems_path:-"$rvm_path/gems"}" -maxdepth 1 "${name_opt}" "${rvm_ruby_string}*" -type d))
- 
          5
          
              for gemset in "${gemsets[@]}"
- 
          
          
              do
- 
          5
          
                if [[ -d "$gemset" ]]
- 
          5
          
                then __rvm_rm_rf "$gemset"
- 
          
          
                fi
- 
          
          
              done
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remove_wrappers()
- 
          
          
          {
- 
          3
          
            rvm_log "Removing $rvm_ruby_string wrappers..."
- 
          3
          
            typeset -a wrappers
- 
          3
          
            typeset wrapper
- 
          
          
          - 
          3
          
            __rvm_read_lines wrappers <(
- 
          3
          
              find "$rvm_wrappers_path" -maxdepth 1 -mindepth 1 -type d "${name_opt}" "*$rvm_ruby_string*" 2>/dev/null
- 
          3
          
              find "$rvm_bin_path" -maxdepth 1 -mindepth 1 "${name_opt}" "*-$rvm_ruby_string" 2>/dev/null
- 
          
          
            )
- 
          19
          
            for wrapper in "${wrappers[@]}"
- 
          
          
            do
- 
          19
          
              __rvm_rm_rf "$wrapper"
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remove_environments()
- 
          
          
          {
- 
          3
          
            rvm_log "Removing $rvm_ruby_string environments..."
- 
          3
          
            typeset environments environment
- 
          
          
          - 
          6
          
            environments=($(find "$rvm_environments_path" -maxdepth 1 -mindepth 1 -type f "${name_opt}" "*$rvm_ruby_string*" ))
- 
          6
          
            for environment in "${environments[@]}"
- 
          
          
            do
- 
          6
          
              if [[ -e "$environment" ]]
- 
          6
          
              then __rvm_rm_rf "$environment"
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remove_aliases()
- 
          
          
          {
- 
          3
          
            rvm_log "Removing $rvm_ruby_string aliases..."
- 
          3
          
            typeset alias_name aliases
- 
          
          
          - 
          9
          
            aliases=($(awk '/'$rvm_ruby_string'/' "$rvm_path/config/alias" | sed 's/=.*//'))
- 
          
          
            for alias_name in "${aliases[@]}"
- 
          
          
            do
- 
          
          
              # Remove from alias key-value store
- 
          
          
              "$rvm_scripts_path/alias" delete "$alias_name" >/dev/null 2>&1
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remove_archives()
- 
          
          
          {
- 
          3
          
            if (( ${rvm_archive_flag:=0} == 1 ))
- 
          
          
            then
- 
          
          
              rvm_log "Removing $rvm_ruby_string archives..."
- 
          
          
              \rm -f ${rvm_archives_path}/${rvm_ruby_package_file}.*
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Iterate over all binaries and check for symlinked wrappers etc.
- 
          
          
          __rvm_remove_binaries()
- 
          
          
          {
- 
          3
          
            rvm_log "Removing $rvm_ruby_string binaries..."
- 
          3
          
            typeset full_binary_path linked_binary_path
- 
          3
          
            typeset -a binaries
- 
          
          
          - 
          3
          
            __rvm_read_lines binaries <(
- 
          3
          
              find "${rvm_bin_path:-$rvm_path/bin}" -maxdepth 1 -mindepth 1 "${name_opt}" "*$rvm_ruby_string" -or "${name_opt}" "*$rvm_ruby_string@*"
- 
          
          
            )
- 
          24
          
            for full_binary_path in "${binaries[@]}"
- 
          
          
            do
- 
          
          
              if
- 
          24
          
                [[ -L "$full_binary_path" ]] &&
- 
          48
          
                __rvm_string_match "$(readlink "$full_binary_path")" "*$rvm_ruby_string/*" "*$rvm_ruby_string@*"
- 
          
          
              then
- 
          24
          
                \rm -f "$full_binary_path"
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_post_install()
- 
          
          
          {
- 
          1
          
            case "$rvm_ruby_interpreter" in
- 
          
          
            (jruby|ree|rbx|mruby) true ;; #skip
- 
          
          
            (*)
- 
          2
          
              (( ${#binaries[@]} )) || binaries=(gem irb erb ri rdoc testrb rake)
- 
          
          
              ;;
- 
          
          
            esac
- 
          
          
          - 
          
          
            if
- 
          1
          
              (( ${#binaries[@]} ))
- 
          
          
            then
- 
          1
          
              rvm_log "$rvm_ruby_string - #adjusting #shebangs for (${binaries[@]})."
- 
          7
          
              for binary in "${binaries[@]}"
- 
          
          
              do
- 
          
          
                if
- 
          8
          
                  [[ -e "$rvm_ruby_home/bin/$binary" || -e "${rvm_src_path}/$rvm_ruby_string/bin/$binary" ]]
- 
          
          
                then
- 
          
          
                  if
- 
          6
          
                    [[ "${rvm_src_path}/$rvm_ruby_string" != "$rvm_ruby_home" ]] &&
- 
          11
          
                    [[ -f "${rvm_src_path}/$rvm_ruby_string/bin/$binary" && ! -L "$rvm_ruby_home/bin/$binary" ]]
- 
          
          
                  then
- 
          5
          
                    \cp -f "${rvm_src_path}/$rvm_ruby_string/bin/$binary" "$rvm_ruby_home/bin/$binary"
- 
          
          
                  elif
- 
          1
          
                    [[ -f "$rvm_ruby_gem_home/bin/$binary" ]]
- 
          
          
                  then
- 
          
          
                    \cp -f "$rvm_ruby_gem_home/bin/$binary" "$rvm_ruby_home/bin/$binary"
- 
          
          
                  fi
- 
          6
          
                  __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
- 
          6
          
                  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
- 
          6
          
                  chmod +x "$rvm_ruby_home/bin/$binary"
- 
          
          
                fi
- 
          
          
              done
- 
          
          
            fi
- 
          1
          
            binaries=(gem irb erb ri rdoc testrb rake) #reset
- 
          1
          
            __rvm_gemsets_initial
- 
          1
          
            __rvm_irbrc
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_inject_ruby_shebang()
- 
          
          
          {
- 
          6
          
            typeset actual_file
- 
          6
          
            __rvm_actual_file $1
- 
          
          
            if
- 
          6
          
              [[ -f "$actual_file" ]]
- 
          
          
            then
- 
          6
          
              __rvm_sed_i "${actual_file}" -e '1,1s=.*=#!'"/usr/bin/env ruby="
- 
          6
          
              [[ -x "$actual_file" ]] || chmod +x "$actual_file"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_inject_gem_env()
- 
          
          
          {
- 
          6
          
            typeset actual_file string
- 
          6
          
            __rvm_actual_file $1
- 
          
          
            if
- 
          6
          
              [[ -s "$actual_file" ]]
- 
          
          
            then
- 
          
          
              if
- 
          18
          
                [[ -n "$(head -n 1 "$actual_file" | awk '/[j]*ruby/')" ]]
- 
          
          
              then
- 
          6
          
                string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_ruby_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_ruby_gem_path'\nENV['PATH']='$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:' + ENV['PATH']\n"
- 
          
          
              elif
- 
          
          
                [[ -n "$(head -n 1 "$actual_file" | awk '/bash/')" ]]
- 
          
          
              then
- 
          
          
                string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_home:$rvm_ruby_global_gems_path'}\nPATH=$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:\$PATH\n"
- 
          
          
              fi
- 
          
          
              if
- 
          6
          
                [[ -n "$string" ]]
- 
          
          
              then
- 
          6
          
                awk "NR==2 {print \"$string\"} {print}" "$actual_file" > "$actual_file.new"
- 
          6
          
                \mv -f $actual_file.new $actual_file
- 
          12
          
                [[ -x "$actual_file" ]] || chmod +x "$actual_file"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_actual_file()
- 
          
          
          {
- 
          12
          
            if [[ -L "$1" ]]                  # If the file is a symlink,
- 
          
          
            then actual_file="$(readlink $1)" # read the link target so we can preserve it.
- 
          12
          
            else actual_file="$1"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_manage_rubies()
- 
          
          
          {
- 
          4
          
            typeset manage_result bin_line current_ruby_string
- 
          4
          
            typeset -a rubies
- 
          4
          
            rubies=()
- 
          
          
          - 
          4
          
            rvm_gemset_name=""
- 
          4
          
            rvm_ruby_selected_flag=0
- 
          4
          
            rvm_ruby_gem_home="${rvm_ruby_gem_home:-""//${rvm_gemset_separator:-"@"}*}"
- 
          4
          
            rvm_ruby_string="${rvm_ruby_string:-""//${rvm_gemset_separator:-"@"}*}"
- 
          
          
          - 
          
          
            # Given list of ruby strings.
- 
          
          
            if
- 
          4
          
              __rvm_string_match "${rubies_string:-}" "old:*"
- 
          
          
            then
- 
          
          
              typeset _older_then
- 
          
          
              _older_then=${rubies_string#old:}
- 
          
          
              if
- 
          
          
                [[ -z "${_older_then}" ]]
- 
          
          
              then
- 
          
          
                # minified https://github.com/mpapis/home_dotfiles/blob/master/bin/git-summary#L5-L50
- 
          
          
                case "$(uname)" in
- 
          
          
                  (Darwin) _older_then="$( date -j -v6m           +%F )" ;;
- 
          
          
                  (*)      _older_then="$( date --date="-6months" +%F )" ;;
- 
          
          
                esac
- 
          
          
              fi
- 
          
          
              __rvm_read_lines rubies < <(
- 
          
          
                __rvm_cd "$rvm_rubies_path"
- 
          
          
                find . -maxdepth 1 -mindepth 1 -type d -not -newermt $_older_then 2>/dev/null | cut -c 3-
- 
          
          
              )
- 
          
          
              (( ${#rubies[*]} )) ||
- 
          
          
              {
- 
          
          
                rvm_warn "No rubies older then ${_older_then}."
- 
          
          
                return 1
- 
          
          
              }
- 
          
          
              __rvm_ask_for "Are you SURE you wish to '$action' ${rubies[*]}?" yes || return $?
- 
          
          
            elif
- 
          8
          
              [[ -n "${rubies_string:-}" && "${rubies_string}" != "all" ]]
- 
          
          
            then
- 
          4
          
              __rvm_custom_separated_array rubies , "${rubies_string}"
- 
          
          
            elif
- 
          
          
              [[ "$action" == "install" ]]
- 
          
          
            then
- 
          
          
              rvm_error 'Really? '"$action"', all? See "rvm list known" and limit the selection to something more sane please :)'
- 
          
          
              return 1
- 
          
          
            elif
- 
          
          
              [[ -z "${rubies_string}" ]]
- 
          
          
            then
- 
          
          
              rvm_error 'Really? '"$action"', all? See "rvm list" and limit the selection to something more sane please :)'
- 
          
          
              return 1
- 
          
          
            else
- 
          
          
              # explicit all && not install
- 
          
          
              if
- 
          
          
                (( ${rvm_force_flag:-0} == 0 )) &&
- 
          
          
                [[ "$action" == "reinstall" || "$action" == "remove" || "$action" == "uninstall" ]]
- 
          
          
              then
- 
          
          
                __rvm_ask_for "Are you SURE you wish to '$action' all rubies?" yes || return $?
- 
          
          
              fi
- 
          
          
              __rvm_read_lines rubies < <(
- 
          
          
                __rvm_cd "$rvm_rubies_path"
- 
          
          
                find . -maxdepth 1 -mindepth 1 -type d 2>/dev/null | cut -c 3-
- 
          
          
              )
- 
          
          
            fi
- 
          
          
          - 
          4
          
            for rvm_ruby_string in "${rubies[@]}"
- 
          
          
            do
- 
          4
          
              rvm_debug "${rvm_ruby_string} - $action"
- 
          4
          
              current_ruby_string="$rvm_ruby_string"
- 
          
          
              if
- 
          
          
                # in () so it does not mess with env. variables
- 
          
          
                (
- 
          4
          
                  rvm_hook="before_install"
- 
          4
          
                  source "$rvm_scripts_path/hook"
- 
          4
          
                  __rvm_${action}_ruby
- 
          
          
                )
- 
          
          
              then
- 
          4
          
                if [[ "$action" == "install" ]]
- 
          1
          
                then __rvm_record_install "$current_ruby_string"
- 
          
          
                fi
- 
          
          
              else
- 
          
          
                : manage_result:${manage_result:=$?}
- 
          
          
              fi
- 
          
          
            done
- 
          4
          
            return "${manage_result:-0}"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_record_ruby_configs()
- 
          
          
          {
- 
          
          
            for dir in "$rvm_path/rubies/"*
- 
          
          
            do
- 
          
          
              string=${dir##*/}
- 
          
          
              if [[ "${string}" == default ]]
- 
          
          
              then continue
- 
          
          
              fi
- 
          
          
              if [[ -x "${rvm_path}/rubies/${string}/bin/ruby" ]]
- 
          
          
              then
- 
          
          
                if [[ -s "${rvm_path}/rubies/${string}/config" ]]
- 
          
          
                then continue
- 
          
          
                else __rvm_ruby_config_save "${rvm_path}/rubies/${string}/bin/ruby"
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_compatibility_flag_configuration()
- 
          
          
          {
- 
          
          
            typeset flag
- 
          
          
            flag="$1"
- 
          
          
            if
- 
          
          
              ! shift
- 
          
          
            then
- 
          
          
              rvm_error "__rvm_compability_flag_configuration requires one param."
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
            if
- 
          
          
              [[ ${rvm_19_flag:-0} == 1 ]]
- 
          
          
            then
- 
          
          
              rvm_configure_flags+=( ${flag}1.9 )
- 
          
          
            elif
- 
          
          
              [[ ${rvm_18_flag:-0} == 1 ]]
- 
          
          
            then
- 
          
          
              rvm_configure_flags+=( ${flag}1.8 )
- 
          
          
            fi
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          ruby_install()
- 
          
          
          {
- 
          1
          
            typeset result temp_flags _iterator
- 
          
          
          - 
          1
          
            case ${rvm_ruby_string:-""} in
- 
          
          
              ruby-1.8.*-head)
- 
          
          
                __rvm_ensure_has_mri_ruby "ruby-1.8.|ree-" || return $?
- 
          
          
                ;;
- 
          
          
              ruby-head|ruby-1.9.*-head)
- 
          
          
                __rvm_ensure_has_mri_ruby || return $?
- 
          
          
                typeset compatible_baseruby
- 
          
          
                if
- 
          
          
                  compatible_baseruby="$rvm_wrappers_path/$(__rvm_mri_ruby)/ruby" &&
- 
          
          
                  [[ -x "$compatible_baseruby" ]]
- 
          
          
                then
- 
          
          
                  rvm_configure_flags+=( --with-baseruby="$compatible_baseruby" )
- 
          
          
                else
- 
          
          
                  return $?
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          
          
            # TODO: needed on some 1.9.3, confirm with http://bugs.ruby-lang.org/issues/6903
- 
          
          
            if
- 
          1
          
              [[ " ${rvm_configure_flags[*]}" =~ " --enable-load-relative" ]]
- 
          
          
            then
- 
          
          
              case ${rvm_ruby_string} in
- 
          
          
                ruby-1.9.3-p125|ruby-1.9.3-p286|ruby-1.9.3-p327|ruby-1.9.3-p362|ruby-1.9.3-p374|ruby-1.9.3-p385)
- 
          
          
                  rvm_patch_names+=( ruby-multilib )
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            fi
- 
          
          
          - 
          
          
          - 
          
          
            (
- 
          1
          
              __rvm_setup_compile_environment "${rvm_ruby_string}" &&
- 
          1
          
              __rvm_install_source $*
- 
          
          
            ) || return $?
- 
          
          
          - 
          
          
            if
- 
          1
          
              [[ "$MACHTYPE" == *darwin* && " ${rvm_configure_flags[*]}" =~ " --enable-load-relative" ]]
- 
          
          
            then
- 
          
          
              typeset libyaml_lib_path_old libyaml_lib_path_new psych_lib_path target_path target_path_escaped
- 
          
          
              target_path="${rvm_rubies_path%/}/${rvm_ruby_string}"
- 
          
          
              target_path_escaped="${target_path//\//\/}"
- 
          
          
              libyaml_lib_path_old="$( find "$target_path" -name libyaml-*.dylib )"
- 
          
          
              libyaml_lib_path_new="${libyaml_lib_path_old/${target_path_escaped}/@executable_path/..}"
- 
          
          
              psych_lib_path="$( find "${target_path}" -name psych.bundle )"
- 
          
          
              __rvm_log_command fix.osx.dependencies "fix osx dependencies" install_name_tool -change "${libyaml_lib_path_old}" "${libyaml_lib_path_new}" "${psych_lib_path}"
- 
          
          
            fi
- 
          
          
          - 
          1
          
            typeset patches_count
- 
          
          
            patches_count=$(
- 
          
          
              rvm_ruby_string="${rvm_ruby_string}" "$rvm_scripts_path/patchsets" show default | wc -l
- 
          1
          
            )
- 
          3
          
          - 
          1
          
            typeset _default _version _patch
- 
          2
          
            _default=$(__rvm_db "default_ruby")
- 
          2
          
            _version=$(__rvm_db "${_default}_version")
- 
          2
          
            _patch=$(__rvm_db "${_default}_${_version}_patch_level")
- 
          1
          
            _version="${_default}-${_version}${_patch:+-}${_patch:-}"
- 
          
          
            if
- 
          2
          
              [[ ! "${rvm_ruby_string}" =~ "${_default}-${_version}" ]] && (( patches_count > 0 ))
- 
          
          
            then
- 
          
          
              rvm_warn "Please be aware that you just installed a ruby that requires ${patches_count} patches just to be compiled on up to date linux system.
- 
          
          
          This may have known and unaccounted for security vulnerabilities.
- 
          1
          
          Please consider upgrading to ${_version} which will have all of the latest security patches."
- 
          
          
            fi
- 
          
          
          - 
          
          
            if
- 
          1
          
              __rvm_compiler_is_llvm && ! __ruby_clang_ok ${rvm_ruby_string}
- 
          
          
            then
- 
          
          
              rvm_warn "Ruby '${rvm_ruby_string}' was built using clang - but it's not (fully) supported, expect errors."
- 
          
          
            fi
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          requirements_debian_lib_installed()
- 
          
          
          {
- 
          29
          
            dpkg -s "$1" >/dev/null 2>/dev/null ||
- 
          7
          
            dpkg-query -Wf'${db:Status-abbrev}' "$1" >/dev/null ||
- 
          
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          requirements_debian_libs_install()
- 
          
          
          {
- 
          
          
            __rvm_try_sudo apt-get --no-install-recommends --quiet --yes install "$@" || return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          requirements_debian_ensure_libs()
- 
          
          
          {
- 
          2
          
            typeset -a packages_installed packages_missing packages_to_install
- 
          2
          
            __rvm_filter_installed_packages debian "$@" || return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          requirements_debian()
- 
          
          
          {
- 
          5
          
            case "$1" in
- 
          
          
              (update-system)
- 
          2
          
                __rvm_try_sudo apt-get --quiet --yes update | __rvm_dotted "Updating repositories"
- 
          
          
                ;;
- 
          
          
              (rvm)
- 
          1
          
                requirements_debian_ensure_libs bash curl git-core patch bzip2 ca-certificates
- 
          
          
                ;;
- 
          
          
              (jruby*head)
- 
          
          
                if (( ${_system_version//./} >= 1110 ))
- 
          
          
                then requirements_debian_ensure_libs ant openjdk-7-jdk
- 
          
          
                else requirements_debian_ensure_libs ant openjdk-6-jdk
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              (jruby*)
- 
          
          
                if (( ${_system_version//./} >= 1110 ))
- 
          
          
                then requirements_debian_ensure_libs g++ openjdk-7-jre-headless
- 
          
          
                else requirements_debian_ensure_libs g++ openjdk-6-jre-headless
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              (ir*)
- 
          
          
                requirements_debian_ensure_libs curl mono-2.0-devel
- 
          
          
                ;;
- 
          
          
              (opal)
- 
          
          
                requirements_debian_ensure_libs nodejs npm
- 
          
          
                ;;
- 
          
          
              (*)
- 
          1
          
                requirements_debian_ensure_libs build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison pkg-config libffi-dev
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          requirements_ubuntu()
- 
          
          
          {
- 
          
          
            requirements_debian "$@"
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          # Reset any rvm gathered information about the system and its state.
- 
          
          
          # rvm will refresh the stored information the next time it is called after reset.
- 
          
          
          __rvm_reset()
- 
          
          
          {
- 
          1
          
            typeset flag flags file files config configs variable
- 
          
          
          - 
          2
          
            __rvm_remove_rvm_from_path ; __rvm_conditionally_add_bin_path
- 
          
          
          - 
          1
          
            export PATH
- 
          
          
          - 
          1
          
            builtin hash -r
- 
          
          
          - 
          1
          
            flags=( default passenger editor )
- 
          
          
          - 
          3
          
            for flag in "${flags[@]}"; do
- 
          
          
          - 
          3
          
              \rm -f "${rvm_bin_path}"/${flag}_*
- 
          
          
          - 
          
          
            done
- 
          
          
          - 
          2
          
            for file in system default ; do
- 
          
          
          - 
          2
          
              if [[ -f "$rvm_path/${file}" ]] ; then
- 
          
          
                \rm -f "$rvm_path/${file}"
- 
          
          
              fi
- 
          
          
          - 
          2
          
              if [[ -f "$rvm_path/config/${file}" ]] ; then
- 
          
          
                \rm -f "$rvm_path/config/${file}"
- 
          
          
              fi
- 
          
          
          - 
          2
          
              if [[ -f "$rvm_environments_path/${file}" ]] ; then
- 
          
          
                \rm -f "$rvm_environments_path/${file}"
- 
          
          
              fi
- 
          
          
          - 
          
          
            done
- 
          
          
          - 
          
          
            # Go back to a clean state.
- 
          1
          
            __rvm_use_system
- 
          
          
          - 
          1
          
            __rvm_unset_ruby_variables
- 
          
          
          - 
          1
          
            __rvm_unset_exports
- 
          
          
          - 
          1
          
            configs=(system_ruby system_gem_path system_user_gem_path)
- 
          
          
          - 
          3
          
            for system_config in "${configs[@]}" ; do
- 
          
          
          - 
          3
          
              "$rvm_scripts_path/db" "$rvm_user_path/db" "$system_config" "delete"
- 
          
          
          - 
          
          
            done
- 
          
          
          - 
          
          
            files=(ruby gem rake irb $(__rvm_cd "${rvm_bin_path}" ; \
- 
          
          
              find . -mindepth 1 -maxdepth 1 -iname 'default*' -type f \
- 
          4
          
              | \sed -e 's#./##g'))
- 
          
          
          - 
          4
          
            for file in "${files[@]}"; do
- 
          
          
          - 
          4
          
              if [[ -f "${rvm_bin_path}/$file" ]] ; then
- 
          
          
          - 
          
          
                \rm -f "${rvm_bin_path}/$file"
- 
          
          
          - 
          
          
              fi
- 
          
          
          - 
          
          
            done
- 
          
          
          - 
          1
          
            return 0
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          528
          
          export escape_flag _first _second
- 
          528
          
          escape_flag=1
- 
          528
          
          _first=${__array_start}
- 
          528
          
          _second=$[__array_start + 1]
- 
          
          
          - 
          
          
          __rvm_md5_for()
- 
          
          
          {
- 
          
          
            if builtin command -v md5 > /dev/null; then
- 
          
          
              echo "$1" | md5
- 
          
          
            elif builtin command -v md5sum > /dev/null ; then
- 
          
          
              echo "$1" | md5sum | awk '{print $1}'
- 
          
          
            else
- 
          
          
              rvm_error "Neither md5 nor md5sum were found in the PATH"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          - 
          
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_sha256_for()
- 
          
          
          {
- 
          
          
            if builtin command -v sha256sum > /dev/null ; then
- 
          
          
              echo "$1" | sha256sum | awk '{print $1}'
- 
          
          
            elif builtin command -v sha256 > /dev/null ; then
- 
          
          
              echo "$1" | sha256 | awk '{print $1}'
- 
          
          
            elif builtin command -v shasum > /dev/null ; then
- 
          
          
              echo "$1" | shasum -a256 | awk '{print $1}'
- 
          
          
            else
- 
          
          
              rvm_error "Neither sha256sum nor shasum found in the PATH"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          - 
          
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_md5_for_contents()
- 
          
          
          {
- 
          26
          
            if builtin command -v md5 > /dev/null
- 
          
          
            then
- 
          
          
              echo "$1" | cat - "$1" | md5
- 
          26
          
            elif builtin command -v md5sum > /dev/null
- 
          
          
            then
- 
          104
          
              echo "$1" | cat - "$1" | md5sum | awk '{print $1}'
- 
          
          
            else
- 
          
          
              rvm_error "Neither md5 nor md5sum were found in the PATH"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          - 
          26
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_sha256_for_contents()
- 
          
          
          {
- 
          26
          
            if builtin command -v sha256sum > /dev/null ; then
- 
          104
          
              echo "$1" | cat - "$1" | sha256sum | awk '{print $1}'
- 
          
          
            elif builtin command -v sha256 > /dev/null ; then
- 
          
          
              echo "$1" | cat - "$1" | sha256 | awk '{print $1}'
- 
          
          
            elif builtin command -v shasum > /dev/null ; then
- 
          
          
              echo "$1" | cat - "$1" | shasum -a256 | awk '{print $1}'
- 
          
          
            else
- 
          
          
              rvm_error "Neither sha256sum nor shasum found in the PATH"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          - 
          26
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_rvmrc_key()
- 
          
          
          {
- 
          76
          
            printf "%b" "$1" | \tr '[#/.=()]' _
- 
          38
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_reset_rvmrc_trust()
- 
          
          
          {
- 
          12
          
            if [[ "$1" == all ]]
- 
          
          
            then
- 
          
          
              echo "" > "$rvm_user_path/rvmrcs"
- 
          
          
            else
- 
          24
          
              "$rvm_scripts_path/db" "$rvm_user_path/rvmrcs" \
- 
          
          
                "$(__rvm_rvmrc_key "$1")" "delete" >/dev/null 2>&1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_trust_rvmrc()
- 
          
          
          {
- 
          8
          
            [[ -f "$1" ]] || return 1
- 
          8
          
            __rvm_reset_rvmrc_trust "$1"
- 
          32
          
            "$rvm_scripts_path/db" "$rvm_user_path/rvmrcs" \
- 
          
          
              "$(__rvm_rvmrc_key "$1")" "1;$(__rvm_md5_for_contents "$1")$(__rvm_sha256_for_contents "$1")" >/dev/null 2>&1 ||
- 
          
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_untrust_rvmrc()
- 
          
          
          {
- 
          1
          
            [[ -f "$1" ]] || return 1
- 
          1
          
            __rvm_reset_rvmrc_trust "$1"
- 
          4
          
            "${rvm_scripts_path:-"$rvm_path/scripts"}/db" "$rvm_user_path/rvmrcs" \
- 
          
          
              "$(__rvm_rvmrc_key "$1")" "0;$(__rvm_md5_for_contents "$1")$(__rvm_sha256_for_contents "$1")" >/dev/null 2>&1 ||
- 
          
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_rvmrc_stored_trust()
- 
          
          
          {
- 
          17
          
            [[ -f "$1" ]] || return 1
- 
          34
          
            "${rvm_scripts_path:-"$rvm_path/scripts"}/db" "$rvm_user_path/rvmrcs" \
- 
          
          
              "$(__rvm_rvmrc_key "$1")" ||
- 
          
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_rvmrc_stored_trust_check()
- 
          
          
          {
- 
          17
          
            typeset rvmrc_path
- 
          17
          
            rvmrc_path="$1"
- 
          
          
          - 
          17
          
            if [[ -f "$rvmrc_path" ]]
- 
          
          
            then
- 
          17
          
              saveIFS=$IFS
- 
          17
          
              IFS=$';'
- 
          34
          
              trust=($(__rvm_rvmrc_stored_trust "$rvmrc_path"))
- 
          17
          
              IFS=$saveIFS
- 
          
          
          - 
          
          
              if
- 
          51
          
                [[ "${trust[${_second}]:-'#'}" != "$(__rvm_md5_for_contents "$rvmrc_path")$(__rvm_sha256_for_contents "$rvmrc_path")" ]]
- 
          
          
              then
- 
          1
          
                echo "The rvmrc at '$rvmrc_path' contains unreviewed changes."
- 
          1
          
                return 1
- 
          
          
              elif
- 
          16
          
                [[ "${trust[${_first}]}" == '1' ]]
- 
          
          
              then
- 
          15
          
                echo "The rvmrc at '$rvmrc_path' is currently trusted."
- 
          15
          
                return 0
- 
          
          
              elif
- 
          1
          
                [[ "${trust[${_first}]}" == '0' ]]
- 
          
          
              then
- 
          1
          
                echo "The rvmrc at '$rvmrc_path' is currently untrusted."
- 
          1
          
                return 1
- 
          
          
              else
- 
          
          
                echo "The trustiworthiness of '$rvmrc_path' is currently unknown."
- 
          
          
                return 1
- 
          
          
              fi
- 
          
          
            else
- 
          
          
              echo "There is no $rvmrc_path"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_rvmrc_tools()
- 
          
          
          {
- 
          55
          
            export escape_flag
- 
          55
          
            typeset rvmrc_action rvmrc_path saveIFS trust rvmrc_ruby
- 
          
          
          - 
          55
          
            escape_flag=1
- 
          
          
          - 
          55
          
            rvmrc_action="$1"
- 
          110
          
            (( $# )) && shift || true
- 
          
          
          - 
          
          
            if
- 
          55
          
              [[ "${rvmrc_action}" == "create" ]]
- 
          
          
            then
- 
          3
          
              rvmrc_ruby="${1:-${GEM_HOME##*/}}"
- 
          9
          
              rvmrc_path="$(__rvm_cd "$PWD" >/dev/null 2>&1; pwd)"
- 
          
          
            elif
- 
          52
          
              [[ "${1:-}" == "all" ]]
- 
          
          
            then
- 
          
          
              rvmrc_path="all"
- 
          
          
            else
- 
          52
          
              if [[ -n "${1:-}" ]]
- 
          50
          
              then rvmrc_path="${1%/.rvmrc}"
- 
          2
          
              else rvmrc_path="$PWD"
- 
          
          
              fi
- 
          156
          
              rvmrc_path="$(__rvm_cd "${rvmrc_path}" >/dev/null 2>&1; pwd)"
- 
          
          
            fi
- 
          110
          
            (( $# )) && shift || true
- 
          
          
          - 
          
          
            if
- 
          55
          
              (( $# ))
- 
          
          
            then
- 
          14
          
              rvmrc_path="${rvmrc_path}/$1"
- 
          
          
            else
- 
          41
          
              __rvm_project_dir_check "${rvmrc_path}" rvmrc_path "${rvmrc_path}/.rvmrc"
- 
          
          
            fi
- 
          
          
          - 
          70
          
            case "$rvmrc_action" in
- 
          
          
              create)
- 
          
          
                (
- 
          6
          
                  rvm_create_flag=1 __rvm_use "${rvmrc_ruby}"
- 
          3
          
                  case "${rvmrc_path}" in
- 
          1
          
                    (*/.rvmrc|*/--rvmrc)                 __rvm_set_rvmrc         ;;
- 
          1
          
                    (*/.ruby-version|*/--ruby-version)   __rvm_set_ruby_version  ;;
- 
          1
          
                    (*/.versions.conf|*/--versions-conf) __rvm_set_versions_conf ;;
- 
          
          
                    (*)
- 
          
          
                      rvm_error "Unrecognized project file format."
- 
          
          
                      return 1
- 
          
          
                      ;;
- 
          
          
                  esac
- 
          
          
                )
- 
          
          
                ;;
- 
          
          
              reset)
- 
          3
          
                __rvm_reset_rvmrc_trust "$rvmrc_path" &&
- 
          3
          
                  rvm_log "Reset trust for $rvmrc_path" ||
- 
          
          
                  rvm_error "Reset trust for $rvmrc_path - failed"
- 
          
          
                ;;
- 
          
          
              trust)
- 
          8
          
                __rvm_trust_rvmrc "$rvmrc_path" &&
- 
          8
          
                  rvm_log "Marked $rvmrc_path as trusted" ||
- 
          
          
                  rvm_error "Marked $rvmrc_path as trusted - failed"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              untrust)
- 
          1
          
                __rvm_untrust_rvmrc "$rvmrc_path" &&
- 
          1
          
                  rvm_log "Marked $rvmrc_path as untrusted" ||
- 
          
          
                  rvm_error "Marked $rvmrc_path as untrusted - failed"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              trusted)
- 
          7
          
                __rvm_rvmrc_stored_trust_check "$rvmrc_path" || return $?
- 
          
          
                ;;
- 
          
          
          - 
          
          
              is_trusted)
- 
          12
          
                __rvm_rvmrc_stored_trust_check "$rvmrc_path" >/dev/null
- 
          
          
                ;;
- 
          
          
          - 
          
          
              load)
- 
          51
          
                rvm_rvmrc_cwd="" rvm_trust_rvmrcs_flag=1 __rvm_project_rvmrc "$rvmrc_path"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              try_to_read_ruby)
- 
          18
          
                case "$rvmrc_path" in
- 
          
          
                  (*/.rvmrc)
- 
          18
          
                    if ! __rvm_rvmrc_tools is_trusted "$(dirname "$rvmrc_path")"  "$(basename "$rvmrc_path")"
- 
          
          
                    then
- 
          
          
                      # subprocess to not mess with current process variables
- 
          
          
                      ( rvm_promptless=1 __rvm_project_rvmrc "$rvmrc_path" >/dev/null 2>&1 )
- 
          
          
                    fi
- 
          
          
          - 
          18
          
                    if __rvm_rvmrc_tools is_trusted "$(dirname "$rvmrc_path")" "$(basename "$rvmrc_path")"
- 
          
          
                    then
- 
          6
          
                      rvm_action="${rvm_action:-use}"
- 
          
          
                      rvm_ruby_string="$(
- 
          
          
                        rvm_rvmrc_cwd=""
- 
          
          
                        rvm_trust_rvmrcs_flag=1
- 
          
          
                        rvm_is_not_a_shell_function=0
- 
          
          
                        __rvm_project_rvmrc "$rvmrc_path" >/dev/null 2>&1
- 
          
          
                        __rvm_env_string
- 
          6
          
                      )"
- 
          12
          
                      rvm_ruby_strings="$rvm_ruby_string"
- 
          6
          
                    else
- 
          6
          
                      rvm_action="error"
- 
          6
          
                      rvm_error_message="The give path does not contain '$(basename "$rvmrc_path")' (or it is not trusted): '$(dirname "$rvmrc_path")' rest of params: '$@'"
- 
          6
          
                    fi
- 
          
          
                  ;;
- 
          
          
                  (*)
- 
          
          
                    rvm_action="${rvm_action:-use}"
- 
          
          
                    rvm_ruby_string="$(
- 
          
          
                      rvm_rvmrc_cwd=""
- 
          
          
                      rvm_trust_rvmrcs_flag=1
- 
          
          
                      __rvm_project_rvmrc "$rvmrc_path" >/dev/null 2>&1
- 
          
          
                      __rvm_env_string
- 
          
          
                    )"
- 
          
          
                    rvm_ruby_strings="$rvm_ruby_string"
- 
          
          
                  ;;
- 
          
          
                esac
- 
          
          
                ;;
- 
          
          
          - 
          
          
              *)
- 
          
          
                rvm_error "Usage: rvm rvmrc {trust,untrust,trusted,load,reset,is_trusted,try_to_read_ruby,create}"
- 
          
          
                return 1
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          53
          
            unset escape_flag
- 
          53
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_check_rvmrc_trustworthiness()
- 
          
          
          {
- 
          15
          
            typeset saveIFS trust result
- 
          
          
            # Trust when they have the flag... of doom!
- 
          30
          
            if [[ -n "$1" && ${rvm_trust_rvmrcs_flag:-0} == 0 ]]
- 
          
          
            then
- 
          
          
              saveIFS="$IFS"
- 
          
          
              IFS=$';'
- 
          
          
              trust=( $( __rvm_rvmrc_stored_trust "$1" ) )
- 
          
          
              IFS="$saveIFS"
- 
          
          
          - 
          
          
              if [[ "${trust[${_second}]:-'#'}" != "$(__rvm_md5_for_contents "$1")$(__rvm_sha256_for_contents "$1")" ]]
- 
          
          
              then
- 
          
          
                __rvm_ask_to_trust "$1"
- 
          
          
              else
- 
          
          
                [[ "${trust[${_first}]}" == '1' ]]
- 
          
          
              fi
- 
          
          
          - 
          
          
            fi
- 
          15
          
            result=$?
- 
          15
          
            unset escape_flag
- 
          15
          
            return $result
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_display_rvmrc()
- 
          
          
          {
- 
          
          
            typeset _rvmrc_base _read_char_flag
- 
          
          
            _rvmrc_base="$(basename "${_rvmrc}")"
- 
          
          
            [[ -n "${ZSH_VERSION:-}" ]] && _read_char_flag=k || _read_char_flag=n
- 
          
          
          - 
          
          
            printf "
- 
          
          
          ==============================================================================
- 
          
          
          = %-74s =
- 
          
          
          = After reading the file, you will be prompted again for 'yes or no' to set  =
- 
          
          
          = the trust level for this particular version of the file.                   =
- 
          
          
          =                                                                            =
- 
          
          
          = %-74s =
- 
          
          
          = changes, and may change the trust setting manually at any time.            =
- 
          
          
          ==============================================================================
- 
          
          
          (( press a key to review the ${_rvmrc_base} file ))
- 
          
          
          " \
- 
          
          
          "The contents of the ${_rvmrc_base} file will now be displayed." \
- 
          
          
          "Note: You will be re-prompted each time the ${_rvmrc_base} file's contents change"
- 
          
          
          builtin read -${_read_char_flag} 1 -s -r anykey
- 
          
          
          - 
          
          
          printf "%b" "${rvm_warn_clr}"
- 
          
          
          command cat -v "${_rvmrc}"
- 
          
          
          printf "%b" "${rvm_reset_clr}"
- 
          
          
          - 
          
          
            printf "
- 
          
          
          ==============================================================================
- 
          
          
          = %-74s =
- 
          
          
          ==============================================================================
- 
          
          
          = %-74s =
- 
          
          
          = %-74s =
- 
          
          
          = Note that if the contents of the file change, you will be re-prompted to   =
- 
          
          
          = review the file and adjust its trust settings. You may also change the     =
- 
          
          
          = trust settings manually at any time with the 'rvm rvmrc' command.          =
- 
          
          
          ==============================================================================
- 
          
          
          - 
          
          
          " \
- 
          
          
          "Viewing of ${_rvmrc} complete." \
- 
          
          
          "Trusting an ${_rvmrc_base} file means that whenever you cd into this directory," \
- 
          
          
          "RVM will run this ${_rvmrc_base} shell script."
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_ask_to_trust()
- 
          
          
          {
- 
          
          
            typeset trusted value anykey _rvmrc
- 
          
          
            _rvmrc="${1}"
- 
          
          
          - 
          
          
            if [[ ! -t 0 ]] || (( ${rvm_promptless:=0} == 1 )) || [[ -n "$MC_SID" ]]
- 
          
          
            then
- 
          
          
              return 2
- 
          
          
            fi
- 
          
          
          - 
          
          
            printf "==============================================================================
- 
          
          
          = NOTICE                                                                     =
- 
          
          
          ==============================================================================
- 
          
          
          = %-74s =
- 
          
          
          = This is a shell script and therefore may contain any shell commands.       =
- 
          
          
          =                                                                            =
- 
          
          
          = Examine the contents of this file carefully to be sure the contents are    =
- 
          
          
          = safe before trusting it! ( Choose v[iew] below to view the contents )      =
- 
          
          
          ==============================================================================
- 
          
          
          " \
- 
          
          
          "RVM has encountered a new or modified $(basename "${_rvmrc}") file in the current directory"
- 
          
          
            trusted=0
- 
          
          
            while (( ! trusted ))
- 
          
          
            do
- 
          
          
              printf "Do you wish to trust this $(basename "${_rvmrc}") file? (%b)\n" "${_rvmrc}"
- 
          
          
              printf "%b" 'y[es], n[o], v[iew], c[ancel]> '
- 
          
          
          - 
          
          
              builtin read response
- 
          
          
              value="$(echo -n "${response}" | \tr '[[:upper:]]' '[[:lower:]]' | __rvm_strip)"
- 
          
          
          - 
          
          
              case "${value:-n}" in
- 
          
          
                v|view)
- 
          
          
                  __rvm_display_rvmrc
- 
          
          
                  ;;
- 
          
          
                y|yes)
- 
          
          
                  trusted=1
- 
          
          
                  ;;
- 
          
          
                n|no)
- 
          
          
                  break
- 
          
          
                  ;;
- 
          
          
                c|cancel)
- 
          
          
                  return 1
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            done
- 
          
          
          - 
          
          
            if (( trusted ))
- 
          
          
            then
- 
          
          
              __rvm_trust_rvmrc "$1"
- 
          
          
              return 0
- 
          
          
            else
- 
          
          
              __rvm_untrust_rvmrc "$1"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Checks the rvmrc for the given directory. Note that if
- 
          
          
          # argument is passed, it will be used instead of pwd.
- 
          
          
          __rvm_project_rvmrc()
- 
          
          
          {
- 
          32
          
            export __rvm_project_rvmrc_lock
- 
          32
          
            : __rvm_project_rvmrc_lock:${__rvm_project_rvmrc_lock:=0}
- 
          32
          
            : __rvm_project_rvmrc_lock:$((__rvm_project_rvmrc_lock+=1))
- 
          32
          
            if (( __rvm_project_rvmrc_lock > 1 ))
- 
          
          
            then return 0 # no nesting
- 
          
          
            fi
- 
          
          
          - 
          32
          
            typeset working_dir found_file rvm_trustworthiness_result
- 
          
          
          - 
          
          
            # Get the first argument or the pwd.
- 
          32
          
            working_dir="${1:-"$PWD"}"
- 
          
          
          - 
          52
          
            while :
- 
          
          
            do
- 
          
          
              if
- 
          204
          
                [[ -z "$working_dir" || "$HOME" == "$working_dir" || "${rvm_prefix:-}" == "$working_dir"  || "/" == "$working_dir" ]]
- 
          
          
              then
- 
          
          
                if
- 
          7
          
                  [[ -n "${rvm_current_rvmrc:-""}" ]]
- 
          
          
                then
- 
          1
          
                  __rvm_remove_rvm_from_path
- 
          1
          
                  __rvm_conditionally_add_bin_path
- 
          
          
                  if
- 
          1
          
                    (( ${rvm_project_rvmrc_default:-0} == 1 ))
- 
          
          
                  then
- 
          
          
                    __rvm_load_environment "default"
- 
          
          
                  elif
- 
          1
          
                    [[ -n "${rvm_previous_environment:-""}" ]]
- 
          
          
                  then
- 
          1
          
                    __rvm_load_environment "$rvm_previous_environment"
- 
          
          
                  fi
- 
          1
          
                  unset rvm_current_rvmrc rvm_previous_environment
- 
          
          
                fi
- 
          7
          
                break
- 
          
          
              else
- 
          
          
                if
- 
          45
          
                  __rvm_project_dir_check "$working_dir" found_file
- 
          
          
                then
- 
          
          
                  if
- 
          25
          
                    [[ "${rvm_current_rvmrc:-""}" != "${found_file}" ]]
- 
          
          
                  then
- 
          24
          
                    __rvm_conditionally_do_with_env __rvm_load_project_config "${found_file}" ||
- 
          
          
                    {
- 
          
          
                      rvm_trustworthiness_result=$?
- 
          
          
                      unset __rvm_project_rvmrc_lock
- 
          
          
                      return "$rvm_trustworthiness_result"
- 
          
          
                    }
- 
          
          
                  fi
- 
          25
          
                  break
- 
          
          
                else
- 
          40
          
                  working_dir="$(dirname "$working_dir")"
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          - 
          32
          
            unset __rvm_project_rvmrc_lock
- 
          32
          
            return 1
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_load_project_config()
- 
          
          
          {
- 
          24
          
            typeset __gemfile
- 
          24
          
            : rvm_autoinstall_bundler_flag:${rvm_autoinstall_bundler_flag:=0}
- 
          24
          
            case "$1" in
- 
          
          
              (*/.rvmrc)
- 
          15
          
                if __rvm_check_rvmrc_trustworthiness "$1"
- 
          
          
                then
- 
          30
          
                  __rvm_remove_rvm_from_path ; __rvm_conditionally_add_bin_path
- 
          30
          
                  rvm_previous_environment="$(__rvm_env_string)"
- 
          15
          
                  rvm_current_rvmrc="$1"
- 
          15
          
                  __rvm_ensure_is_a_function
- 
          
          
          - 
          30
          
                  rvm_action=use source "$1"
- 
          
          
          - 
          
          
                else return $?
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              (*/.versions.conf)
- 
          7
          
                typeset _gem _gem_names _bundle_install
- 
          7
          
                __rvm_ensure_is_a_function
- 
          14
          
                rvm_previous_environment="$(__rvm_env_string)"
- 
          7
          
                rvm_current_rvmrc="$1"
- 
          
          
          - 
          14
          
                rvm_ruby_string="$(sed -n '/^ruby=/ {s/ruby=//;p;}' < "$1")"
- 
          7
          
                [[ -n "${rvm_ruby_string}" ]] || return 2
- 
          14
          
                rvm_gemset_name="$(sed -n '/^ruby-gemset=/ {s/ruby-gemset=//;p;}' < "$1")"
- 
          14
          
                rvm_create_flag=1 __rvm_use   || return 3
- 
          
          
                # TODO: read env.* # how to sanitize ?
- 
          
          
          - 
          14
          
                _gem_names="$(sed -n '/^ruby-gem-install=/ {s/ruby-gem-install=//;p;}' < "$1")"
- 
          2
          
                for _gem in ${_gem_names//,/ }
- 
          
          
                do
- 
          
          
                  # TODO: add support for versions
- 
          6
          
                  if ! gem list | GREP_OPTIONS="" \grep "^${_gem} " > /dev/null
- 
          1
          
                  then gem install "${_gem}"
- 
          
          
                  fi
- 
          
          
                done
- 
          
          
          - 
          14
          
                _bundle_install="$(sed -n '/^ruby-bundle-install=/ {s/ruby-bundle-install=//;p;}' < "$1")"
- 
          13
          
                if [[ -n "${_bundle_install}" ]] || [[ "${rvm_autoinstall_bundler_flag:-0}" == 1 ]]
- 
          
          
                then
- 
          1
          
                  if [[ "${_bundle_install}" == true ]] # prevent file named true for Gemfile
- 
          2
          
                  then __gemfile="$(dirname $1)/Gemfile"
- 
          
          
          - 
          
          
                  elif [[ -f "${_bundle_install}" ]]
- 
          
          
                  then __gemfile="${_bundle_install}"
- 
          
          
          - 
          
          
                  elif [[ "${rvm_autoinstall_bundler_flag:-0}" == 1 ]]
- 
          
          
                  then __gemfile="$(dirname $1)/Gemfile"
- 
          
          
          - 
          
          
                  fi
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              (*/Gemfile)
- 
          1
          
                __rvm_ensure_is_a_function
- 
          2
          
                rvm_previous_environment="$(__rvm_env_string)"
- 
          1
          
                rvm_current_rvmrc="$1"
- 
          
          
          - 
          2
          
                rvm_ruby_string="$(sed -n '/^#ruby=/ {s/#ruby=//;p;}' < "$1")"
- 
          1
          
                [[ -n "${rvm_ruby_string}" ]] || {
- 
          
          
                  rvm_ruby_string="$(sed -n "s/ rescue nil$//; /^\s*ruby/ {s/^\s*ruby//; s/[ ()'\"]//g; p;}" < "$1")"
- 
          
          
                  [[ -n "${rvm_ruby_string}" ]] || return 2
- 
          
          
                }
- 
          2
          
                rvm_gemset_name="$(sed -n '/^#ruby-gemset=/ {s/#ruby-gemset=//;p;}' < "$1")"
- 
          2
          
                rvm_create_flag=1 __rvm_use   || return 3
- 
          
          
          - 
          
          
                # TODO: read #env.* # how to sanitize ?
- 
          
          
          - 
          1
          
                if [[ "${rvm_autoinstall_bundler_flag:-0}" == "1" ]]
- 
          
          
                then
- 
          
          
                  __gemfile="$1"
- 
          
          
                  gem list | GREP_OPTIONS="" \grep "^bundler " > /dev/null ||
- 
          
          
                    gem install bundler
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              (*/.ruby-version|*/.rbfu-version|*/.rbenv-version)
- 
          1
          
                __rvm_ensure_is_a_function
- 
          2
          
                rvm_previous_environment="$(__rvm_env_string)"
- 
          1
          
                rvm_current_rvmrc="$1"
- 
          
          
          - 
          2
          
                rvm_ruby_string="$(cat "$1")"
- 
          1
          
                [[ -n "${rvm_ruby_string}" ]] || return 2
- 
          2
          
                if [[ -f "$(dirname $1)/.ruby-gemset" ]]
- 
          
          
                then
- 
          
          
                  rvm_gemset_name="$(cat "$(dirname $1)/.ruby-gemset")"
- 
          
          
                fi
- 
          2
          
                rvm_create_flag=1 __rvm_use   || return 3
- 
          
          
                # "$(dirname $1)/.rbenv-vars" ... can we support those without licensing ?
- 
          
          
          - 
          1
          
                if [[ "${rvm_autoinstall_bundler_flag:-0}" == 1 && -f "$(dirname $1)/Gemfile" ]]
- 
          
          
                then
- 
          
          
                  if ! gem list | GREP_OPTIONS="" \grep "^bundler " > /dev/null
- 
          
          
                  then
- 
          
          
                    gem install "bundler"
- 
          
          
                  fi
- 
          
          
                  __gemfile="$(dirname $1)/Gemfile"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              (*)
- 
          
          
                rvm_error "Unsupported file format for '$1'"
- 
          
          
                return 1
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          25
          
            if [[ -n "${__gemfile:-}" && -f "${__gemfile:-}" ]]
- 
          3
          
            then bundle install --gemfile="${__gemfile}" | GREP_OPTIONS="" \grep -vE '^Using|Your bundle is complete'
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_set_versions_conf()
- 
          
          
          {
- 
          3
          
            typeset gemset identifier
- 
          
          
          - 
          3
          
            if [[ -s .versions.conf ]]
- 
          
          
            then
- 
          
          
              \mv .versions.conf .versions.conf.$(date +%m.%d.%Y-%H:%M:%S)
- 
          
          
              rvm_warn ".version.conf is not empty, moving aside to preserve."
- 
          
          
            fi
- 
          
          
          - 
          6
          
            identifier=$(__rvm_env_string)
- 
          3
          
            gemset=${identifier#*@}
- 
          3
          
            identifier=${identifier%@*}
- 
          
          
          - 
          3
          
            printf "%b" "ruby=$identifier
- 
          
          
          " >> .versions.conf
- 
          6
          
            if [[ -n "$gemset" && "$gemset" != "$identifier" ]]
- 
          
          
            then
- 
          2
          
              printf "%b" "ruby-gemset=$gemset
- 
          
          
          " >> .versions.conf
- 
          
          
            else
- 
          1
          
              printf "%b" "#ruby-gemset=my-projectit
- 
          
          
          " >> .versions.conf
- 
          
          
            fi
- 
          3
          
            printf "%b" "#ruby-gem-install=bundler rake
- 
          
          
          #ruby-bundle-install=true
- 
          
          
          " >> .versions.conf
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_set_ruby_version()
- 
          
          
          {
- 
          1
          
            if [[ -s .ruby-version ]]
- 
          
          
            then
- 
          
          
              \mv .ruby-version .ruby-version.$(date +%m.%d.%Y-%H:%M:%S)
- 
          
          
              rvm_warn ".ruby-version is not empty, moving aside to preserve."
- 
          
          
            fi
- 
          
          
          - 
          2
          
            echo "$(__rvm_env_string)" >> .ruby-version
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_set_rvmrc()
- 
          
          
          {
- 
          1
          
            typeset flags identifier short_identifier gem_file
- 
          1
          
            true ${rvm_verbose_flag:=0}
- 
          
          
          - 
          2
          
            if [[ "$HOME" != "$PWD" && "${rvm_prefix:-}" != "$PWD" ]]
- 
          
          
            then
- 
          1
          
              if (( rvm_verbose_flag ))
- 
          
          
              then
- 
          
          
                flags="use "
- 
          
          
              fi
- 
          
          
          - 
          1
          
              if [[ -s .rvmrc ]]
- 
          
          
              then
- 
          
          
                \mv .rvmrc .rvmrc.$(date +%m.%d.%Y-%H:%M:%S)
- 
          
          
                rvm_warn ".rvmrc is not empty, moving aside to preserve."
- 
          
          
              fi
- 
          
          
          - 
          2
          
              identifier=$(__rvm_env_string)
- 
          1
          
              short_identifier="${identifier#ruby-}"
- 
          1
          
              short_identifier="${short_identifier%%-*}"
- 
          
          
          - 
          1
          
              printf "%b" "#!/usr/bin/env bash
- 
          
          
          - 
          
          
          # This is an RVM Project .rvmrc file, used to automatically load the ruby
- 
          
          
          # development environment upon cd'ing into the directory
- 
          
          
          - 
          
          
          # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
- 
          
          
          # Only full ruby name is supported here, for short names use:
- 
          
          
          #     echo \"rvm use ${short_identifier}\" > .rvmrc
- 
          
          
          environment_id=\"$identifier\"
- 
          
          
          - 
          
          
          # Uncomment the following lines if you want to verify rvm version per project
- 
          
          
          # rvmrc_rvm_version=\"${rvm_version}\" # 1.10.1 seams as a safe start
- 
          
          
          # eval \"\$(echo \${rvm_version}.\${rvmrc_rvm_version} | awk -F. '{print \"[[ \"\$1*65536+\$2*256+\$3\" -ge \"\$4*65536+\$5*256+\$6\" ]]\"}' )\" || {
- 
          
          
          #   echo \"This .rvmrc file requires at least RVM \${rvmrc_rvm_version}, aborting loading.\"
- 
          
          
          #   return 1
- 
          
          
          # }
- 
          
          
          " >> .rvmrc
- 
          1
          
              if __rvm_string_match "$identifier" "jruby*"
- 
          
          
              then
- 
          
          
                printf "%b" "
- 
          
          
          # Uncomment following line if you want options to be set only for given project.
- 
          
          
          # PROJECT_JRUBY_OPTS=( --1.9 )
- 
          
          
          # The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
- 
          
          
          #    chmod +x \${rvm_path}/hooks/after_use_jruby_opts
- 
          
          
          " >> .rvmrc
- 
          
          
              fi
- 
          1
          
              printf "%b" "
- 
          
          
          # First we attempt to load the desired environment directly from the environment
- 
          
          
          # file. This is very fast and efficient compared to running through the entire
- 
          
          
          # CLI and selector. If you want feedback on which environment was used then
- 
          
          
          # insert the word 'use' after --create as this triggers verbose mode.
- 
          
          
          if [[ -d \"\${rvm_path:-\$HOME/.rvm}/environments\"
- 
          
          
            && -s \"\${rvm_path:-\$HOME/.rvm}/environments/\$environment_id\" ]]
- 
          
          
          then
- 
          
          
            \\. \"\${rvm_path:-\$HOME/.rvm}/environments/\$environment_id\"
- 
          
          
            for __hook in \"\${rvm_path:-\$HOME/.rvm}/hooks/after_use\"*
- 
          
          
            do
- 
          
          
              if [[ -f \"\${__hook}\" && -x \"\${__hook}\" && -s \"\${__hook}\" ]]
- 
          
          
              then \\. \"\${__hook}\" || true
- 
          
          
              fi
- 
          
          
            done
- 
          
          
            unset __hook
- 
          
          
          " >> .rvmrc
- 
          1
          
              if [[ " $flags " =~ " use " ]]
- 
          
          
              then
- 
          
          
                printf "%b" "  if [[ \$- == *i* ]] # check for interactive shells
- 
          
          
            then echo \"Using: \$(tput setaf 2)\$GEM_HOME\$(tput sgr0)\" # show the user the ruby and gemset they are using in green
- 
          
          
            else echo \"Using: \$GEM_HOME\" # don't use colors in non-interactive shells
- 
          
          
            fi
- 
          
          
          " >> .rvmrc
- 
          
          
              fi
- 
          1
          
              printf "%b" "else
- 
          
          
            # If the environment file has not yet been created, use the RVM CLI to select.
- 
          
          
            rvm --create $flags \"\$environment_id\" || {
- 
          
          
              echo \"Failed to create RVM environment '\${environment_id}'.\"
- 
          
          
              return 1
- 
          
          
            }
- 
          
          
          fi
- 
          
          
          " >> .rvmrc
- 
          1
          
              for gem_file in *.gems
- 
          
          
              do
- 
          1
          
                case "$gem_file" in
- 
          1
          
                  (\*.gems) continue ;;
- 
          
          
                esac
- 
          
          
                printf "%b" "
- 
          
          
          # If you use an RVM gemset file to install a list of gems (*.gems), you can have
- 
          
          
          # it be automatically loaded. Uncomment the following and adjust the filename if
- 
          
          
          # necessary.
- 
          
          
          #
- 
          
          
          # filename=\".gems\"
- 
          
          
          # if [[ -s \"\$filename\" ]]
- 
          
          
          # then
- 
          
          
          #   rvm gemset import \"\$filename\" | GREP_OPTIONS="" \grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
- 
          
          
          # fi
- 
          
          
          " >> .rvmrc
- 
          
          
              done
- 
          1
          
              if [[ -s Gemfile ]]
- 
          
          
              then
- 
          
          
                printf "%b" "
- 
          
          
          # If you use bundler, this might be useful to you:
- 
          
          
          # if [[ -s Gemfile ]] && {
- 
          
          
          #   ! builtin command -v bundle >/dev/null ||
- 
          
          
          #   builtin command -v bundle | GREP_OPTIONS="" \grep \$rvm_path/bin/bundle >/dev/null
- 
          
          
          # }
- 
          
          
          # then
- 
          
          
          #   printf \"%b\" \"The rubygem 'bundler' is not installed. Installing it now.\\\\n\"
- 
          
          
          #   gem install bundler
- 
          
          
          # fi
- 
          
          
          # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
- 
          
          
          # then
- 
          
          
          #   bundle install | GREP_OPTIONS="" \grep -vE '^Using|Your bundle is complete'
- 
          
          
          # fi
- 
          
          
          " >> .rvmrc
- 
          
          
              fi
- 
          
          
            else
- 
          
          
              rvm_error ".rvmrc cannot be set in your home directory.\
- 
          
          
                \nThe home .rvmrc is for global rvm settings only."
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_project_dir_check()
- 
          
          
          {
- 
          92
          
            typeset _found_file path_to_check variable variable_default
- 
          92
          
            typeset -a _valid_files
- 
          92
          
            path_to_check="$1"
- 
          92
          
            variable="${2:-}"
- 
          92
          
            variable_default="${3:-}"
- 
          
          
            _valid_files=(
- 
          
          
              "$path_to_check"
- 
          
          
              "$path_to_check/.rvmrc" "$path_to_check/.versions.conf" "$path_to_check/.ruby-version"
- 
          
          
              "$path_to_check/.rbfu-version" "$path_to_check/.rbenv-version" "$path_to_check/Gemfile"
- 
          92
          
            )
- 
          
          
          - 
          113
          
            __rvm_find_first_file _found_file "${_valid_files[@]}" || true
- 
          
          
          - 
          92
          
            if [[ "${_found_file##*/}" == "Gemfile" ]]
- 
          
          
            then
- 
          4
          
              [[ -s "$_found_file" ]] && {
- 
          8
          
                GREP_OPTIONS="" \grep "^#ruby="  "$_found_file" >/dev/null ||
- 
          4
          
                GREP_OPTIONS="" \grep "^\s*ruby" "$_found_file" >/dev/null
- 
          
          
              } ||
- 
          2
          
                _found_file=""
- 
          
          
            fi
- 
          
          
          - 
          92
          
            if [[ -n "$variable" ]]
- 
          172
          
            then eval "$variable=\"\${_found_file:-$variable_default}\""
- 
          
          
            fi
- 
          
          
          - 
          112
          
            [[ -n "${_found_file:-$variable_default}" ]] || return $?
- 
          
          
          }
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          printenv_null()
- 
          
          
          {
- 
          3
          
            if printenv --null >/dev/null 2>/dev/null
- 
          
          
            then
- 
          3
          
              printenv --null
- 
          
          
            else
- 
          
          
              # this messes with escape sequences but allows new lines in variables
- 
          
          
              printenv | sed '/=/ { s/=.*$//; p; }; d;' | while read name
- 
          
          
              do
- 
          
          
                zero="\0"
- 
          
          
                eval "eval \"printf '%b' '$name=\$$name$zero'\""
- 
          
          
              done
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          #
- 
          
          
          # RVM specific functions.
- 
          
          
          #
- 
          
          
          - 
          
          
          __rvm_warn_on_rubyopt()
- 
          
          
          {
- 
          1
          
            if [[ -n "${RUBYOPT:-""}" ]]; then
- 
          
          
              rvm_warn \
- 
          
          
                "Please note: You have the RUBYOPT environment variable set and this \
- 
          
          
                      may interfere with normal rvm operations. We sugges unsetting it."
- 
          
          
              return 1
- 
          
          
            else
- 
          1
          
              return 0
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_strings()
- 
          
          
          {
- 
          
          
            typeset strings ruby_strings
- 
          
          
          - 
          
          
            ruby_strings=($(echo ${rvm_ruby_args:-$rvm_ruby_string}))
- 
          
          
          - 
          
          
            for rvm_ruby_string in "${ruby_strings[@]}" ; do
- 
          
          
              strings="$strings $(__rvm_select ; echo $rvm_ruby_string)"
- 
          
          
            done
- 
          
          
          - 
          
          
            echo $strings
- 
          
          
          - 
          
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          # Return a list of directories under a given base path.
- 
          
          
          # Derived from rvm_ruby_string.
- 
          
          
          __rvm_ruby_string_paths_under()
- 
          
          
          {
- 
          5
          
            typeset __search_path part parts IFS
- 
          5
          
            IFS=" "
- 
          
          
          - 
          5
          
            __search_path="${1%/}" # Strip off any trailing slash
- 
          
          
          - 
          5
          
            if [[ -n "${ZSH_VERSION:-}" ]]
- 
          
          
            then parts=(${=rvm_ruby_string//-/ })
- 
          5
          
            else parts=(${rvm_ruby_string//-/ }) # Strip white space.
- 
          
          
            fi
- 
          
          
          - 
          5
          
            echo "$__search_path"
- 
          19
          
            for part in "${parts[@]}"
- 
          
          
            do
- 
          19
          
              __search_path="$__search_path/$part"
- 
          19
          
              echo "$__search_path"
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          # Run a specified command and log it.
- 
          
          
          __rvm_run()
- 
          
          
          {
- 
          6
          
            typeset name message
- 
          6
          
            typeset -a _command_array
- 
          
          
          - 
          6
          
            name="${1:-}"
- 
          12
          
            eval "_command_array=( ${2:-} )"
- 
          6
          
            message="${3:-}"
- 
          
          
          - 
          6
          
            __rvm_log_command "$name" "$message" "${_command_array[@]}" || return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          # Run a specified command and log it.
- 
          
          
          __rvm_log_command()
- 
          
          
          {
- 
          37
          
            typeset name message _log _command_start _command_name
- 
          37
          
            typeset -a _command
- 
          
          
          - 
          37
          
            name="${1:-}"
- 
          37
          
            message="${2:-}"
- 
          37
          
            shift 2
- 
          37
          
            _command=( "$@" )   # store full command so we can manipulate it
- 
          37
          
            _command_start="$1" # store first part so we can detect variables
- 
          100
          
            while (( $# )) && [[ "$1" =~ "=" ]] # skip variables from beginning
- 
          13
          
            do shift
- 
          
          
            done
- 
          37
          
            _command_name="$1"  # store the real command so we can detect functions
- 
          
          
          - 
          44
          
            [[ ! "${_command_start}" =~ "=" ]] || _command=( "env" "${_command[@]}" )
- 
          37
          
            (( ${rvm_niceness:-0} == 0 ))      || _command=( nice -n $rvm_niceness "${_command[@]}" )
- 
          
          
          - 
          37
          
            _log="${rvm_log_path}${rvm_ruby_string:+/}${rvm_ruby_string:-}/$name.log"
- 
          37
          
            rvm_debug "Log file: ${_log}"
- 
          
          
          - 
          37
          
            [[ -d "${_log%\/*}" ]] || \mkdir -p "${_log%\/*}"
- 
          37
          
            [[ -f "${_log}"     ]] || \rm -f "${_log}"
- 
          
          
            {
- 
          74
          
              printf "%b" "[$(date +'%Y-%m-%d %H:%M:%S')] ${_command_name}\n"
- 
          37
          
              if is_a_function "${_command_name}"
- 
          24
          
              then typeset -f  "${_command_name}"
- 
          
          
              fi
- 
          29
          
              printf "%b" "current path: $PWD\n"
- 
          21
          
              printf "%b" "command(${#_command[@]}): ${_command[*]}\n"
- 
          74
          
            } | tee "${_log}" | rvm_debug_stream
- 
          
          
          - 
          37
          
            __rvm_log_dotted "${_log}" "$message" "${_command[@]}" ||
- 
          
          
            {
- 
          
          
              typeset result=$?
- 
          
          
              rvm_error "Error running '${_command[*]}',
- 
          
          
          please read ${_log}"
- 
          
          
              return ${result}
- 
          
          
            }
- 
          
          
          }
- 
          
          
          - 
          
          
          # Output the current ruby's rvm source path.
- 
          
          
          __rvm_source_dir()
- 
          
          
          {
- 
          
          
            if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]]
- 
          
          
            then __rvm_select
- 
          
          
            fi
- 
          
          
          - 
          
          
            if [[ -z "$rvm_ruby_src_path" ]]
- 
          
          
            then
- 
          
          
              rvm_error "No source directory exists for the default implementation."
- 
          
          
            else
- 
          
          
              echo "$rvm_ruby_src_path"
- 
          
          
            fi
- 
          
          
          - 
          
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          # Output an inspection of selected 'binary' scripts, based on CLI selection.
- 
          
          
          __rvm_inspect()
- 
          
          
          {
- 
          
          
            for binary in $rvm_ruby_args
- 
          
          
            do
- 
          
          
              actual_file="$(unset -f gem ; builtin command -v gem )"
- 
          
          
              rvm_log "$actual_file:"
- 
          
          
              if [[ ${rvm_shebang_flag:-0} -eq 1 ]]
- 
          
          
              then
- 
          
          
                \head -n 1    < "$actual_file"
- 
          
          
              fi
- 
          
          
          - 
          
          
              if [[ ${rvm_env_flag:-0} -eq 1 ]]
- 
          
          
              then
- 
          
          
                \awk '/ENV/'  < "$actual_file"
- 
          
          
              fi
- 
          
          
          - 
          
          
              if [[ ${rvm_path_flag:-0} -eq 1 ]]
- 
          
          
              then
- 
          
          
                \awk '/PATH/' < "$actual_file"
- 
          
          
              fi
- 
          
          
          - 
          
          
              if [[ ${rvm_head_flag:-0} -eq 1 ]]
- 
          
          
              then
- 
          
          
                \head -n 5    < "$actual_file"
- 
          
          
              fi
- 
          
          
          - 
          
          
              if [[ ${rvm_tail_flag:-0} -eq 1 ]]
- 
          
          
              then
- 
          
          
                \tail -n 5    < "$actual_file"
- 
          
          
              fi
- 
          
          
          - 
          
          
              if [[ ${rvm_all_flag:-0} -eq 1 ]]
- 
          
          
              then
- 
          
          
                \cat $actual_file
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          - 
          
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          # Strip whitespace and normalize it all.
- 
          
          
          __rvm_strip()
- 
          
          
          {
- 
          26
          
            \sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]]\{1,\}/ /g'
- 
          26
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          # remove all entries from $PATH starting with $1
- 
          
          
          __rvm_remove_from_path()
- 
          
          
          {
- 
          408
          
            export PATH
- 
          408
          
            typeset _value
- 
          408
          
            _value="${1//+(\/)//}"
- 
          
          
          - 
          
          
            # remove multiple slashes https://github.com/wayneeseguin/rvm/issues/1364
- 
          
          
            if
- 
          408
          
              [[ "$PATH" =~ "//" ]]
- 
          
          
            then
- 
          
          
              if [[ `uname -s` = "Darwin" ]]
- 
          
          
              then PATH="$(sed -E 's#/+#/#g' <<<$PATH)"
- 
          
          
              else PATH="$(sed -r 's#/+#/#g' <<<$PATH)"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          
          
            if
- 
          408
          
              __rvm_string_match ":$PATH:" "*:${_value}:*"
- 
          
          
            then
- 
          203
          
                typeset -a _path
- 
          203
          
                _path=()
- 
          203
          
                __rvm_custom_separated_array _path : "${PATH}"
- 
          203
          
                __rvm_remove_from_array _path "${_value}" "${_path[@]}"
- 
          203
          
                __rvm_join_array PATH : _path
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_add_to_path()
- 
          
          
          {
- 
          1
          
            export PATH
- 
          
          
          - 
          2
          
            if (( $# != 2 )) || [[ -z "$2" ]]
- 
          
          
            then
- 
          
          
              rvm_error "__rvm_add_to_path requires two parameters"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          - 
          1
          
            __rvm_remove_from_path "$2"
- 
          1
          
            case "$1" in
- 
          1
          
              prepend) PATH="$2:$PATH" ;;
- 
          
          
              append)  PATH="$PATH:$2" ;;
- 
          
          
              #*) anything else will just remove it from PATH - not adding back
- 
          
          
            esac
- 
          
          
          - 
          
          
            if
- 
          1
          
              [[ -n "${rvm_user_path_prefix:-}" ]]
- 
          
          
            then
- 
          
          
              __rvm_remove_from_path "${rvm_user_path_prefix}"
- 
          
          
              PATH="${rvm_user_path_prefix}:$PATH"
- 
          
          
            fi
- 
          1
          
            builtin hash -r
- 
          
          
          }
- 
          
          
          - 
          
          
          rvm_is_a_shell_function()
- 
          
          
          {
- 
          114
          
            typeset _message
- 
          
          
            if
- 
          114
          
              (( ${rvm_is_not_a_shell_function:-0} )) &&
- 
          8
          
              [[ "${1:-}" != "no_warning" ]]
- 
          
          
            then
- 
          1
          
              if rvm_pretty_print stderr
- 
          
          
              then rvm_log "" # newline when error is shown to user
- 
          
          
              fi
- 
          1
          
              if rvm_pretty_print stderr
- 
          
          
              then rvm_log "RVM is not a function, selecting rubies with '${rvm_error_clr:-}rvm use ...${rvm_notify_clr:-}' will not work." >&2
- 
          1
          
              else rvm_error "RVM is not a function, selecting rubies with 'rvm use ...' will not work."
- 
          
          
              fi
- 
          
          
              rvm_warn '
- 
          
          
          You need to change your terminal emulator preferences to allow login shell.
- 
          
          
          Sometimes it is required to use `/bin/bash --login` as the command.
- 
          
          
          Please visit https://rvm.io/integration/gnome-terminal/ for a example.
- 
          1
          
          '
- 
          
          
            fi
- 
          114
          
            return ${rvm_is_not_a_shell_function:-0}
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_detect_xcode_version()
- 
          
          
          {
- 
          
          
            typeset version_file
- 
          
          
          - 
          
          
            for version_file in \
- 
          
          
              /Applications/Xcode.app/Contents/version.plist \
- 
          
          
              /Developer/Applications/Xcode.app/Contents/version.plist
- 
          
          
            do
- 
          
          
              if [[ -f $version_file ]]
- 
          
          
              then
- 
          
          
                if [[ -x /usr/libexec/PlistBuddy ]]
- 
          
          
                then
- 
          
          
                  /usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $version_file
- 
          
          
                else
- 
          
          
                  sed -n '/<key>CFBundleShortVersionString<\/key>/{n; s/^.*>\(.*\)<.*$/\1/; p;}' < $version_file
- 
          
          
                fi
- 
          
          
                return 0
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          - 
          
          
            if builtin command -v xcodebuild >/dev/null
- 
          
          
            then
- 
          
          
              xcodebuild -version | sed -n '/Xcode/ {s/Xcode //; p;}'
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_detect_xcode_version_is()
- 
          
          
          {
- 
          
          
            [[ "$(__rvm_detect_xcode_version)" == "$1" ]] || return 1
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_version_compare()
- 
          
          
          {
- 
          223
          
            typeset first
- 
          1115
          
            first="$( printf "%b" "$1\n$3\n" | LC_ALL=C sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n | head -n1 )"
- 
          223
          
            case "$2" in
- 
          
          
              (-eq|==|=)
- 
          
          
                [[ "$1" == "$3" ]] || return $?
- 
          
          
                ;;
- 
          
          
              (-gt|\>)
- 
          
          
                [[ "$1" != "$3" && "$first" == "$1" ]] || return $?
- 
          
          
                ;;
- 
          
          
              (-ge|\>=)
- 
          
          
                [[ "$1" == "$3" || "$first" == "$1" ]] || return $?
- 
          
          
                ;;
- 
          
          
              (-lt|\<)
- 
          669
          
                [[ "$1" != "$3" && "$first" == "$2" ]] || return $?
- 
          
          
                ;;
- 
          
          
              (-le|\<=)
- 
          
          
                [[ "$1" == "$3" || "$first" == "$3" ]] || return $?
- 
          
          
                ;;
- 
          
          
              (*)
- 
          
          
                rvm_error "Unsupported operator '$2'."
- 
          
          
                return 1
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_pager_or_cat_v()
- 
          
          
          {
- 
          
          
            eval "${PAGER:-cat -v} '$1'"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_ask_for()
- 
          
          
          {
- 
          1
          
            typeset response
- 
          1
          
            rvm_warn "$1"
- 
          1
          
            printf "%b" "(anything other than '$2' will cancel) > "
- 
          1
          
            read response || return $?
- 
          1
          
            [[ "$2" == "$response" ]] || return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          # read lines from file / stdin(-)
- 
          
          
          __rvm_read_lines()
- 
          
          
          {
- 
          16
          
            typeset IFS
- 
          
          
            # NEW LINE, BE CAREFUL
- 
          
          
            IFS="
- 
          16
          
          "
- 
          16
          
            if [[ "${2:--}" == "-" ]]
- 
          15
          
            then eval "$1=( \$( cat - ) )"
- 
          33
          
            else eval "$1=( \$( cat \"\${2:--}\" ) )"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # parse comma separated string into an array
- 
          
          
          # Ex. __rvm_custom_separated_array strings - ruby_string
- 
          
          
          # adds all elements from `ruby_string` to `strings` array
- 
          
          
          __rvm_custom_separated_array()
- 
          
          
          {
- 
          757
          
            typeset IFS
- 
          757
          
            IFS=$2
- 
          757
          
            if [[ -n "${ZSH_VERSION:-}" ]]
- 
          
          
            then eval "$1+=( \${=3} )"
- 
          1514
          
            else eval "$1+=( \$3 )"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remove_from_array()
- 
          
          
          {
- 
          205
          
            typeset _array_name _search _iterator
- 
          205
          
            typeset -a _temp_array
- 
          205
          
            _array_name="$1"
- 
          205
          
            _search="$2"
- 
          205
          
            shift 2
- 
          205
          
            _temp_array=()
- 
          1745
          
            for _iterator
- 
          
          
            do
- 
          2976
          
              __rvm_string_match "$_iterator" "$_search" || _temp_array+=( "$_iterator" )
- 
          
          
            done
- 
          410
          
            eval "$_array_name=( \"\${_temp_array[@]}\" )"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_join_array()
- 
          
          
          {
- 
          203
          
            typeset IFS
- 
          203
          
            IFS="$2"
- 
          406
          
            eval "$1=\"\${$3[*]}\""
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_find_first_file()
- 
          
          
          {
- 
          95
          
            typeset _first_file _variable_first_file __file_enum
- 
          95
          
            _first_file=""
- 
          95
          
            _variable_first_file="$1"
- 
          95
          
            shift
- 
          
          
          - 
          296
          
            for __file_enum in "$@"
- 
          
          
            do
- 
          
          
              if
- 
          296
          
                [[ -f "$__file_enum" ]]
- 
          
          
              then
- 
          148
          
                eval "$_variable_first_file=\"\$__file_enum\""
- 
          74
          
                return 0
- 
          
          
              fi
- 
          
          
            done
- 
          42
          
            eval "$_variable_first_file=\"\""
- 
          21
          
            return 1
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_detect_system()
- 
          
          
          {
- 
          5
          
            unset  _system_type _system_name _system_version _system_arch
- 
          5
          
            export _system_type _system_name _system_version _system_arch
- 
          5
          
            _system_type="unknown"
- 
          5
          
            _system_name="unknown"
- 
          5
          
            _system_version="unknown"
- 
          10
          
            _system_arch="$(uname -m)"
- 
          15
          
            case "$(uname)" in
- 
          
          
              (Linux)
- 
          5
          
                _system_type="linux"
- 
          
          
                if
- 
          5
          
                  [[ -f /etc/lsb-release ]] &&
- 
          
          
                  GREP_OPTIONS="" \grep "DISTRIB_ID=Ubuntu" /etc/lsb-release >/dev/null
- 
          
          
                then
- 
          
          
                  _system_name="ubuntu"
- 
          
          
                  _system_version="$(awk -F'=' '$1=="DISTRIB_RELEASE"{print $2}' /etc/lsb-release)"
- 
          
          
                elif
- 
          5
          
                  [[ -f /etc/os-release ]] &&
- 
          10
          
                  GREP_OPTIONS="" \grep "ID=opensuse" /etc/os-release >/dev/null
- 
          
          
                then
- 
          
          
                  _system_name="opensuse"
- 
          
          
                  _system_version="$(awk -F'=' '$1=="VERSION_ID"{gsub(/"/,"");print $2}' /etc/os-release)" #'
- 
          
          
                elif
- 
          5
          
                  [[ -f /etc/debian_version ]]
- 
          
          
                then
- 
          5
          
                  _system_name="debian"
- 
          10
          
                  _system_version="$(cat /etc/debian_version)"
- 
          
          
                elif
- 
          
          
                  [[ -f /etc/fedora-release ]]
- 
          
          
                then
- 
          
          
                  _system_name="fedora"
- 
          
          
                  _system_version="$(\grep -Eo '[[:digit:]]+' /etc/fedora-release)"
- 
          
          
                elif
- 
          
          
                  [[ -f /etc/centos-release ]]
- 
          
          
                then
- 
          
          
                  _system_name="centos"
- 
          
          
                  _system_version="$(\grep -Eo '[[:digit:]\.]+' /etc/centos-release  | awk -F. '{print $1"."$2}')"
- 
          
          
                elif
- 
          
          
                  [[ -f /etc/redhat-release ]]
- 
          
          
                then
- 
          
          
                  if \grep CentOS /etc/redhat-release >/dev/null
- 
          
          
                  then _system_name="centos"
- 
          
          
                  else _system_name="redhat"
- 
          
          
                  fi
- 
          
          
                  _system_version="$(\grep -Eo '[[:digit:]\.]+' /etc/redhat-release  | awk -F. '{print $1"."$2}')"
- 
          
          
                elif
- 
          
          
                  [[ -f /etc/gentoo-release ]]
- 
          
          
                then
- 
          
          
                  _system_name="gentoo"
- 
          
          
                  _system_version="base-$(cat /etc/gentoo-release | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')"
- 
          
          
                elif
- 
          
          
                  [[ -f /etc/arch-release ]]
- 
          
          
                then
- 
          
          
                  _system_name="arch"
- 
          
          
                  _system_version="libc-$(ldd --version  | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')"
- 
          
          
                else
- 
          
          
                  _system_version="libc-$(ldd --version  | awk 'NR==1 {print $NF}' | awk -F. '{print $1"."$2}')"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              (SunOS)
- 
          
          
                _system_type="sunos"
- 
          
          
                _system_name="solaris"
- 
          
          
                _system_version="$(uname -v)"
- 
          
          
                if
- 
          
          
                  __rvm_string_match "${_system_version}" "joyent*"
- 
          
          
                then
- 
          
          
                  _system_name="smartos"
- 
          
          
                  _system_version="${_system_version#* }"
- 
          
          
                elif
- 
          
          
                  __rvm_string_match  "${_system_version}" "oi*"
- 
          
          
                then
- 
          
          
                  _system_name="openindiana"
- 
          
          
                  _system_version="${_system_version#* }"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              (OpenBSD)
- 
          
          
                _system_type="bsd"
- 
          
          
                _system_name="openbsd"
- 
          
          
                _system_version="$(uname -r)"
- 
          
          
                ;;
- 
          
          
              (Darwin)
- 
          
          
                _system_type="darwin"
- 
          
          
                _system_name="osx"
- 
          
          
                _system_version="$(sw_vers -productVersion)"
- 
          
          
                _system_version="${_system_version%.*}" # only major.minor - teeny is ignored
- 
          
          
                ;;
- 
          
          
              (*)
- 
          
          
                return 1
- 
          
          
                ;;
- 
          
          
            esac
- 
          5
          
            _system_type="${_system_type//[ \/]/_}"
- 
          5
          
            _system_name="${_system_name//[ \/]/_}"
- 
          5
          
            _system_version="${_system_version//[ \/]/_}"
- 
          5
          
            _system_arch="${_system_arch//[ \/]/_}"
- 
          5
          
            _system_arch="${_system_arch/amd64/x86_64}"
- 
          5
          
            _system_arch="${_system_arch/i[123456789]86/i386}"
- 
          
          
          }
- 
          
          
          - 
          
          
          # params: [printf_if=-] [suffix]
- 
          
          
          __rvm_system_path()
- 
          
          
          {
- 
          12
          
            rvm_remote_server_path="$(__rvm_db "rvm_remote_server_path${2:-}")"
- 
          6
          
            [[ -n "${rvm_remote_server_path}" ]] ||
- 
          4
          
            if __rvm_detect_system
- 
          4
          
            then rvm_remote_server_path="${_system_name}/${_system_version}/${_system_arch}"
- 
          
          
            else return $?
- 
          
          
            fi
- 
          6
          
            if [[ "${1:-}" == "-" ]]
- 
          2
          
            then printf "%b" "${rvm_remote_server_path}\n"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_system_path_for()
- 
          
          
          {
- 
          
          
            typeset _iterator rvm_remote_server_type rvm_remote_server_path
- 
          
          
            _iterator=""
- 
          
          
            while
- 
          
          
              :
- 
          
          
            do
- 
          
          
              rvm_remote_server_type="$(__rvm_db "rvm_remote_server_type${_iterator}")"
- 
          
          
              [[ -n "${rvm_remote_server_type}" ]] || return 0
- 
          
          
              if
- 
          
          
                [[ "${rvm_remote_server_type}" == "$1" || "$1" == "all" ]]
- 
          
          
              then
- 
          
          
                __rvm_system_path - "${_iterator}"
- 
          
          
              fi
- 
          
          
              : $(( _iterator+=1 ))
- 
          
          
            done | sort -u | tr "\n" "|" | sed 's/|$//'
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_remote_extension()
- 
          
          
          {
- 
          6
          
            case "$1" in
- 
          
          
              *.tar.*)
- 
          
          
                rvm_remote_extension="tar${1##*tar}"
- 
          
          
                ;;
- 
          
          
              jruby-*)
- 
          
          
                rvm_remote_extension="tar.gz"
- 
          
          
                ;;
- 
          
          
              *)
- 
          6
          
                rvm_remote_extension="tar.bz2"
- 
          
          
                ;;
- 
          
          
            esac
- 
          11
          
            [[ "$2" != "-" ]] || printf "%b" "${rvm_remote_extension}"
- 
          
          
          }
- 
          
          
          - 
          
          
          # params: ruby-string-to-transform
- 
          
          
          __rvm_ruby_package_file()
- 
          
          
          {
- 
          9
          
            case "$1" in
- 
          
          
              *.tar.*)
- 
          1
          
                rvm_ruby_package_file="/$1"
- 
          
          
                ;;
- 
          
          
              jruby-*)
- 
          
          
                typeset __version
- 
          
          
                __version="$(
- 
          
          
                  rvm_ruby_string="$1"
- 
          
          
                  __rvm_ruby_string
- 
          
          
                  echo "$rvm_ruby_version"
- 
          
          
                )"
- 
          
          
                rvm_ruby_package_file="/${__version}/jruby-bin-${__version}.$(__rvm_remote_extension "$1" -)"
- 
          
          
                ;;
- 
          
          
              "")
- 
          
          
                rvm_ruby_package_file=""
- 
          
          
                ;;
- 
          
          
              *)
- 
          8
          
                rvm_ruby_package_file="/$1.$(__rvm_remote_extension "$1" -)"
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_calculate_remote_file()
- 
          
          
          {
- 
          10
          
            rvm_remote_server_url="$( __rvm_db "rvm_remote_server_url${3:-}" )"
- 
          5
          
            [[ -n "$rvm_remote_server_url" ]] || {
- 
          1
          
              rvm_debug "rvm_remote_server_url${3:-} not found"
- 
          1
          
              return $1
- 
          
          
            }
- 
          4
          
            __rvm_system_path "" "${3:-}"
- 
          4
          
            __rvm_ruby_package_file "${4:-}"
- 
          4
          
            __remote_file="${rvm_remote_server_url}/${rvm_remote_server_path}${rvm_ruby_package_file}"
- 
          
          
          }
- 
          
          
          - 
          
          
          # params: return_on_end return_on_failed_link [suffix] [file]
- 
          
          
          __rvm_remote_server_path_single()
- 
          
          
          {
- 
          4
          
            typeset __remote_file
- 
          4
          
            __rvm_calculate_remote_file "$@" || return $?
- 
          
          
            if
- 
          4
          
              [[ -z "${__remote_file:-}" ]]
- 
          
          
            then
- 
          1
          
              rvm_debug "No remote file name found"
- 
          1
          
              return $1
- 
          
          
            elif
- 
          3
          
              file_exists_at_url "${__remote_file}"
- 
          
          
            then
- 
          
          
              rvm_debug "Found remote file ${__remote_file}"
- 
          
          
              printf "%b" "${__remote_file}"
- 
          
          
            else
- 
          3
          
              rvm_debug "Remote file does not exist ${__remote_file}"
- 
          3
          
              return $2
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # params: [file_name]
- 
          
          
          __rvm_remote_server_path()
- 
          
          
          {
- 
          1
          
            typeset _iterator
- 
          1
          
            _iterator=""
- 
          4
          
            while ! __rvm_remote_server_path_single 0 1 "${_iterator}" "${1:-}"
- 
          3
          
            do : $(( _iterator+=1 ))
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          __list_remote_all_for()
- 
          
          
          {
- 
          
          
            #TODO: read the list from db
- 
          
          
            {
- 
          
          
              __list_remote_rubies_for "$1"
- 
          
          
              __list_remote_rbx_for    "$1"
- 
          
          
              __list_remote_jruby_for  "$1"
- 
          
          
            } | sort -u
- 
          
          
          }
- 
          
          
          - 
          
          
          __list_remote_rubies_for()
- 
          
          
          {
- 
          
          
            typeset rvm_ruby_url
- 
          
          
            rvm_ruby_url="$1"
- 
          
          
            awk '/'"${rvm_ruby_url//\//\/}"'/{print}' < $rvm_path/config/remote
- 
          
          
            if [[ -f $rvm_user_path/remote ]]
- 
          
          
            then awk '/'"${rvm_ruby_url//\//\/}"'/{print}' < $rvm_user_path/remote
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __list_remote_rbx_for()
- 
          
          
          {
- 
          
          
            typeset rvm_ruby_url
- 
          
          
            rvm_ruby_url="$1"
- 
          
          
            curl -LsS http://binaries.rubini.us/ |
- 
          
          
              GREP_OPTIONS="" \grep -oE "<Key>[^<]+\.tar\.bz2</Key>" |
- 
          
          
              awk -F"[<>]" '/'"${rvm_ruby_url//\//\/}"'/{print "http://binaries.rubini.us/"$3}'
- 
          
          
          }
- 
          
          
          - 
          
          
          __list_remote_jruby_for()
- 
          
          
          {
- 
          
          
            typeset rvm_ruby_url
- 
          
          
            rvm_ruby_url="$1"
- 
          
          
            curl -LsS http://jruby.org.s3.amazonaws.com/ |
- 
          
          
              GREP_OPTIONS="" \grep -oE "<Key>[^<]+jruby-bin-[^<]+\.tar\.gz</Key>" |
- 
          
          
              awk -F"[<>]" '/'"${rvm_ruby_url//\//\/}"'/{print "http://jruby.org.s3.amazonaws.com/"$3}' |
- 
          
          
              sed 's/-bin-/-/'
- 
          
          
          }
- 
          
          
          - 
          
          
          rubygems_detect_ruby_lib_gem_path()
- 
          
          
          {
- 
          
          
            ruby_lib_gem_path="$(
- 
          
          
              "${1:-ruby}" -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG['rubylibprefix']||::Kernel.const_get('RbConfig')::CONFIG['prefix']
- 
          2
          
            ")/gems/"
- 
          6
          
            case "$rvm_ruby_string" in
- 
          
          
              (jruby*)
- 
          
          
                ruby_lib_gem_path+="shared"
- 
          
          
                ;;
- 
          
          
              (*)
- 
          4
          
                ruby_lib_gem_path+="$("${1:-ruby}" -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG['ruby_version']")"
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_rubygems_create_link()
- 
          
          
          {
- 
          2
          
            typeset ruby_lib_gem_path
- 
          2
          
            rubygems_detect_ruby_lib_gem_path "${1:-ruby}"
- 
          
          
          - 
          
          
            # Add ruby's gem path to ruby's lib direcotry.
- 
          4
          
            \mkdir -p "$(dirname $ruby_lib_gem_path)" "$rvm_ruby_gem_home" "$rvm_ruby_global_gems_path"
- 
          
          
          - 
          
          
            if
- 
          3
          
              [[ -d "$ruby_lib_gem_path" && ! -L "$ruby_lib_gem_path" ]]
- 
          
          
            then
- 
          
          
              if
- 
          
          
                [[ "$rvm_ruby_gem_home" != "$rvm_ruby_global_gems_path" ]]
- 
          
          
              then
- 
          
          
                \cp -f "$ruby_lib_gem_path"/* "$rvm_ruby_global_gems_path"/ 2>/dev/null
- 
          
          
              fi
- 
          
          
              \mv -f "$ruby_lib_gem_path"/* "$rvm_ruby_gem_home"/ 2>/dev/null
- 
          
          
            fi
- 
          2
          
            __rvm_rm_rf "$ruby_lib_gem_path"
- 
          
          
          - 
          2
          
            if [[ -d "$rvm_ruby_gem_home" ]]
- 
          2
          
            then ln -fs "$rvm_ruby_gem_home" "$ruby_lib_gem_path"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Import the initial gemsets, unless skipped.
- 
          
          
          __rvm_gemsets_initial()
- 
          
          
          {
- 
          
          
            if
- 
          2
          
              (( ${rvm_skip_gemsets_flag:-0} == 0 ))
- 
          
          
            then
- 
          1
          
              __rvm_log_command "gemsets.initial" \
- 
          
          
                "$rvm_ruby_string - #importing default gemsets, this may take time ..." \
- 
          
          
                __rvm_with "$rvm_ruby_string" "$rvm_scripts_path/gemsets" initial
- 
          
          
            else
- 
          1
          
              mkdir -p "$rvm_gems_path/$rvm_ruby_string/bin" "$rvm_gems_path/$rvm_ruby_string@global/bin"
- 
          1
          
              rvm_log "Skipped importing default gemsets"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          file_exists_at_url()
- 
          
          
          (
- 
          
          
            if
- 
          3
          
              [[ -n "${1:-}" ]]
- 
          
          
            then
- 
          3
          
              unset curl
- 
          3
          
              \curl -slkL --max-time 3 --head "$1" 2>&1 |
- 
          6
          
                GREP_OPTIONS="" \grep -E 'HTTP/[0-9\.]+ 200 OK' >/dev/null 2>&1 ||
- 
          3
          
                return $?
- 
          
          
            else
- 
          
          
              rvm_log "Warning: URL was not passed to file_exists_at_url"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          )
- 
          
          
          - 
          
          
          __rvm_fix_group_permissions()
- 
          
          
          {
- 
          
          
            if
- 
          8
          
              umask -S | \grep 'g=rw' >/dev/null
- 
          
          
            then
- 
          4
          
              chmod -R g+rwX "$@"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # params: archive_file
- 
          
          
          __rvm_package_list()
- 
          
          
          {
- 
          2
          
            rvm_debug __rvm_package_list:$#: "$@"
- 
          2
          
            case "$1" in
- 
          
          
              *.zip)
- 
          
          
                unzip -Z -1 "$1"
- 
          
          
                ;;
- 
          
          
              *.tar.bz2)
- 
          2
          
                ${rvm_tar_command:-tar} tjf "$1"
- 
          
          
                ;;
- 
          
          
              *.tar.gz|*.tgz)
- 
          
          
                ${rvm_tar_command:-tar} tzf "$1"
- 
          
          
                ;;
- 
          
          
              *)
- 
          
          
                return 199
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          # params: archive_file [path]
- 
          
          
          __rvm_package_extract()
- 
          
          
          {
- 
          3
          
            rvm_debug __rvm_package_extract:$#: "$@"
- 
          3
          
            [[ -d "$2" ]] || mkdir -p "$2"
- 
          3
          
            case "$1" in
- 
          
          
              *.zip)
- 
          
          
                unzip -q -o "$1" -d "$2"
- 
          
          
                ;;
- 
          
          
              *.tar.bz2)
- 
          2
          
                if [[ -n "$ZSH_VERSION" ]]
- 
          
          
                then ${rvm_tar_command:-tar} xjf "$1" -C "$2" ${=rvm_tar_options:-}
- 
          2
          
                else ${rvm_tar_command:-tar} xjf "$1" -C "$2" ${rvm_tar_options:-}
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              *.tar.gz|*.tgz)
- 
          1
          
                if [[ -n "$ZSH_VERSION" ]]
- 
          
          
                then ${rvm_tar_command:-tar} xzf "$1" -C "$2" ${=rvm_tar_options:-}
- 
          1
          
                else ${rvm_tar_command:-tar} xzf "$1" -C "$2" ${rvm_tar_options:-}
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              *)
- 
          
          
                return 199
- 
          
          
                ;;
- 
          
          
            esac &&
- 
          3
          
            __rvm_fix_group_permissions "$2"
- 
          
          
          }
- 
          
          
          - 
          
          
          # params: archive_file [path [path2]]
- 
          
          
          __rvm_package_create()
- 
          
          
          {
- 
          1
          
            rvm_debug __rvm_package_create:$#: "$@"
- 
          1
          
            case "$1" in
- 
          
          
              *.tar.bz2)
- 
          1
          
                if [[ -z "${3:-}" ]]
- 
          
          
                then ${rvm_tar_command:-tar} cjf "$1" "$2"
- 
          1
          
                else ${rvm_tar_command:-tar} cjf "$1" -C "$2" "$3"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              *.tar.gz|*.tgz)
- 
          
          
                if [[ -z "${3:-}" ]]
- 
          
          
                then ${rvm_tar_command:-tar} czf "$1" "$2"
- 
          
          
                else ${rvm_tar_command:-tar} czf "$1" -C "$2" "$3"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
              *)
- 
          
          
                return 199
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          63
          
          source "$rvm_scripts_path/base"
- 
          63
          
          source "$rvm_scripts_path/functions/build" # For gems with C extensions.
- 
          
          
          - 
          63
          
          rvm_ruby_gem_home="${rvm_ruby_gem_home:-$GEM_HOME}"
- 
          
          
          - 
          68
          
          if [[ ! -d "$rvm_ruby_gem_home" ]] && builtin command -v gem > /dev/null 2>&1
- 
          
          
          then
- 
          10
          
            rvm_ruby_gem_home="$(gem env home)"
- 
          
          
          fi
- 
          
          
          - 
          
          
          usage()
- 
          
          
          {
- 
          
          
            cat -v "${rvm_help_path}/gemset"
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_list_all()
- 
          
          
          {
- 
          
          
            for rvm_ruby_string in $( rvm_project_rvmrc=0 rvm list strings )
- 
          
          
            do
- 
          
          
              (__rvm_use ; gemset_list)
- 
          
          
            done
- 
          
          
            unset rvm_ruby_string
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_list_strings()
- 
          
          
          {
- 
          
          
            typeset gem_string
- 
          
          
            for rvm_ruby_string in $( rvm_project_rvmrc=0 rvm list strings )
- 
          
          
            do
- 
          
          
              for gem_string in "${rvm_gems_path:-${rvm_path}/gems}/${rvm_ruby_string}" "${rvm_gems_path:-${rvm_path}/gems}/${rvm_ruby_string}${rvm_gemset_separator:-@}"*
- 
          
          
              do
- 
          
          
                printf "%b" "${gem_string##*/}\n"
- 
          
          
              done
- 
          
          
            done
- 
          
          
            unset rvm_ruby_string
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_update()
- 
          
          
          {
- 
          
          
          - 
          
          
            if [[ -z "$rvm_ruby_strings" ]]
- 
          
          
            then
- 
          
          
              rvm_log "Running gem update for all rubies and gemsets."
- 
          
          
              rvm_ruby_strings="$(
- 
          
          
                __rvm_cd "${rvm_gems_path:-"$rvm_path/gems"}" ;
- 
          
          
                find . -maxdepth 1 -mindepth 1 -type d -print 2>/dev/null |
- 
          
          
                  GREP_OPTIONS="" \grep -v '^\(doc\|cache\|@\|system\)' | \tr '\n' ','
- 
          
          
              )"
- 
          
          
              rvm_ruby_strings="${rvm_ruby_strings/%,}"
- 
          
          
              rvm_ruby_strings="${rvm_ruby_strings//.\/}"
- 
          
          
            else
- 
          
          
              rvm_log "Running gem update for the specified rubies."
- 
          
          
            fi
- 
          
          
            export rvm_ruby_strings
- 
          
          
            "$rvm_scripts_path/set" gem update
- 
          
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_globalcache()
- 
          
          
          {
- 
          6
          
            typeset gc_status globalcache_enabled directories directory_name \
- 
          
          
              full_directory_path directory_name
- 
          
          
          - 
          6
          
            if [[ "$1" == "enabled" ]]
- 
          
          
            then
- 
          3
          
              if __rvm_using_gemset_globalcache
- 
          
          
              then
- 
          1
          
                gc_status="Enabled"
- 
          1
          
                globalcache_enabled=0
- 
          
          
              else
- 
          2
          
                gc_status="Disabled"
- 
          2
          
                globalcache_enabled=1
- 
          
          
              fi
- 
          3
          
              rvm_log "Gemset global cache is currently: $gc_status"
- 
          3
          
              return $globalcache_enabled
- 
          3
          
            elif [[ "$1" == "disable" ]]
- 
          
          
            then
- 
          2
          
              rvm_log "Removing the global cache (note: this will empty the caches)"
- 
          2
          
              __rvm_read_lines directories < <(
- 
          2
          
                __rvm_cd "${rvm_gems_path:-"$rvm_path/gems"}" ;
- 
          4
          
                find . -maxdepth 1 -mindepth 1 -type d -print | cut -c 3-
- 
          
          
              )
- 
          
          
          - 
          38
          
              for directory_name in "${directories[@]//.\/}"
- 
          
          
              do
- 
          38
          
                current_cache_path="${rvm_gems_path:-"$rvm_path/gems"}/$directory_name/cache"
- 
          
          
                if [[ -L "$current_cache_path" \
- 
          50
          
                  && "$(readlink "$current_cache_path")" == "$rvm_gems_cache_path" ]]
- 
          
          
                then
- 
          6
          
                  rvm_log "Reverting the gem cache for $directory_name to an empty directory."
- 
          6
          
                  \rm -f "$current_cache_path" 2>/dev/null
- 
          6
          
                  mkdir -p "$current_cache_path" 2>/dev/null
- 
          
          
                fi
- 
          
          
              done
- 
          2
          
              "$rvm_scripts_path/db" "$rvm_user_path/db" "use_gemset_globalcache" "delete"
- 
          1
          
            elif [[ "$1" == "enable" ]]
- 
          
          
            then
- 
          1
          
              rvm_log "Enabling global cache for gems."
- 
          1
          
              mkdir -p "$rvm_gems_cache_path"
- 
          1
          
              __rvm_read_lines directories < <(
- 
          1
          
                __rvm_cd "${rvm_gems_path:-"$rvm_path/gems"}" ;
- 
          2
          
                find . -maxdepth 1 -mindepth 1 -type d -print | cut -c 3-
- 
          
          
              )
- 
          19
          
              for directory_name in "${directories[@]//.\/}"
- 
          
          
              do
- 
          19
          
                current_cache_path="${rvm_gems_path:-"$rvm_path/gems"}/$directory_name/cache"
- 
          25
          
                if [[ -d "$current_cache_path" && ! -L "$current_cache_path" ]]
- 
          
          
                then
- 
          6
          
                  rvm_log "Moving the gem cache for $directory_name to the global cache."
- 
          6
          
                  \mv "$current_cache_path/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
- 
          6
          
                  case "${current_cache_path%\/}" in
- 
          
          
                    *cache)
- 
          6
          
                      __rvm_rm_rf "$current_cache_path"
- 
          6
          
                      ln -fs "$rvm_gems_cache_path" "$current_cache_path"
- 
          
          
                      ;;
- 
          
          
                  esac
- 
          
          
                fi
- 
          
          
              done
- 
          1
          
              "$rvm_scripts_path/db" "$rvm_user_path/db" "use_gemset_globalcache" "true"
- 
          
          
            else
- 
          
          
              printf "%b" "
- 
          
          
          - 
          
          
            Usage:
- 
          
          
          - 
          
          
              rvm gemset globalcache {enable,disable,enabled}
- 
          
          
          - 
          
          
              Enable / Disable / Status the use of a global gem cachedir.
- 
          
          
          - 
          
          
          "
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_name()
- 
          
          
          {
- 
          
          
            echo "${rvm_ruby_gem_home##*${rvm_gemset_separator:-"@"}}"
- 
          
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_dir()
- 
          
          
          {
- 
          
          
            echo "$rvm_ruby_gem_home"
- 
          
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_create()
- 
          
          
          {
- 
          10
          
            typeset gem_home gemset gemsets prefix
- 
          
          
          - 
          20
          
            [[ -z "$rvm_ruby_string" ]] || __rvm_select
- 
          
          
          - 
          30
          
            prefix=$(echo $rvm_ruby_gem_home | sed 's/'${rvm_gemset_separator:-"@"}'.*$//')
- 
          
          
          - 
          10
          
            for gemset in "$@"
- 
          
          
            do
- 
          
          
              if
- 
          20
          
                [[ "$(__rvm_env_string)" == "system" ]]
- 
          
          
              then
- 
          
          
                rvm_error "Can not create gemset before using a ruby.  Try 'rvm use <some ruby>'."
- 
          
          
                return 1
- 
          
          
              elif
- 
          10
          
                [[ "$gemset" == *"${rvm_gemset_separator:-"@"}"* ]]
- 
          
          
              then
- 
          
          
                rvm_error "Can not create gemset '$gemset', it contains a \"${rvm_gemset_separator:-"@"}\"."
- 
          
          
                return 2
- 
          
          
              elif
- 
          20
          
                [[ -z "$gemset" || "$gemset" == *"${rvm_gemset_separator:-"@"}" ]]
- 
          
          
              then
- 
          
          
                rvm_error "Can not create gemset '$gemset', Missing name. "
- 
          
          
                return 3
- 
          
          
              fi
- 
          
          
          - 
          10
          
              gem_home="${prefix}${rvm_gemset_separator:-"@"}${gemset}"
- 
          20
          
              [[ -d "$gem_home/bin" ]] || mkdir -p "$gem_home/bin"
- 
          
          
          - 
          10
          
              : rvm_gems_cache_path:${rvm_gems_cache_path:=${rvm_gems_path:-"$rvm_path/gems"}/cache}
- 
          
          
              # When the globalcache is enabled, we need to ensure we setup the cache directory correctly.
- 
          
          
              if
- 
          10
          
                __rvm_using_gemset_globalcache
- 
          
          
              then
- 
          
          
                if
- 
          1
          
                  [[ -d "$gem_home/cache" && ! -L "$gem_home/cache" ]]
- 
          
          
                then
- 
          
          
                  \mv "$gem_home/cache"/*.gem "$rvm_gems_cache_path/" 2>/dev/null
- 
          
          
                  __rvm_rm_rf "$gem_home/cache"
- 
          
          
                fi
- 
          1
          
                ln -fs "$rvm_gems_cache_path" "$gem_home/cache"
- 
          
          
              fi
- 
          
          
              if
- 
          
          
                (
- 
          10
          
                  rvm_create_flag=1
- 
          10
          
                  rvm_verbose_flag=0
- 
          20
          
                  __rvm_select "$(__rvm_env_string)${rvm_gemset_separator:-"@"}${gemset}"
- 
          
          
                )
- 
          
          
              then
- 
          10
          
                rvm_log "gemset created $gemset\t=> $gem_home"
- 
          
          
              else
- 
          
          
                rvm_error "Can not create environment file for '$gemset', Could not use ruby. "
- 
          
          
                return 4
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          __gemset_list_single()
- 
          
          
          {
- 
          40
          
            typeset gemset current_gemset ruby_name default_name
- 
          40
          
            gemset="$1"
- 
          40
          
            current_gemset="$2"
- 
          40
          
            gemset="${gemset##*/}"
- 
          40
          
            ruby_name="${gemset%%${rvm_gemset_separator:-@}*}"
- 
          40
          
            gemset="${gemset#${ruby_name}}"
- 
          40
          
            gemset="${gemset#${rvm_gemset_separator:-@}}"
- 
          
          
          - 
          40
          
            if [[ "${_second_param}" == "strings" ]]
- 
          
          
            then default_name="default"
- 
          40
          
            else default_name="(default)"
- 
          
          
            fi
- 
          54
          
            [[ -n "${gemset}"         ]] || gemset="$default_name"
- 
          67
          
            [[ -n "${current_gemset}" ]] || current_gemset="$default_name"
- 
          
          
            if
- 
          40
          
              [[ "${gemset}" == "${current_gemset}" ]]
- 
          
          
            then
- 
          12
          
              if [[ "${_second_param}" == "strings" ]]
- 
          
          
              then echo "${gemset} #current"
- 
          12
          
              else echo "=> ${gemset}"
- 
          
          
              fi
- 
          
          
            else
- 
          28
          
              if [[ "${_second_param}" == "strings" ]]
- 
          
          
              then echo "${gemset}"
- 
          28
          
              else echo "   ${gemset}"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_list()
- 
          
          
          {
- 
          14
          
            if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]]
- 
          
          
            then
- 
          14
          
              __rvm_select
- 
          
          
            fi
- 
          
          
          - 
          14
          
            [[ -d "${rvm_gems_path:-"$rvm_path/gems"}" ]] || {
- 
          
          
              rvm_error "${rvm_gems_path:-"$rvm_path/gems"} does not exist!"
- 
          
          
              return 1
- 
          
          
            }
- 
          14
          
            [[ -n "${rvm_ruby_string:-""}" ]] || {
- 
          
          
              rvm_error "\$rvm_ruby_string is not set!"
- 
          
          
              return 1
- 
          
          
            }
- 
          
          
          - 
          14
          
            typeset current_gemset IFS
- 
          28
          
            current_gemset=$(__rvm_current_gemset)
- 
          14
          
            IFS=""
- 
          
          
          - 
          14
          
            [[ "${_second_param}" == "strings" ]] ||
- 
          14
          
              rvm_log "\ngemsets for $rvm_ruby_string (found in ${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string)"
- 
          
          
          - 
          40
          
            for gemset in ${rvm_gems_path:-${rvm_path}/gems}/${rvm_ruby_string} ${rvm_gems_path:-${rvm_path}/gems}/${rvm_ruby_string}${rvm_gemset_separator:-@}*
- 
          
          
            do
- 
          40
          
              __gemset_list_single "${gemset}" "${current_gemset}"
- 
          
          
            done
- 
          
          
          - 
          28
          
            [[ "${_second_param}" == "strings" ]] || printf "%b" "\n"
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_delete_task()
- 
          15
          
          {
- 
          15
          
            typeset rvm_gemset_name ruby_at_gemset gemdir
- 
          15
          
            rvm_gemset_name=$1
- 
          15
          
            ruby_at_gemset=$2
- 
          15
          
            gemdir=$3
- 
          
          
          - 
          45
          
            case $(uname) in
- 
          
          
              (OpenBSD)
- 
          
          
                # will not find broken links
- 
          
          
                find "${rvm_bin_path:=$rvm_path/bin}" -name \*${ruby_at_gemset} -delete
- 
          
          
                find -L "${rvm_bin_path:=$rvm_path/bin}" -name \*${ruby_at_gemset} -delete
- 
          
          
                ;;
- 
          
          
              (*)
- 
          15
          
                find "${rvm_bin_path:=$rvm_path/bin}" \( -name \*${ruby_at_gemset} -or -lname \*${ruby_at_gemset}/\* \) -delete
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
            for item in $( $rvm_scripts_path/alias search_by_target ${ruby_at_gemset} )
- 
          
          
            do
- 
          
          
              $rvm_scripts_path/alias delete ${item}
- 
          
          
            done
- 
          15
          
            __rvm_rm_rf "$gemdir" &&
- 
          15
          
            __rvm_rm_rf "${rvm_wrappers_path:="$rvm_path/wrappers"}/${ruby_at_gemset}"
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_delete()
- 
          
          
          {
- 
          17
          
            [[ -n "${GEM_HOME:-}" ]] ||
- 
          
          
            {
- 
          
          
              rvm_error "A ruby must be selected in order to delete a gemset."
- 
          
          
              return 1
- 
          
          
            }
- 
          17
          
            if (( ${rvm_ruby_selected_flag:-0} == 0))
- 
          17
          
            then __rvm_ruby_string
- 
          
          
            fi
- 
          17
          
            [[ -n "$rvm_gemset_name" ]] ||
- 
          
          
            {
- 
          
          
              rvm_error "A gemset name must be specified in order to delete a gemset."
- 
          
          
              return 1
- 
          
          
            }
- 
          
          
          - 
          17
          
            ruby_at_gemset="$rvm_ruby_string${rvm_gemset_separator:-"@"}$rvm_gemset_name"
- 
          17
          
            gemdir="${rvm_gems_path:-$rvm_path/gems}/${ruby_at_gemset}"
- 
          
          
          - 
          17
          
            [[ -d "$gemdir" ]] ||
- 
          
          
            {
- 
          2
          
              rvm_warn "$gemdir did not previously exist. Ignoring."
- 
          2
          
              return 0
- 
          
          
            }
- 
          
          
          - 
          15
          
            (( ${rvm_force_flag:-0} )) ||
- 
          1
          
            __rvm_ask_for "Are you SURE you wish to remove the entire gemset directory '$rvm_gemset_name' ($gemdir)?" yes ||
- 
          
          
            {
- 
          
          
              rvm_log "Not doing anything, phew... close call that one eh?"
- 
          
          
              return 2
- 
          
          
            }
- 
          
          
          - 
          15
          
            __rvm_log_command "gemset.delete" "Removing gemset $rvm_gemset_name" \
- 
          
          
              gemset_delete_task "$rvm_gemset_name" "$ruby_at_gemset" "$gemdir"
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_empty()
- 
          
          
          {
- 
          1
          
            typeset gemdir entry
- 
          1
          
            if [[ -z "${rvm_ruby_gem_home:-""}" ]]
- 
          
          
            then __rvm_select
- 
          
          
            fi
- 
          1
          
            if [[ -n "${rvm_gemset_name}" ]]
- 
          
          
            then
- 
          1
          
              rvm_gemset_name="${rvm_gemset_name#default}"
- 
          1
          
              ruby_at_gemset="${rvm_ruby_string%%${rvm_gemset_separator:-"@"}*}${rvm_gemset_name:+${rvm_gemset_separator:-"@"}}${rvm_gemset_name}"
- 
          1
          
              gemdir="${rvm_gems_path:-"$rvm_path/gems"}/${ruby_at_gemset}"
- 
          
          
            else
- 
          
          
              gemdir="${rvm_ruby_gem_home}"
- 
          
          
            fi
- 
          
          
            if
- 
          1
          
              [[ ${rvm_force_flag:-0} -gt 0 ]]
- 
          
          
            then
- 
          9
          
              for entry in "$gemdir"/bin/* "$gemdir"/doc/* "$gemdir"/gems/* "$gemdir"/specifications/*
- 
          
          
              do
- 
          9
          
                __rvm_rm_rf "$entry"
- 
          
          
              done
- 
          
          
            elif
- 
          
          
              [[ -d "$gemdir" ]]
- 
          
          
            then
- 
          
          
              if
- 
          
          
                __rvm_ask_for "Are you SURE you wish to remove the installed gems for gemset '$(basename "$gemdir")' ($gemdir)?" yes
- 
          
          
              then
- 
          
          
                for entry in "$gemdir"/bin/* "$gemdir"/doc/* "$gemdir"/gems/* "$gemdir"/specifications/*
- 
          
          
                do
- 
          
          
                  __rvm_rm_rf "$entry"
- 
          
          
                done
- 
          
          
              else
- 
          
          
                rvm_log "Not doing anything, phew... close call that one eh?"
- 
          
          
                return 2
- 
          
          
              fi
- 
          
          
            else
- 
          
          
              rvm_log "$gemdir did not previously exist. Ignoring."
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Migrate gemsets from ruby X to ruby Y
- 
          
          
          gemset_copy()
- 
          
          
          {
- 
          2
          
            typeset source_ruby destination_ruby source_path destination_path
- 
          
          
          - 
          
          
            # Clear the current environment so that it does not influence this operation.
- 
          2
          
            unset rvm_gemset_name rvm_ruby_gem_home GEM_HOME GEM_PATH
- 
          
          
          - 
          2
          
            source_ruby="${1:-}"
- 
          2
          
            destination_ruby="${2:-}"
- 
          2
          
            shift 2
- 
          
          
            if
- 
          4
          
              [[ -z "$destination_ruby" || -z "$source_ruby" ]]
- 
          
          
            then
- 
          
          
              rvm_error "Source and destination must be specified: 'rvm gemset copy X Y'"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
            # Verify the destination gemset exists before attempting to use it.
- 
          
          
            if
- 
          
          
              ! (
- 
          2
          
                rvm_ruby_string="$destination_ruby"
- 
          4
          
                export rvm_create_flag=1
- 
          4
          
                { __rvm_ruby_string && __rvm_gemset_select; } 2> /dev/null
- 
          
          
              )
- 
          
          
            then
- 
          
          
              rvm_error "Destination gemset '$destination_ruby' does not yet exist."
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          - 
          
          
            # TODO: Account for more possibilities:
- 
          
          
            #   rvm gemset copy 1.9.2 @gemsetb        # From 1.9.2 default to current ruby, 1.9.2 exists.
- 
          
          
            #   rvm gemset copy @gemseta @gemsetb     # Current ruby, gemseta exists.
- 
          
          
            #   rvm gemset copy gemseta gemsetb       # Currenty Ruby, gemseta exists.
- 
          
          
            #   rvm gemset copy gemseta 1.8.7@gemsetb # Currenty Ruby@gemseta, current ruby@gemseta exists.
- 
          
          
          - 
          
          
            source_path=$(
- 
          
          
              rvm_ruby_string="$source_ruby"
- 
          
          
              { __rvm_ruby_string && __rvm_gemset_select; } > /dev/null 2>&1
- 
          
          
              echo $rvm_ruby_gem_home
- 
          2
          
            )
- 
          2
          
            destination_path=$(
- 
          4
          
              rvm_ruby_string="$destination_ruby"
- 
          2
          
              { __rvm_ruby_string && __rvm_gemset_select; }  > /dev/null 2>&1
- 
          
          
              echo $rvm_ruby_gem_home
- 
          2
          
            )
- 
          2
          
            if
- 
          8
          
              [[ -z "$source_path" || ! -d "$source_path" ]]
- 
          2
          
            then
- 
          
          
              rvm_error "Unable to expand '$source_ruby' or directory does not exist."
- 
          
          
              return 1
- 
          
          
            elif
- 
          2
          
              [[ -z "$destination_path" ]]
- 
          
          
            then
- 
          
          
              rvm_error "Unable to expand '$destination_ruby'."
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
            if
- 
          2
          
              [[ -d "$source_path" ]]
- 
          
          
            then
- 
          2
          
              rvm_log "Copying gemset from $source_ruby to $destination_ruby"
- 
          12
          
              for dir in bin doc gems specifications cache bundle
- 
          
          
              do
- 
          
          
                if
- 
          12
          
                  [[ -d "$source_path/$dir" ]]
- 
          
          
                then
- 
          3
          
                  \cp -Rf "$source_path/$dir" "$destination_path/"
- 
          
          
                elif
- 
          9
          
                  [[ -L "$source_path/$dir" ]]
- 
          
          
                then
- 
          
          
                  \cp "$source_path/$dir" "$destination_path/$dir"
- 
          
          
                else
- 
          
          
                  if
- 
          9
          
                    [[ -f "$source_path/$dir" ]]
- 
          
          
                  then
- 
          
          
                    rvm_warn "Unknown file type for $( file $source_path/$dir )" >&2
- 
          
          
                  else
- 
          9
          
                    : "$source_path/$dir" does not exist
- 
          
          
                  fi
- 
          9
          
                  mkdir -p "$destination_path/$dir"
- 
          
          
                fi
- 
          
          
              done
- 
          2
          
              __rvm_gemset_pristine "$destination_ruby"
- 
          
          
            else
- 
          
          
              rvm_error "Gems directory does not exist for $source_path ($source_path)"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Migrate gemsets from ruby X to ruby Y
- 
          
          
          gemset_rename()
- 
          
          
          {
- 
          1
          
            typeset source_name destination_name source_path destination_path
- 
          
          
          - 
          1
          
            source_name="${1:-}"
- 
          1
          
            destination_name="${2:-""}"
- 
          1
          
            shift 2
- 
          
          
            if
- 
          2
          
              [[ -z "$destination_name" || -z "$source_name" ]]
- 
          
          
            then
- 
          
          
              rvm_error "Source and destination gemsets must be specified: 'rvm gemset rename X Y'"
- 
          
          
              return 1
- 
          
          
            fi
- 
          5
          
            source_path="$(rvm_silence_logging=1 rvm_gemset_name=${source_name} __rvm_use "${rvm_ruby_string}@${source_name}" ; gem env gemdir)"
- 
          
          
            if
- 
          2
          
              [[ -z "$source_path" || ! -d "$source_path" ]]
- 
          
          
            then
- 
          
          
              rvm_error "gemset '$source_name' does not exist."
- 
          
          
              return 2
- 
          
          
            fi
- 
          1
          
            destination_path=${source_path/%$source_name/$destination_name}
- 
          
          
            if
- 
          1
          
              [[ -d "$source_path" ]]
- 
          
          
            then
- 
          
          
              if
- 
          1
          
                [[ ! -d "$destination_path" ]]
- 
          
          
              then
- 
          1
          
                __rvm_log_command "gemset.rename" "Renaming gemset ${source_path##*/} => ${destination_path##*/}" \mv "$source_path" "$destination_path"
- 
          1
          
                __rvm_gemset_pristine "${destination_path##*/}"
- 
          
          
              else
- 
          
          
                rvm_error "Gemset $destination_name already exists!"
- 
          
          
                return 1
- 
          
          
              fi
- 
          
          
            else
- 
          
          
              rvm_error "Gems directory does not exist for $source_path ($source_path)"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_unpack()
- 
          
          
          {
- 
          
          
            typeset gems name directory version  _platforms
- 
          
          
            directory="${1:-vendor/gems}"
- 
          
          
            if
- 
          
          
              [[ -n "$rvm_ruby_gem_home" ]]
- 
          
          
            then
- 
          
          
              export GEM_HOME="$rvm_ruby_gem_home"
- 
          
          
              export GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
- 
          
          
            fi
- 
          
          
          - 
          
          
            rvm_log "Unpacking current environments gemset to ${directory}\n"
- 
          
          
            unset -f gem
- 
          
          
          - 
          
          
            while read gem_name version _platforms
- 
          
          
            do
- 
          
          
              ( command gem unpack "$gem_name" -v"$version" --target "$directory" )&
- 
          
          
            done < <(
- 
          
          
              GEM_PATH="$GEM_HOME" __rvm_list_gems
- 
          
          
            )
- 
          
          
            wait
- 
          
          
            rvm_log "Unpacking into ${directory} complete\n"
- 
          
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_export()
- 
          2
          
          {
- 
          1
          
            typeset rvm_file_name gem_name version versions _platforms
- 
          1
          
            rvm_file_name="${1:-}"
- 
          
          
            if
- 
          1
          
              [[ -n "$rvm_ruby_gem_home" ]]
- 
          
          
            then
- 
          2
          
              export GEM_HOME="$rvm_ruby_gem_home"
- 
          2
          
              export GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
- 
          
          
            fi
- 
          
          
            if
- 
          1
          
              [[ -n "$rvm_file_name" ]]
- 
          
          
            then
- 
          2
          
              [[ "${rvm_file_name}" =~ Gemfile ]] || rvm_file_name="${rvm_file_name%.gems}.gems"
- 
          
          
            else
- 
          
          
              if [[ -n "$rvm_gemset_name" ]]
- 
          
          
              then rvm_file_name="$rvm_gemset_name.gems"
- 
          
          
              else rvm_file_name="default.gems"
- 
          
          
              fi
- 
          
          
            fi
- 
          1
          
            rvm_log "Exporting current environments gemset to $rvm_file_name"
- 
          1
          
            if [[ -f "$rvm_file_name" ]]
- 
          
          
            then \rm -f "$rvm_file_name"
- 
          
          
            fi
- 
          
          
            if
- 
          1
          
              [[ "${rvm_file_name}" =~ Gemfile ]]
- 
          
          
            then
- 
          
          
              printf "%b" "source :rubygems
- 
          
          
          - 
          
          
          #ruby=${GEM_HOME##*/}
- 
          
          
          - 
          
          
          "
- 
          
          
            else
- 
          1
          
              printf "%b" "# $rvm_file_name generated gem export file. \
- 
          
          
          Note that any env variable settings will be missing. \
- 
          
          
          Append these after using a ';' field separator
- 
          
          
          - 
          
          
          "
- 
          
          
            fi > "$rvm_file_name"
- 
          
          
            if
- 
          1
          
              (( ${rvm_latest_flag:-0} == 0 ))
- 
          
          
            then
- 
          3
          
              while read gem_name version _platforms
- 
          
          
              do
- 
          2
          
                if [[ "${rvm_file_name}" =~ Gemfile ]]
- 
          
          
                then echo "gem '$gem_name', '$version'"
- 
          2
          
                else echo "$gem_name -v$version"
- 
          
          
                fi
- 
          
          
              done < <( GEM_PATH="$GEM_HOME" __rvm_list_gems )
- 
          
          
            else
- 
          
          
              while read gem_name versions
- 
          
          
              do
- 
          
          
                if [[ "${rvm_file_name}" =~ Gemfile ]]
- 
          
          
                then echo "gem '$gem_name'"
- 
          
          
                else echo "$gem_name"
- 
          
          
                fi
- 
          
          
              done < <( GEM_PATH="$GEM_HOME" gem list )
- 
          
          
            fi >> "$rvm_file_name"
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_import()
- 
          
          
          {
- 
          3
          
            typeset rvm_file_name
- 
          3
          
            typeset -a gem_file_names
- 
          3
          
            unset -f gem
- 
          
          
            if
- 
          3
          
              [[ -n "${rvm_ruby_gem_home:-""}" ]]
- 
          
          
            then
- 
          6
          
              export GEM_HOME="$rvm_ruby_gem_home"
- 
          6
          
              export GEM_PATH="$rvm_ruby_gem_home"
- 
          
          
            else
- 
          
          
              rvm_ruby_gem_home=${GEM_HOME:-$(gem env gemdir)}
- 
          
          
            fi
- 
          
          
          - 
          
          
            gem_file_names=(
- 
          
          
              "${1%.gems*}.gems"
- 
          
          
              "${rvm_gemset_name}.gems"
- 
          
          
              "default.gems"
- 
          
          
              "system.gems"
- 
          
          
              ".gems"
- 
          3
          
            )
- 
          3
          
            __rvm_find_first_file rvm_file_name "${gem_file_names[@]}" ||
- 
          
          
            {
- 
          
          
              rvm_error "No *.gems file found."
- 
          
          
              return 1
- 
          
          
            }
- 
          
          
          - 
          5
          
            [[ -d "$rvm_ruby_gem_home/specifications/" ]] || mkdir -p "$rvm_ruby_gem_home/specifications/"
- 
          3
          
            [[ -d "$rvm_gems_cache_path" ]] || mkdir -p "$rvm_gems_cache_path" # Ensure the base cache dir is initialized.
- 
          
          
            if
- 
          3
          
              [[ -s "$rvm_file_name" ]]
- 
          
          
            then
- 
          3
          
              rvm_log "\nInstalling gems listed in $rvm_file_name file...\n"
- 
          3
          
              typeset -a lines
- 
          3
          
              __rvm_read_lines lines "${rvm_file_name}"
- 
          
          
          - 
          7
          
              for line in "${lines[@]}"
- 
          
          
              do
- 
          
          
                # Parse the lines, throwing out comments and empty lines.
- 
          13
          
                if [[ ! "${line}" =~ ^# && -n "${line// /}" ]]
- 
          6
          
                then gem_install $line
- 
          
          
                fi
- 
          
          
              done
- 
          3
          
              rvm_log "\nProcessing of $rvm_file_name is complete.\n"
- 
          
          
            else
- 
          
          
              rvm_error "${rvm_file_name} does not exist to import from."
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_parse_gems_args()
- 
          
          
          {
- 
          6
          
            if [[ "$*" =~ ";" ]]
- 
          
          
            then gem_prefix="${*#*;}"
- 
          6
          
            else gem_prefix=""
- 
          
          
            fi
- 
          6
          
            gem="${*%%;*}"
- 
          
          
            if
- 
          6
          
              __rvm_string_match "$gem" "*.gem$"
- 
          
          
            then
- 
          
          
              gem_name="$(basename "${gem/.gem/}" |  awk -F'-' '{$NF=NULL;print}')"
- 
          
          
              gem_version="$(basename "${gem/.gem/}" |  awk -F'-' '{print $NF}' )"
- 
          
          
              gem_postfix="$(basename "${gem/*.gem/}")"
- 
          
          
            else
- 
          6
          
              gem_name="${gem/ */}"
- 
          14
          
              case "$gem" in
- 
          
          
                *--version*)
- 
          
          
                  gem_version=$(
- 
          
          
                    echo "$gem" | sed -e 's#.*--version[=]*[ ]*##' | awk '{print $1}'
- 
          
          
                  )
- 
          
          
                  gem_postfix="$(
- 
          
          
                    echo "$gem" |
- 
          
          
                    sed -e "s#${gem_name/ /}##" -e "s#--version[=]*[ ]*${gem_version/ /}##"
- 
          
          
                  )" #"
- 
          
          
                  ;;
- 
          
          
                *-v*)
- 
          
          
                  gem_version=$(
- 
          
          
                    echo "$gem" | sed -e 's#.*-v[=]*[ ]*##' | awk '{print $1}'
- 
          2
          
                  )
- 
          6
          
                  gem_postfix="$(
- 
          
          
                    echo "$gem" |
- 
          
          
                    sed -e "s#${gem_name/ /}##" -e "s#-v[=]*[ ]*${gem_version/ /}##"
- 
          2
          
                  )" #"
- 
          2
          
                  ;;
- 
          2
          
                *)
- 
          4
          
                  unset gem_version # no version
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            fi
- 
          
          
            if
- 
          6
          
              [[ -s "$gem" ]]
- 
          
          
            then
- 
          
          
              gem_file_name="$gem"
- 
          
          
            elif
- 
          6
          
              __rvm_string_match "$gem" "*.gem"
- 
          
          
            then
- 
          
          
              gem_file_name="$gem"
- 
          
          
            elif
- 
          6
          
              [[ -z "${gem_version/ /}" ]]
- 
          
          
            then
- 
          4
          
              gem_file_name="${gem_name/ /}*.gem"
- 
          
          
            else # version
- 
          2
          
              gem_file_name="${gem_name/ /}-${gem_version/ /}.gem"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Install a gem
- 
          
          
          gem_install()
- 
          
          
          {
- 
          6
          
            typeset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string gem_action _command
- 
          
          
          - 
          6
          
            result=0
- 
          
          
          - 
          
          
            # First we parse the gem args to pick apart the pieces.
- 
          6
          
            __rvm_parse_gems_args "$@"
- 
          
          
          - 
          
          
            # Now we determine if a .gem cache file is already installed
- 
          6
          
            if (( ${rvm_force_flag:-0} == 0 )) &&
- 
          12
          
              [[ -f "${rvm_ruby_gem_home}/specifications/$(basename "$gem_file_name")spec" ]]
- 
          
          
            then
- 
          1
          
              gem=""
- 
          1
          
              rvm_log "$gem_name $gem_version is already installed."
- 
          
          
            else
- 
          5
          
              if [[ -s "$gem" ]]
- 
          
          
              then
- 
          
          
                cache_file="$gem"
- 
          
          
          - 
          10
          
              elif [[ -s "$(__rvm_current_gemcache_dir)/${gem_file_name}" ]]
- 
          
          
              then
- 
          2
          
                cache_file="$(__rvm_current_gemcache_dir)/${gem_file_name}"
- 
          
          
          - 
          
          
              else
- 
          20
          
                true ${cache_file:=$( find "$(__rvm_current_gemcache_dir)/${gem_file_name}" -maxdepth 1 -mindepth 1 -type f -print 2> /dev/null | sort | head -n1)}
- 
          4
          
                cache_file="${cache_file/.\/}"
- 
          
          
              fi
- 
          
          
          - 
          5
          
              if [[ ! -s "$cache_file" ]]
- 
          
          
              then
- 
          4
          
                if [[ -s "$gem_file_name" ]]
- 
          
          
                then
- 
          
          
                  gem="$gem_file_name"
- 
          
          
          - 
          4
          
                elif [[ -z "${gem_version// /}" ]]
- 
          
          
                then
- 
          4
          
                  gem="${gem_name// /}"
- 
          
          
          - 
          
          
                else
- 
          
          
                  gem="${gem_name// /} -v $gem_version"
- 
          
          
                fi
- 
          
          
              else # cached
- 
          
          
          - 
          2
          
                gem_file_name="$(basename "$cache_file")"
- 
          3
          
                gem_string="$(echo "$gem_file_name" | sed 's#\.gem$##')"
- 
          
          
          - 
          1
          
                if (( ${rvm_force_flag:-0} == 0 )) &&
- 
          2
          
                  [[ -s "${rvm_ruby_gem_home}/specifications/$(basename $gem_file_name)spec" ]]
- 
          
          
                then
- 
          
          
                  unset gem # already installed, not forcing reinstall.
- 
          
          
          - 
          
          
                  rvm_log "$gem_name $gem_version exists, skipping (--force to re-install)"
- 
          
          
          - 
          
          
                else
- 
          3
          
                  if [[ -s "$(__rvm_current_gemcache_dir)/$(basename $gem_file_name)" ]]
- 
          
          
                  then
- 
          1
          
                    mkdir -p "${rvm_tmp_path}/$$/"
- 
          2
          
                    \mv "$(__rvm_current_gemcache_dir)/$gem_file_name" "${rvm_tmp_path}/$$/$gem_file_name"
- 
          1
          
                    gem="${rvm_tmp_path}/$$/$gem_file_name -f -l"
- 
          
          
                  else
- 
          
          
                    gem="$cache_file"
- 
          
          
                  fi
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          
          
            # If $gem is still set, go forward with the install.
- 
          6
          
            if [[ -n "$gem" ]]
- 
          
          
            then
- 
          
          
              # TODO: Set vars if fourth field is non-empty (means that there are conditional statements to execute in the gem install line.
- 
          
          
          - 
          
          
              if [[ -n "$rvm_ruby_gem_home" &&
- 
          10
          
                "$rvm_ruby_gem_home" != "${rvm_gems_path:-"$rvm_path/gems"}" ]]
- 
          
          
              then
- 
          5
          
                _command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home' $gem_prefix gem install --remote $* $rvm_gem_options $gem_postfix $vars"
- 
          
          
              else
- 
          
          
                _command="$gem_prefix gem install --ignore-dependencies --remote $* $rvm_gem_options -q $gem $gem_postfix $vars"
- 
          
          
              fi
- 
          5
          
              unset -f gem
- 
          5
          
              __rvm_run "gem.install" "$_command" "installing ${gem_name} ${gem_version}..."
- 
          5
          
              result=$?
- 
          5
          
              if (( result == 0 ))
- 
          
          
              then
- 
          5
          
                rvm_log "$gem_name $gem_version installed."
- 
          
          
              else
- 
          
          
                rvm_log "$gem_name $gem_version failed to install ( output logged to: $rvm_log_path/$rvm_ruby_string/gem.install.log )"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          6
          
            return $result
- 
          
          
          }
- 
          
          
          - 
          
          
          # Output the user's current gem directory.
- 
          
          
          gemset_info()
- 
          
          
          {
- 
          
          
            if
- 
          6
          
              (( ${rvm_user_flag:-0} == 1 ))
- 
          
          
            then
- 
          
          
              (__rvm_use system ; gem env | GREP_OPTIONS="" \grep "\- $HOME" | awk '{print $NF}')
- 
          
          
            elif
- 
          6
          
              [[ ${rvm_system_flag:-0} == 1 ]]
- 
          
          
            then
- 
          
          
              (__rvm_use system ; gem env $action system)
- 
          
          
            elif
- 
          6
          
              [[ -n "${rvm_ruby_string:-""}${rvm_gemset_name:+${rvm_gemset_separator:-"@"}}${rvm_gemset_name:-}" ]]
- 
          
          
            then
- 
          
          
              #TODO: why on ubuntu oneiric 32bit it's not enough to use gem env? why need to use again???
- 
          
          
              (
- 
          6
          
                __rvm_use "${rvm_ruby_string:-""}${rvm_gemset_name:+${rvm_gemset_separator:-"@"}}${rvm_gemset_name:-}"
- 
          6
          
                gem env $action
- 
          
          
              )
- 
          
          
            else
- 
          
          
              gem env $action
- 
          
          
            fi
- 
          6
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_prune()
- 
          
          
          {
- 
          
          
            typeset temporary_cache_path live_cache_path gemset_name version versions cached_gem_name cached_file_path
- 
          
          
          - 
          
          
            temporary_cache_path="$GEM_HOME/temporary-cache"
- 
          
          
            live_cache_path="$GEM_HOME/cache"
- 
          
          
          - 
          
          
            mkdir -p "$temporary_cache_path"
- 
          
          
            rvm_log "Moving active gems into temporary cache..."
- 
          
          
            while
- 
          
          
              read gem_name version _platforms
- 
          
          
            do
- 
          
          
              cached_gem_name="${gem_name}-${version}.gem"
- 
          
          
              cached_file_path="${live_cache_path}/${cached_gem_name}"
- 
          
          
              if
- 
          
          
                [[ -f "$cached_file_path" ]]
- 
          
          
              then
- 
          
          
                \mv "$cached_file_path" "${temporary_cache_path}/${cached_gem_name}"
- 
          
          
              fi
- 
          
          
            done < <(
- 
          
          
              GEM_PATH="$GEM_HOME" __rvm_list_gems
- 
          
          
            )
- 
          
          
            rvm_log "Removing live cache and restoring temporary cache..."
- 
          
          
            # Switch the cache back.
- 
          
          
            __rvm_rm_rf "$live_cache_path"
- 
          
          
            \mv "$temporary_cache_path" "$live_cache_path"
- 
          
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          gemset_pristine()
- 
          
          
          {
- 
          6
          
            if
- 
          
          
              (
- 
          3
          
                unset -f gem
- 
          3
          
                builtin command -v gem > /dev/null
- 
          
          
              )
- 
          
          
            then
- 
          3
          
              typeset _gem _version _platforms
- 
          3
          
              typeset -a _failed
- 
          3
          
              rvm_log "Restoring gems to pristine condition..."
- 
          
          
              while
- 
          3
          
                read _gem _version _platforms
- 
          
          
              do
- 
          
          
                printf "%b" "${_gem}-${_version} "
- 
          
          
                if ! gem pristine ${_gem} --version ${_version} >/dev/null
- 
          
          
                then  _failed+=( "${_gem} --version ${_version}" )
- 
          
          
                fi
- 
          
          
              done < <(
- 
          
          
                GEM_PATH="$GEM_HOME" __rvm_list_gems
- 
          
          
              )
- 
          
          
              if
- 
          3
          
                (( ${#_failed[@]} > 0 ))
- 
          
          
              then
- 
          
          
                rvm_error "\n'gem pristine ${_failed[*]}' failed, you need to fix this gems manually."
- 
          
          
                return 1
- 
          
          
              else
- 
          3
          
                rvm_log "\nfinished."
- 
          
          
              fi
- 
          
          
            else
- 
          
          
              rvm_error "'gem' command not found in PATH."
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Transform the list of gems one version per line
- 
          
          
          __rvm_list_gems()
- 
          
          
          {
- 
          4
          
            gem list |
- 
          4
          
              sed '/\*\*\*/ d ; /^$/ d; s/ (/,/; s/, /,/g; s/)//;' |
- 
          4
          
              awk -F ',' '{for(i=2;i<=NF;i++) print $1" "$i }'
- 
          
          
          }
- 
          
          
          - 
          
          
          # Loads the default gemsets for the current interpreter and gemset.
- 
          
          
          gemset_initial()
- 
          
          
          {
- 
          1
          
            typeset gemsets gemset _iterator paths
- 
          
          
          - 
          1
          
            true ${rvm_gemsets_path:="$rvm_path/gemsets"}
- 
          
          
          - 
          2
          
            rvm_log "Importing initial gemsets for $(__rvm_env_string)."
- 
          
          
          - 
          1
          
            [[ -d "$rvm_gemsets_path/${rvm_ruby_string//-//}/cache" ]] ||
- 
          
          
              mkdir -p "$rvm_gemsets_path/${rvm_ruby_string//-//}/cache" 2>/dev/null
- 
          
          
          - 
          3
          
            paths=( $( __rvm_ruby_string_paths_under "$rvm_gemsets_path" | sort -r ) )
- 
          
          
          - 
          1
          
            echo "paths: ${paths[@]}"
- 
          
          
          - 
          4
          
            for _iterator in "${paths[@]}"
- 
          
          
            do
- 
          4
          
              if [[ -n "$rvm_gemset_name" ]]
- 
          
          
              then
- 
          
          
                if [[ -s "${rvm_gemset_name}.gems" ]]
- 
          
          
                then
- 
          
          
                  ( gemset_import "${rvm_gemset_name}.gems" )
- 
          
          
                  break # stop right here
- 
          
          
                fi
- 
          
          
              else
- 
          4
          
                if [[ -s "${_iterator}/default.gems" ]]
- 
          
          
                then
- 
          1
          
                  ( gemset_import "${_iterator}/default.gems"  )
- 
          
          
                fi
- 
          4
          
                if [[ -s "${_iterator}/global.gems" ]]
- 
          
          
                then
- 
          
          
                  (
- 
          1
          
                    rvm_create_flag=1
- 
          1
          
                    rvm_ruby_gem_home="${rvm_ruby_gem_home//@*/}@global"
- 
          1
          
                    gemset_import "${_iterator}/global.gems"
- 
          
          
                  )
- 
          
          
                fi
- 
          7
          
                if [[ -s "${_iterator}/default.gems" || -s "${_iterator}/global.gems" ]]
- 
          1
          
                then break # stop right here
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            done
- 
          2
          
            rvm_log "Installation of gems for $(__rvm_env_string) is complete."
- 
          
          
          }
- 
          
          
          - 
          
          
          search()
- 
          
          
          {
- 
          
          
            typeset gemspec gemspecs gem_name option environment_id ruby_string name gem_version
- 
          
          
            gem_name="${1:-}"
- 
          
          
            option="${2:-}"
- 
          
          
          - 
          
          
            if [[ -z "${gem_name}" ]]
- 
          
          
            then
- 
          
          
              return 0
- 
          
          
            fi
- 
          
          
          - 
          
          
            true "${rvm_gems_path:="$rvm_path/gems"}"
- 
          
          
          - 
          
          
            __rvm_read_lines gemspecs < <(
- 
          
          
              find "${rvm_gems_path}" -mindepth 3 -iname "${gem_name}*.gemspec"  -type f
- 
          
          
            )
- 
          
          
          - 
          
          
            if [[ "${option}" != "strings" ]]
- 
          
          
            then
- 
          
          
              printf "%-40s %-20s %-20s\n" "environment_id" "name" "version"
- 
          
          
              printf "%b" "================================================================================\n"
- 
          
          
            fi
- 
          
          
          - 
          
          
            for gemspec in "${gemspecs[@]}"
- 
          
          
            do
- 
          
          
              environment_id="${gemspec//${rvm_gems_path}\/}"
- 
          
          
              environment_id="${environment_id//\/*}"
- 
          
          
              ruby_string="${environment_id//@*}"
- 
          
          
              gemset_name="${environment_id//${ruby_string}}"
- 
          
          
              name=${gemspec//*\/}
- 
          
          
              name=${name/%.gemspec}
- 
          
          
              gem_version=${name//*-}
- 
          
          
          - 
          
          
              if [[ "${option}" != "strings" ]]
- 
          
          
              then
- 
          
          
                printf "%-40s %-20s %-20s\n" "${environment_id}" "${gem_name}" "${gem_version}"
- 
          
          
              else
- 
          
          
                printf "%b" "${environment_id}\n"
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          63
          
          action="$1"
- 
          126
          
          (( $# == 0 )) || shift
- 
          126
          
          export _second_param="${1:-}"
- 
          126
          
          export rvm_gemset_name="${1:-}"
- 
          63
          
          rvm_sticky_flag=1
- 
          
          
          - 
          
          
          gemset_actions_with_gem=(
- 
          
          
            gemdir gempath gemhome home path version export dump import
- 
          
          
            load pristine copy install initial prune rename update unpack
- 
          63
          
          )
- 
          
          
          if
- 
          63
          
            [[ " ${gemset_actions_with_gem[*]} " =~ " $action " ]] &&
- 
          15
          
            ! builtin command -v gem > /dev/null
- 
          
          
          then
- 
          
          
            rvm_error "'gem' was not found, cannot perform gem actions (Do you have an RVM ruby selected?)"
- 
          
          
            exit 1
- 
          
          
          fi
- 
          
          
          - 
          63
          
          if [[ " $* " =~ " --force " ]]
- 
          
          
          then export rvm_force_flag=1
- 
          
          
          fi
- 
          
          
          if
- 
          115
          
            [[ -z "$rvm_ruby_string" && "${GEM_HOME:-""}" =~ "${rvm_path}" ]]
- 
          
          
          then
- 
          50
          
            rvm_ruby_string="${GEM_HOME##*/}"
- 
          50
          
            rvm_ruby_string="${rvm_ruby_string%%@*}"
- 
          
          
          fi
- 
          
          
          if
- 
          88
          
            [[ -z "$rvm_gemset_name" && "${GEM_HOME:-""}" =~ "${rvm_path}" ]]
- 
          
          
          then
- 
          25
          
            rvm_gemset_name="${GEM_HOME##*/}"
- 
          25
          
            rvm_gemset_name="${rvm_gemset_name#${rvm_gemset_name%%@*}}"
- 
          25
          
            rvm_gemset_name="${rvm_gemset_name#@}"
- 
          
          
          fi
- 
          
          
          - 
          
          
          - 
          63
          
          case "$action" in
- 
          
          
            import|load)
- 
          
          
              if
- 
          1
          
                [[ -z "${rvm_ruby_strings:-""}" ]]
- 
          
          
              then
- 
          1
          
                gemset_import "$@"
- 
          
          
              else
- 
          
          
                rubies=()
- 
          
          
                __rvm_custom_separated_array rubies , "$rvm_ruby_strings"
- 
          
          
                for rvm_ruby_string in "${rubies[@]}"
- 
          
          
                do
- 
          
          
                  (
- 
          
          
                    __rvm_become
- 
          
          
                    gemset_import "$@"
- 
          
          
                  )
- 
          
          
                done
- 
          
          
              fi
- 
          
          
              ;;
- 
          
          
            export|dump)
- 
          1
          
              gemset_export "$@"
- 
          
          
              ;;
- 
          
          
            create|copy|delete|dir|empty|globalcache|initial|list|list_all|list_strings|pristine|prune|rename|update|unpack)
- 
          55
          
              gemset_$action "$@"
- 
          
          
              ;;
- 
          
          
            name|string)
- 
          
          
              gemset_name "$@"
- 
          
          
              ;;
- 
          
          
            strings)
- 
          
          
              gemset_list "$@"
- 
          
          
              ;;
- 
          
          
            gemdir|gempath|gemhome|home|path|version)
- 
          6
          
              gemset_info "$@"
- 
          
          
              ;;
- 
          
          
            install)
- 
          
          
              gem_$action "$@"
- 
          
          
              ;;
- 
          
          
            search)
- 
          
          
              search "$@"
- 
          
          
              ;;
- 
          
          
            help)
- 
          
          
              usage
- 
          
          
              exit 0
- 
          
          
              ;;
- 
          
          
            *)
- 
          
          
              usage
- 
          
          
              exit 1
- 
          
          
              ;;
- 
          
          
          esac
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          # need additional step to not redefine variables value if already set
- 
          188
          
          typeset old_rvm_verbose_flag old_rvm_debug_flag >/dev/null 2>/dev/null
- 
          188
          
          old_rvm_verbose_flag=${rvm_verbose_flag:-0}
- 
          188
          
          old_rvm_debug_flag=${rvm_debug_flag:-0}
- 
          
          
          - 
          
          
          # silence ZSH redefinitions
- 
          188
          
          typeset rvm_verbose_flag rvm_debug_flag hooks >/dev/null 2>/dev/null
- 
          
          
          - 
          188
          
          true rvm_verbose_flag:${rvm_verbose_flag:=${old_rvm_verbose_flag}} \
- 
          
          
            rvm_debug_flag:${rvm_debug_flag:=${old_rvm_debug_flag}} rvm_hook:${rvm_hook:=}
- 
          
          
          - 
          
          
          if
- 
          188
          
            [[ -n "$rvm_hook" ]]
- 
          
          
          then
- 
          188
          
            hooks=( "$rvm_hooks_path")
- 
          188
          
            [[ "$PWD/.rvm/hooks" == "$rvm_hooks_path" ]] ||
- 
          188
          
              hooks+=( "$PWD/.rvm/hooks" )
- 
          
          
          - 
          
          
            _hooks_list=($(
- 
          
          
              find -L "${hooks[@]}" -iname "$rvm_hook*" -type f 2>/dev/null
- 
          188
          
            ))
- 
          188
          
          - 
          696
          
            for hook in "${_hooks_list[@]}"
- 
          
          
            do
- 
          1222
          
              if [[ -x "${hook}" || "${hook##*/}" == "$rvm_hook" ]]
- 
          
          
              then
- 
          170
          
                rvm_debug "Running $hook"
- 
          170
          
                __rvm_conditionally_do_with_env . "${hook}" >&2
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          fi
- 
          
          
          - 
          188
          
          unset rvm_hook hooks _hooks_list hook
 
      
        
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          8
          
          sys=$( uname -s )
- 
          4
          
          if [[ "${sys}" == AIX ]]
- 
          
          
          then name_opt=-name
- 
          4
          
          else name_opt=-iname
- 
          
          
          fi
- 
          4
          
          original_ruby_version=${rvm_ruby_version:-""}
- 
          4
          
          original_ruby_string=${rvm_ruby_string:-""}
- 
          
          
          - 
          4
          
          source "$rvm_scripts_path/base"
- 
          4
          
          source "$rvm_scripts_path/patches"
- 
          4
          
          source "$rvm_scripts_path/functions/build"
- 
          4
          
          source "$rvm_scripts_path/functions/pkg"
- 
          4
          
          source "$rvm_scripts_path/functions/irbrc"
- 
          4
          
          source "$rvm_scripts_path/functions/db"
- 
          4
          
          source "$rvm_scripts_path/functions/manage/base"
- 
          
          
          - 
          4
          
          if [[ -n "${RUBYOPT:-""}" ]]
- 
          
          
          then ruby_options="$RUBYOPT"
- 
          
          
          fi
- 
          4
          
          unset RUBYLIB RUBYOPT # Sanity check.
- 
          
          
          - 
          4
          
          binaries=()
- 
          
          
          - 
          4
          
          __rvm_manage_rubies  # located in scripts/functions/manage/base
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          46
          
          if [[ ${rvm_leave_gem_alone:-0} -eq 0 ]]
- 
          
          
          then
- 
          
          
            function gem
- 
          
          
            {
- 
          11
          
              typeset result
- 
          
          
              (
- 
          11
          
                typeset rvmrc
- 
          11
          
                rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
- 
          22
          
                if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
- 
          11
          
                   then rvm_rvmrc_files+=( "${rvm_prefix}/.rvmrc" )
- 
          
          
                fi
- 
          
          
          - 
          33
          
                for rvmrc in "${rvm_rvmrc_files[@]}"
- 
          66
          
                do [[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
- 
          
          
                done
- 
          11
          
                unset rvm_rvmrc_files
- 
          22
          
                command gem "$@"
- 
          
          
              ) || result=$?
- 
          11
          
              hash -r
- 
          11
          
              return ${result:-0}
- 
          
          
            }
- 
          
          
          fi
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          # General tools for manipulating patches
- 
          
          
          # and dealing with patches.
- 
          
          
          - 
          
          
          # Returns the path used to look for a patch given a specific name.
- 
          
          
          __rvm_patch_lookup_path()
- 
          
          
          {
- 
          2
          
            echo "/"
- 
          2
          
            [[ -z "${rvm_patch_original_pwd:-""}" ]] || echo "$rvm_patch_original_pwd/"
- 
          2
          
            echo "$PWD/"
- 
          6
          
            __rvm_ruby_string_paths_under "$rvm_patches_path" | sed 's/$/\//' | sort -r
- 
          2
          
            return $?
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_expand_patch_name()
- 
          
          
          {
- 
          1
          
            typeset name level expanded_patch_name
- 
          1
          
            name="${1:-""}"
- 
          1
          
            level="${2:-}"
- 
          1
          
            [[ -n "$name" ]] || return 0
- 
          
          
            if
- 
          
          
              expanded_patch_name="$(
- 
          
          
                rvm_ruby_string="${rvm_ruby_string}" "$rvm_scripts_path/patchsets" show "$name"
- 
          1
          
              )"
- 
          2
          
            then
- 
          1
          
              echo "${expanded_patch_name}"
- 
          
          
            elif
- 
          
          
              [[ "$name" != "default" ]]
- 
          
          
            then
- 
          
          
              echo "${name}${level:+%}${level:-}"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Return the full patch for a given patch.
- 
          
          
          __rvm_lookup_full_patch_path()
- 
          
          
          {
- 
          2
          
            typeset extension patch_path directory directories __old_IFS
- 
          
          
            # Absolute path, pwd and then finally the rvm patches path.
- 
          2
          
            __old_IFS="$IFS"
- 
          2
          
            IFS=$'\n'
- 
          4
          
            directories=($( __rvm_patch_lookup_path ))
- 
          2
          
            IFS="$__old_IFS"
- 
          10
          
            for directory in "${directories[@]}"
- 
          
          
            do
- 
          29
          
              for extension in "" .patch .diff
- 
          
          
              do
- 
          29
          
                patch_path="${directory}${1}${extension}"
- 
          
          
                # -s reports directories too - so additional check -f needed
- 
          
          
                if
- 
          31
          
                  [[ -s "$patch_path" && -f "$patch_path" ]]
- 
          
          
                then
- 
          2
          
                  echo "$patch_path"
- 
          2
          
                  return 0
- 
          
          
                fi
- 
          
          
              done
- 
          
          
            done
- 
          
          
            if
- 
          
          
              __rvm_string_match "$1" "http://*" "https://*" &&
- 
          
          
              file_exists_at_url "$1"
- 
          
          
            then
- 
          
          
              echo "$1"
- 
          
          
            fi
- 
          
          
          }
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          2
          
          rvm_base_except="selector"
- 
          
          
          - 
          2
          
          source "$rvm_scripts_path/base"
- 
          2
          
          source "$rvm_scripts_path/patches"
- 
          
          
          - 
          
          
          lookup_patchset()
- 
          
          
          {
- 
          2
          
            typeset paths lookup_path
- 
          
          
          - 
          2
          
            if [[ -z "$1" ]]
- 
          
          
            then
- 
          
          
              echo "Usage: rvm patchset show name"
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          - 
          6
          
            paths=($(__rvm_ruby_string_paths_under "$rvm_path/patchsets" | sort -r))
- 
          
          
          - 
          6
          
            for lookup_path in "${paths[@]}"
- 
          
          
            do
- 
          6
          
              if [[ -s "$lookup_path/$1" ]]
- 
          
          
              then
- 
          2
          
                cat "$lookup_path/$1"
- 
          2
          
                return 0
- 
          
          
              fi
- 
          
          
            done
- 
          
          
          - 
          
          
            return 1
- 
          
          
          }
- 
          
          
          - 
          
          
          usage()
- 
          
          
          {
- 
          
          
            printf "%b" "
- 
          
          
          - 
          
          
            Usage:
- 
          
          
          - 
          
          
              rvm patchset {show,lookup} [patchset]
- 
          
          
          - 
          
          
            Description:
- 
          
          
          - 
          
          
              Tools for manipulating patchsets.
- 
          
          
          - 
          
          
          "
- 
          
          
            return 1
- 
          
          
          }
- 
          
          
          - 
          2
          
          args=($*)
- 
          2
          
          action="${args[0]}"
- 
          2
          
          patchset="${args[1]}"
- 
          4
          
          args="$(echo ${args[@]:2})" # Strip trailing / leading / extra spacing.
- 
          
          
          - 
          2
          
          case "$action" in
- 
          2
          
            show|lookup) lookup_patchset "$patchset" ;;
- 
          
          
            *) usage ;;
- 
          
          
          esac
- 
          
          
          - 
          2
          
          exit $?
 
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          1
          
          source "$rvm_scripts_path/base"
- 
          1
          
          source "$rvm_scripts_path/functions/db"
- 
          
          
          - 
          1
          
          result=0
- 
          
          
          - 
          1
          
          __rvm_become
- 
          
          
          - 
          
          
          rubygems_remove()
- 
          
          
          {
- 
          1
          
            typeset rubygems_path ruby entry
- 
          
          
          - 
          1
          
            rvm_log "Removing old Rubygems files..."
- 
          
          
          - 
          1
          
            case "$rvm_ruby_string" in
- 
          
          
              (rbx-*)
- 
          
          
                ruby="['prefix']"
- 
          
          
                ;;
- 
          
          
              (*)
- 
          1
          
                ruby=".values_at('sitelibdir','vendorlibdir').detect{ |path| File.directory?(File.join(path.to_s, 'rubygems')) }.to_s"
- 
          
          
                ;;
- 
          
          
            esac
- 
          2
          
            rubygems_path="$(ruby -rrbconfig -e "puts ::Kernel.const_get('RbConfig')::CONFIG$ruby")"
- 
          
          
          - 
          
          
            # Remove common files installed by ruby gems.
- 
          
          
            entries=(
- 
          
          
            "${rubygems_path}/ubygems.rb"
- 
          
          
            "${rubygems_path}/gauntlet_rubygems.rb"
- 
          
          
            "${rubygems_path}/rbconfig/"
- 
          1
          
            )
- 
          4
          
            for entry in "${entries[@]}" "${rubygems_path}/rubygems"*
- 
          
          
            do
- 
          4
          
              __rvm_rm_rf "$entry"
- 
          
          
            done
- 
          
          
          }
- 
          
          
          - 
          
          
          can_switch_rubygems()
- 
          
          
          {
- 
          1
          
            case "$rvm_ruby_string" in
- 
          
          
              maglev*)
- 
          
          
                return 1
- 
          
          
                ;;
- 
          
          
              *)
- 
          1
          
                return 0
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          make_sure_jruby_can_work_with_rubygems()
- 
          
          
          {
- 
          1
          
            case "$rvm_ruby_string" in
- 
          
          
              jruby-head*)
- 
          
          
                true
- 
          
          
                ;;
- 
          
          
              jruby*)
- 
          
          
                __rvm_version_compare "$rvm_ruby_version" -ge 1.7.1 || return 1
- 
          
          
                ;;
- 
          
          
              *)
- 
          1
          
                return 0 # do not care about other rubies
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          
          
            case "${rvm_rubygems_version}" in
- 
          
          
              head|master)
- 
          
          
                true
- 
          
          
                ;;
- 
          
          
              *)
- 
          
          
                __rvm_version_compare "$rvm_rubygems_version" -ge 2.0.0 || return 1
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          rubygems_fatal_error()
- 
          
          
          {
- 
          
          
            rvm_error "$1"
- 
          
          
            exit ${2:-1}
- 
          
          
          }
- 
          
          
          - 
          
          
          rubygems_version_list()
- 
          
          
          {
- 
          1
          
            curl -s https://api.github.com/repos/rubygems/rubygems/tags |
- 
          1
          
              sed -n '/"name": / {s/^.*".*": "v\(.*\)".*$/\1/; p;}' |
- 
          2
          
              LC_ALL=C sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n |
- 
          2
          
              GREP_OPTIONS="" \grep '^[[:digit:]\.]*$'
- 
          
          
          }
- 
          
          
          - 
          
          
          rubygems_master_sha()
- 
          
          
          {
- 
          
          
            curl -s "https://api.github.com/repos/rubygems/rubygems/commits?page=last&per_page=1" | sed -n '/^    "sha":/ {s/^.*".*": "\(.*\)".*$/\1/;p;}'
- 
          
          
          }
- 
          
          
          - 
          
          
          rubygems_select_version_url()
- 
          
          
          {
- 
          1
          
            case "$version" in
- 
          
          
              latest|current)
- 
          1
          
                case "$rvm_ruby_string" in
- 
          
          
                  ruby-1.8*|ree-1.8*)
- 
          1
          
                    typeset _rbv
- 
          1
          
                    _rbv=${rvm_ruby_version##*.}
- 
          1
          
                    if (( _rbv <= 5 ))
- 
          
          
                    then
- 
          
          
                      version=1.3.5
- 
          1
          
                    elif (( _rbv == 6 ))
- 
          
          
                    then
- 
          
          
                      version=1.3.7
- 
          
          
                    fi
- 
          
          
                    ;;
- 
          
          
                esac
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          2
          
            case "$version" in
- 
          
          
              latest|current)
- 
          2
          
                version="$(__rvm_db "${rvm_ruby_string//-/_}_rubygems_version")"
- 
          2
          
                version="${version:-"$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_rubygems_version")"}"
- 
          2
          
                version="${version:-"$(__rvm_db "${rvm_ruby_interpreter}_rubygems_version")"}"
- 
          2
          
                version="${version:-"$(__rvm_db "rubygems_version")"}"
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          1
          
            case "$version" in
- 
          
          
              latest-*)
- 
          1
          
                version="${version#latest-}"
- 
          5
          
                version="$(rubygems_version_list | GREP_OPTIONS="" \grep "^${version}\." | tail -n 1 )"
- 
          1
          
                version="${version}"
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          - 
          1
          
            case "${version:-missing}" in
- 
          
          
              head|master)
- 
          
          
                typeset sha
- 
          
          
                sha="$(rubygems_master_sha)"
- 
          
          
                rvm_rubygems_version="$version"
- 
          
          
                rvm_gem_package_name="rubygems-${sha}"
- 
          
          
                rvm_gem_url="https://github.com/rubygems/rubygems/archive/${sha}.tar.gz"
- 
          
          
                export rvm_verify_downloads_flag=1
- 
          
          
                ;;
- 
          
          
              v*)
- 
          
          
                rvm_rubygems_version="$version"
- 
          
          
                rvm_gem_package_name="rubygems-${version#v}"
- 
          
          
                rvm_gem_url="https://github.com/rubygems/rubygems/archive/$version.tar.gz"
- 
          
          
                export rvm_verify_downloads_flag=1
- 
          
          
                ;;
- 
          
          
              missing)
- 
          
          
                rvm_error "There was an error while trying to resolve rubygems version for '$1'. \nHalting the installation."
- 
          
          
                return 4
- 
          
          
                ;;
- 
          
          
              *)
- 
          1
          
                rvm_rubygems_version="$version"
- 
          1
          
                rvm_gem_package_name="rubygems-${rvm_rubygems_version}"
- 
          2
          
                rvm_rubygems_url=$(__rvm_db "rubygems_url")
- 
          1
          
                rvm_gem_url="${rvm_rubygems_url}/${rvm_gem_package_name}.tgz"
- 
          
          
                ;;
- 
          
          
            esac
- 
          
          
          }
- 
          
          
          - 
          
          
          rubygems_setup()
- 
          
          
          {
- 
          1
          
            __rvm_warn_on_rubyopt
- 
          
          
          - 
          1
          
            true ${rvm_ruby_selected_flag:=0}
- 
          
          
          - 
          1
          
            unset RUBYOPT
- 
          
          
          - 
          2
          
            (( rvm_ruby_selected_flag == 0 )) || __rvm_select
- 
          
          
          - 
          1
          
            rubygems_select_version_url "$version" || return $?
- 
          
          
          - 
          1
          
            make_sure_jruby_can_work_with_rubygems ||
- 
          
          
            rubygems_fatal_error "RVM can not install rubygems for older jruby, select other ruby and try again." $?
- 
          
          
          - 
          
          
            # always cleanup!
- 
          1
          
            [[ -d "${rvm_src_path}/$rvm_gem_package_name" ]] ||
- 
          
          
              __rvm_rm_rf "${rvm_src_path}/$rvm_gem_package_name"
- 
          
          
          - 
          1
          
            rvm_log "Retrieving $rvm_gem_package_name"
- 
          1
          
            "$rvm_scripts_path/fetch" "$rvm_gem_url" "${rvm_gem_package_name}.tgz" ||
- 
          
          
            rubygems_fatal_error "There has been an error while trying to fetch rubygems. \nHalting the installation." $?
- 
          
          
          - 
          1
          
            __rvm_log_command "rubygems.extract" "Extracting $rvm_gem_package_name ..." \
- 
          
          
            __rvm_package_extract "${rvm_archives_path}/$rvm_gem_package_name.tgz" "${rvm_src_path}" ||
- 
          
          
            rubygems_fatal_error "There has been an error while trying to extract rubygems. \nHalting the installation." $?
- 
          
          
          - 
          1
          
            rubygems_remove # Remove old gems.
- 
          
          
          - 
          1
          
            __rvm_cd "${rvm_src_path}/$rvm_gem_package_name"
- 
          
          
          - 
          
          
            if
- 
          1
          
              __rvm_log_command "rubygems.install" "Installing $rvm_gem_package_name for ${rvm_ruby_string}" \
- 
          
          
                GEM_PATH="$GEM_PATH:${GEM_PATH%%@*}@global" GEM_HOME="$GEM_HOME" "${rvm_ruby_binary}" -d "${rvm_src_path}/$rvm_gem_package_name/setup.rb"
- 
          
          
            then
- 
          1
          
              typeset program_suffix
- 
          2
          
              program_suffix="$( __rvm_ruby_config_get configure_args "${rvm_ruby_binary}" )"
- 
          1
          
              case "${program_suffix:-}" in
- 
          
          
                (*--program-suffix=*)
- 
          
          
                  program_suffix="${program_suffix#*--program-suffix=}"
- 
          
          
                  program_suffix="${program_suffix%%[\' ]*}"
- 
          
          
                  __rvm_run "link.gem" "ln -s \"$rvm_ruby_home/bin/gem${program_suffix}\" \
- 
          
          
                    \"$rvm_ruby_home/bin/gem\"" "$rvm_ruby_string - #linking gem${program_suffix} -> gem "
- 
          
          
                  ;;
- 
          
          
              esac
- 
          1
          
              rvm_log "Installation of rubygems completed successfully."
- 
          
          
            else
- 
          
          
              rvm_warn "Installation of rubygems did not complete successfully."
- 
          
          
            fi
- 
          
          
          - 
          1
          
            __rvm_rubygems_create_link "${rvm_ruby_binary}"
- 
          
          
          }
- 
          
          
          - 
          
          
          rubygems_link()
- 
          
          
          {
- 
          
          
            __rvm_rubygems_create_link
- 
          
          
          }
- 
          
          
          - 
          1
          
          builtin command -v ruby > /dev/null || {
- 
          
          
            rvm_error "'ruby' was not found, cannot install rubygems unless ruby is present (Do you have an RVM ruby installed & selected?)"
- 
          
          
            exit 1
- 
          
          
          }
- 
          
          
          - 
          
          
          rubygems_validate_gemfile_extract()
- 
          
          
          (
- 
          
          
            \mkdir -p "$2/gem" &&
- 
          
          
            \tar -C "$2" -xf "$1" --touch &&
- 
          
          
            \cd "$2" &&
- 
          
          
            \gzip -d "metadata.gz" &&
- 
          
          
            \tar -C gem -xzf "data.tar.gz" --touch &&
- 
          
          
            \rm "data.tar.gz" ||
- 
          
          
            {
- 
          
          
              typeset ret=$?
- 
          
          
              rvm_error "Error extracting '$1' to '$2'."
- 
          
          
              \rm -rf "${rvm_tmp_path}/rg$$"
- 
          
          
              return $ret
- 
          
          
            }
- 
          
          
          )
- 
          
          
          - 
          
          
          # Adapted from: https://gist.github.com/4678778
- 
          
          
          rubygems_validate_gemfile()
- 
          
          
          (
- 
          
          
            gem_file="$1"
- 
          
          
            downloaded_file="${gem_file##*/}"
- 
          
          
            gem__url="${2:-https://d2chzxaqi4y7f8.cloudfront.net/gems/$downloaded_file}"
- 
          
          
            dir_local_copy="${downloaded_file%.gem}--local"
- 
          
          
            dir_remote_copy="${downloaded_file%.gem}-remote"
- 
          
          
          - 
          
          
            mkdir -p "${rvm_tmp_path}/rg$$"
- 
          
          
            cd "${rvm_tmp_path}/rg$$"
- 
          
          
          - 
          
          
            curl -fsS3 "$gem__url" -o "$downloaded_file" &&
- 
          
          
            [[ -f "$downloaded_file" ]] ||
- 
          
          
            {
- 
          
          
              typeset ret=$?
- 
          
          
              rvm_error "Could not download '$gem__url'."
- 
          
          
              \rm -rf "${rvm_tmp_path}/rg$$"
- 
          
          
              return $ret
- 
          
          
            }
- 
          
          
          - 
          
          
            rubygems_validate_gemfile_extract "$gem_file"        "$dir_local_copy"  || return $?
- 
          
          
            rubygems_validate_gemfile_extract "$downloaded_file" "$dir_remote_copy" || return $?
- 
          
          
          - 
          
          
            # compare
- 
          
          
            diff -ru "$dir_local_copy" "$dir_remote_copy"
- 
          
          
          - 
          
          
            # cleanup
- 
          
          
            \rm -rf "${rvm_tmp_path}/rg$$"
- 
          
          
          )
- 
          
          
          - 
          
          
          rubygems_validate_list_gemdirs()
- 
          
          
          {
- 
          
          
            for gemdir in "$@"
- 
          
          
            do
- 
          
          
              while [[ -L "${gemdir}" ]]
- 
          
          
              do gemdir="$( readlink "${gemdir}" )"
- 
          
          
              done
- 
          
          
              echo "${gemdir}"
- 
          
          
            done | sort -u
- 
          
          
          }
- 
          
          
          - 
          
          
          # Adapted from: https://gist.github.com/4678189
- 
          
          
          rubygems_validate()
- 
          
          
          {
- 
          
          
            which openssl > /dev/null ||
- 
          
          
              rubygems_fatal_error "'openssl' was not found, please install it."
- 
          
          
          - 
          
          
            typeset gemdir gemfile url gem loc rem log
- 
          
          
            typeset -a gemdirs
- 
          
          
          - 
          
          
            rvm_log  "Validating RubyGems... This will take a while..."
- 
          
          
          - 
          
          
            __rvm_read_lines gemdirs <(
- 
          
          
              rubygems_validate_list_gemdirs "$@"
- 
          
          
            )
- 
          
          
          - 
          
          
            (( ${#gemdirs[@]} )) ||
- 
          
          
            __rvm_read_lines gemdirs <(
- 
          
          
              rubygems_validate_list_gemdirs "$rvm_gems_path"/*/cache
- 
          
          
            )
- 
          
          
          - 
          
          
            for gemdir in "${gemdirs[@]}"
- 
          
          
            do
- 
          
          
              for gem in "$gemdir"/*.gem
- 
          
          
              do
- 
          
          
                gemfile="${gem##*/}"
- 
          
          
                url="https://d2chzxaqi4y7f8.cloudfront.net/gems/$gemfile"
- 
          
          
                printf "%b" "${rvm_notify_clr}${gem}${rvm_reset_clr}"
- 
          
          
          - 
          
          
                loc=$(openssl md5 $gem |cut -d" " -f2)
- 
          
          
                rem=$(curl -3 -s -D - -X HEAD -H 'Connection:close' "$url" | \grep 'ETag' | cut -d'"' -f2)
- 
          
          
          - 
          
          
                [[ $loc == $rem ]] ||
- 
          
          
                {
- 
          
          
                  printf "%b" " "
- 
          
          
                  log="${rvm_log_path}/$gemfile.diff"
- 
          
          
                  rubygems_validate_gemfile "$gem" "$url" > "$log"
- 
          
          
                  printf "%b" "${rvm_error_clr}mismatch, local: $loc, remote: $rem${rvm_reset_clr}, differences recorded in '$log'"
- 
          
          
                }
- 
          
          
                printf "%b" ", "
- 
          
          
              done
- 
          
          
            done
- 
          
          
          - 
          
          
            rvm_log "\nDone verifying gems."
- 
          
          
          }
- 
          
          
          - 
          
          
          #
- 
          
          
          # rvm rubygems X
- 
          
          
          #
- 
          1
          
          export version
- 
          1
          
          version="$1"
- 
          1
          
          shift
- 
          
          
          - 
          1
          
          [[ -n "$version" ]] || {
- 
          
          
            rvm_error "Usage: rvm rubygems [x.y.z|latest-x.y|latest|remove]"
- 
          
          
            exit 1
- 
          
          
          }
- 
          
          
          - 
          1
          
          can_switch_rubygems ||
- 
          
          
          rubygems_fatal_error "RVM can not install rubygems for maglev and older jruby, select other ruby and try again." $?
- 
          
          
          - 
          1
          
          case "$version" in
- 
          
          
            remove|link|validate|validate_gemfile)
- 
          
          
              rubygems_$version "$@"
- 
          
          
              ;;
- 
          
          
            *)
- 
          1
          
              rubygems_setup
- 
          
          
              ;;
- 
          
          
          esac
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          
          
          # __rvm_select implementation version patch_level
- 
          
          
          __rvm_select()
- 
          
          
          {
- 
          245
          
            true ${rvm_gemset_name:=}
- 
          245
          
            typeset _original_env_string
- 
          245
          
            _original_env_string=${rvm_env_string}
- 
          
          
          - 
          
          
            # Set Variable Defaults
- 
          245
          
            export -a rvm_configure_flags rvm_patch_names rvm_ree_options rvm_make_flags
- 
          245
          
            export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
- 
          245
          
            export rvm_env_string rvm_action rvm_alias_expanded rvm_archive_extension rvm_bin_flag rvm_bin_path rvm_debug_flag rvm_default_flag rvm_delete_flag rvm_docs_type rvm_dump_environment_flag rvm_error_message rvm_expanding_aliases rvm_file_name rvm_gemdir_flag rvm_gemset_name rvm_gemstone_package_file rvm_gemstone_url rvm_head_flag rvm_hook rvm_install_on_use_flag rvm_llvm_flag rvm_loaded_flag rvm_niceness rvm_nightly_flag rvm_only_path_flag rvm_parse_break rvm_patch_original_pwd rvm_pretty_print_flag rvm_proxy rvm_quiet_flag rvm_reload_flag rvm_remove_flag rvm_ruby_alias rvm_ruby_args rvm_ruby_binary rvm_ruby_bits rvm_ruby_configure rvm_ruby_file rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_global_gems_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_make rvm_ruby_make_install rvm_ruby_minor_version rvm_ruby_mode rvm_ruby_name rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_patch rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_sha rvm_ruby_string rvm_ruby_strings rvm_ruby_tag rvm_ruby_url rvm_ruby_user_tag rvm_ruby_version rvm_script_name rvm_sdk rvm_silent_flag rvm_sticky_flag rvm_system_flag rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_wrapper_name rvm_architectures
- 
          
          
          - 
          
          
            # First respect parameter
- 
          245
          
            rvm_ruby_string="${1:-${rvm_ruby_string:-}}"
- 
          
          
            # Then try to detect
- 
          
          
            if
- 
          245
          
              [[ -z "${rvm_ruby_string:-}" ]]
- 
          
          
            then
- 
          
          
              rvm_ruby_string="${rvm_ruby_interpreter:-}"
- 
          
          
              rvm_ruby_string="${rvm_ruby_string:-}${rvm_ruby_version:+-}${rvm_ruby_version:-}"
- 
          
          
              rvm_ruby_string="${rvm_ruby_string:-}${rvm_ruby_patch_level:+-}${rvm_ruby_patch_level:-}"
- 
          
          
              rvm_ruby_string="${rvm_ruby_string:-}${rvm_ruby_revision:+-}${rvm_ruby_revision:-}"
- 
          
          
              if [[ -n "${rvm_ruby_name:-}" ]]
- 
          
          
              then rvm_ruby_name="$rvm_ruby_string-$rvm_ruby_name"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          247
          
            __rvm_ruby_string || return $?
- 
          
          
          - 
          243
          
            rvm_archive_extension="tar.gz"
- 
          
          
          - 
          243
          
            if [[ -z "${rvm_ruby_interpreter:-}" ]]
- 
          
          
            then
- 
          
          
              rvm_ruby_interpreter="${rvm_ruby_string//-*/}"
- 
          
          
            fi
- 
          
          
          - 
          243
          
            case "${rvm_ruby_interpreter:-missing}" in
- 
          
          
              missing)
- 
          
          
                return 2
- 
          
          
                ;;
- 
          
          
              opal)
- 
          
          
                rvm_ruby_version="head"
- 
          
          
                rvm_ruby_revision="head"
- 
          
          
                rvm_ruby_interpreter="opal"
- 
          
          
                rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
- 
          
          
                rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
- 
          
          
                rvm_disable_binary_flag=1
- 
          
          
                ;;
- 
          
          
              topaz)
- 
          
          
                rvm_ruby_version="head"
- 
          
          
                rvm_ruby_revision="head"
- 
          
          
                rvm_ruby_interpreter="topaz"
- 
          
          
                rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "topaz_repo_url")}"
- 
          
          
                rvm_ruby_url="${rvm_ruby_url:-$(__rvm_db "topaz_url")}"
- 
          
          
                rvm_disable_binary_flag=1
- 
          
          
                ;;
- 
          
          
              macruby)
- 
          
          
                if [[ "Darwin" == "$(uname)" ]]
- 
          
          
                then
- 
          
          
                  rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
- 
          
          
                  if (( ${rvm_head_flag:=0} == 1 ))
- 
          
          
                  then
- 
          
          
                    rvm_ruby_version="" ; rvm_ruby_tag=""
- 
          
          
                    rvm_ruby_revision="head"
- 
          
          
                    __rvm_db "macruby_repo_url" "rvm_ruby_repo_url"
- 
          
          
                    rvm_ruby_url="$rvm_ruby_repo_url"
- 
          
          
                    rvm_disable_binary_flag=1
- 
          
          
          - 
          
          
                  elif [[ "nightly" == "${rvm_ruby_version:-}" ]]
- 
          
          
                  then
- 
          
          
                    __rvm_db "macruby_nightly_url" "rvm_ruby_url"
- 
          
          
                    rvm_ruby_package_name="${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}"
- 
          
          
                    rvm_ruby_package_file="$rvm_ruby_package_name"
- 
          
          
          - 
          
          
                  elif [[ -n "${rvm_ruby_version:-}" ]]
- 
          
          
                  then
- 
          
          
                    __rvm_db "macruby_${rvm_ruby_version}_url" "rvm_ruby_url"
- 
          
          
                    [[ -n "${rvm_ruby_url:-}" ]] || __rvm_db "macruby_url" "rvm_ruby_url"
- 
          
          
                    rvm_ruby_package_name="MacRuby%20${rvm_ruby_version}.zip"
- 
          
          
                    rvm_ruby_package_file="$rvm_ruby_package_name"
- 
          
          
                    rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_name"
- 
          
          
          - 
          
          
                  else
- 
          
          
                    __rvm_db "macruby_version" "rvm_ruby_version"
- 
          
          
                    __rvm_db "macruby_url" "rvm_ruby_url"
- 
          
          
                    rvm_ruby_package_name="MacRuby%20${rvm_ruby_version}.zip"
- 
          
          
                    rvm_ruby_package_file="$rvm_ruby_package_name"
- 
          
          
                    rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_name"
- 
          
          
                  fi
- 
          
          
                  rvm_ruby_patch_level=""
- 
          
          
                else
- 
          
          
                  rvm_error "MacRuby can only be installed on a Darwin OS."
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              rbx|rubinius)
- 
          
          
                if
- 
          10
          
                  (( ${rvm_nightly_flag:=0} == 1 ))
- 
          
          
                then
- 
          
          
                  typeset org_rvm_ruby_patch_level _rvm_ruby_name
- 
          
          
                  if [[ "$rvm_ruby_version" == head ]]
- 
          
          
                  then rvm_ruby_version=""
- 
          
          
                  fi
- 
          
          
                  rvm_debug "searching for binary rbx ${rvm_ruby_version:-}${rvm_ruby_version:+-}${rvm_ruby_patch_level}*${rvm_ruby_name:+-}${rvm_ruby_name:-}"
- 
          
          
                  org_rvm_ruby_patch_level="$rvm_ruby_patch_level"
- 
          
          
                  _rvm_ruby_name="${rvm_ruby_name:-${detected_rvm_ruby_name:-}}"
- 
          
          
                  rvm_ruby_patch_level="$(
- 
          
          
                    __list_remote_rbx_for $( __rvm_system_path_for rbx ) |
- 
          
          
                      GREP_OPTIONS="" \grep ${rvm_ruby_version:-}${rvm_ruby_version:+-}${org_rvm_ruby_patch_level}.*${_rvm_ruby_name:+-}${_rvm_ruby_name:-} |
- 
          
          
                      tail -n 1
- 
          
          
                  )"
- 
          
          
                  [[ -n "${rvm_ruby_patch_level:-}" ]] ||
- 
          
          
                  {
- 
          
          
                    rvm_error "Could not find rbx binary '${rvm_ruby_version:-}${rvm_ruby_version:+-}${org_rvm_ruby_patch_level}*${rvm_ruby_name:+-}${rvm_ruby_name:-}' release for '$( __rvm_system_path_for rbx )'."
- 
          
          
                    return 1
- 
          
          
                  }
- 
          
          
                  rvm_ruby_patch_level="${rvm_ruby_patch_level##*/}"
- 
          
          
                  rvm_ruby_patch_level="${rvm_ruby_patch_level%.tar.*}"
- 
          
          
                  if
- 
          
          
                    [[ -z "${rvm_ruby_version:-}" ]]
- 
          
          
                  then
- 
          
          
                    rvm_ruby_patch_level="${rvm_ruby_patch_level#rubinius-}"
- 
          
          
                    rvm_ruby_version="${rvm_ruby_patch_level%%-*}"
- 
          
          
                  fi
- 
          
          
                  if
- 
          
          
                    [[ -z "${rvm_ruby_name:-}" ]]
- 
          
          
                  then
- 
          
          
                    rvm_ruby_name="${rvm_ruby_patch_level##*-}"
- 
          
          
                  fi
- 
          
          
                  rvm_ruby_patch_level="${rvm_ruby_patch_level##*${org_rvm_ruby_patch_level}}"
- 
          
          
                  rvm_ruby_patch_level="${rvm_ruby_patch_level%%-*}"
- 
          
          
                  rvm_ruby_patch_level="${org_rvm_ruby_patch_level}${rvm_ruby_patch_level}"
- 
          
          
                  rvm_ruby_string="rubinius-${rvm_ruby_version}-${rvm_ruby_patch_level}-${rvm_ruby_name}"
- 
          
          
                  rvm_debug "detected rbx ${rvm_ruby_string}"
- 
          
          
                  rvm_verify_downloads_flag=1
- 
          
          
                fi
- 
          
          
          - 
          10
          
                rvm_archive_extension="tar.gz"
- 
          10
          
                rvm_ruby_interpreter="rbx"
- 
          10
          
                rvm_ruby_version=${rvm_ruby_version:-$(__rvm_db "rbx_version")}
- 
          20
          
                rvm_ruby_repo_url=${rvm_rbx_repo_url:-$(__rvm_db "rubinius_repo_url")}
- 
          20
          
                rbx_url=${rbx_url:-$(__rvm_db "rbx_url")}
- 
          
          
          - 
          10
          
                case "${rvm_ruby_version}" in
- 
          
          
                  (2.0pre)
- 
          
          
                    rvm_ruby_repo_branch="master" ;;
- 
          
          
                  (2.0.testing)
- 
          
          
                    rvm_ruby_repo_branch="${rvm_ruby_version}" ;;
- 
          
          
                esac
- 
          
          
          - 
          10
          
                if (( ${rvm_head_flag:=0} == 0 ))
- 
          
          
                then
- 
          10
          
                  if [[ -n "${rvm_ruby_patch_level:-}" ]]
- 
          
          
                  then
- 
          20
          
                    rbx_url="$( __rvm_db "rbx_2.0.0_url" )"
- 
          10
          
                    rvm_archive_extension="zip"
- 
          10
          
                    rvm_ruby_url="${rbx_url}"
- 
          10
          
                    rvm_ruby_package_file="release-${rvm_ruby_version}-${rvm_ruby_patch_level}.${rvm_archive_extension}"
- 
          10
          
                    rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_file"
- 
          
          
                  else
- 
          
          
                    rvm_ruby_patch_level=""
- 
          
          
                    rvm_ruby_url="${rbx_url}"
- 
          
          
                    rvm_ruby_package_file="rubinius-${rvm_ruby_version}.${rvm_archive_extension}"
- 
          
          
                    rvm_ruby_url="$rvm_ruby_url/$rvm_ruby_package_file"
- 
          
          
                  fi
- 
          
          
                else
- 
          
          
                  rvm_ruby_patch_level=""
- 
          
          
                  rvm_ruby_version="head"
- 
          
          
                  rvm_disable_binary_flag=1
- 
          
          
                fi
- 
          
          
          - 
          10
          
                if [[ -n "${rvm_rbx_opt:-}" ]]
- 
          
          
                then
- 
          
          
                  export RBXOPT="${RBXOPT:=${rvm_rbx_opt}}"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              jruby)
- 
          
          
                rvm_ruby_patch_level=""
- 
          
          
                rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
- 
          
          
                rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
- 
          
          
                if (( ${rvm_head_flag:=0} == 1 ))
- 
          
          
                then
- 
          
          
                  rvm_disable_binary_flag=1
- 
          
          
                  rvm_ruby_version="head"
- 
          
          
                else
- 
          
          
                  if (( ${rvm_18_flag:-0} || ${rvm_19_flag:-0} || ${#rvm_patch_names[@]} ))
- 
          
          
                  then rvm_disable_binary_flag=1
- 
          
          
                  fi
- 
          
          
                  rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "jruby_version")"}"
- 
          
          
                  rvm_ruby_tag="${rvm_ruby_tag:-${rvm_ruby_version}}"
- 
          
          
                fi
- 
          
          
          - 
          
          
                alias jruby_ng="jruby --ng"
- 
          
          
                alias jruby_ng_server="jruby --ng-server"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              maglev)
- 
          
          
                rvm_ruby_patch_level=""
- 
          
          
                maglev_url="$(__rvm_db "maglev_url")"
- 
          
          
          - 
          
          
                system="$(uname -s)"
- 
          
          
                if [[ "$MACHTYPE" == x86_64-apple-darwin* ]]
- 
          
          
                then
- 
          
          
                  arch="i386" # Anyone else hear circus musik? ;)
- 
          
          
                else
- 
          
          
                  arch="$(uname -m)"
- 
          
          
                fi
- 
          
          
          - 
          
          
                if (( ${rvm_head_flag:=0} == 1 )) || [[ "$rvm_ruby_version" == "head" ]]
- 
          
          
                then
- 
          
          
                  rvm_head_flag=1
- 
          
          
                  rvm_ruby_version="head"
- 
          
          
                  rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
- 
          
          
                  rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
- 
          
          
                  rvm_gemstone_version=$(
- 
          
          
                    command curl -s https://raw.github.com/MagLev/maglev/master/version.txt |
- 
          
          
                      GREP_OPTIONS="" \grep ^GEMSTONE | cut -f2 -d-
- 
          
          
                  )
- 
          
          
                  rvm_gemstone_package_file="GemStone-${rvm_gemstone_version}.${system}-${arch}"
- 
          
          
                  rvm_disable_binary_flag=1
- 
          
          
                else
- 
          
          
                  rvm_ruby_package_file="MagLev-${rvm_ruby_version}" # removed from 1.0: .${system}-${arch}
- 
          
          
                  rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "maglev_version")"}"
- 
          
          
                  rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
- 
          
          
                  rvm_ruby_url="${rvm_ruby_url:-"$maglev_url/${rvm_ruby_package_file}.${rvm_archive_extension}"}"
- 
          
          
                  rvm_gemstone_version=$(
- 
          
          
                    command curl -s https://raw.github.com/MagLev/maglev/MagLev-${rvm_ruby_version}/version.txt |
- 
          
          
                      GREP_OPTIONS="" \grep ^GEMSTONE | cut -f2 -d-
- 
          
          
                  )
- 
          
          
                  rvm_gemstone_package_file="GemStone-${rvm_gemstone_version}.${system}-${arch}"
- 
          
          
                  export MAGLEV_HOME="$rvm_rubies_path/$rvm_ruby_string"
- 
          
          
                fi
- 
          
          
          - 
          
          
                rvm_gemstone_url="$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              ironruby)
- 
          
          
                rvm_ruby_patch_level=""
- 
          
          
          - 
          
          
                if (( ${rvm_head_flag:=0} == 1 ))
- 
          
          
                then
- 
          
          
                  rvm_ruby_version="head"
- 
          
          
                  rvm_ruby_package_name="${rvm_ruby_string}"
- 
          
          
                  rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
- 
          
          
                  rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
- 
          
          
                  rvm_disable_binary_flag=1
- 
          
          
          - 
          
          
                else
- 
          
          
                  rvm_archive_extension="zip"
- 
          
          
                  rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ironruby_version")"}
- 
          
          
                  rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
- 
          
          
                  rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}.${rvm_archive_extension}"
- 
          
          
                  rvm_ruby_url="$(__rvm_db "ironruby_${rvm_ruby_version}_url")"
- 
          
          
                fi
- 
          
          
          - 
          
          
                export rvm_ruby_version rvm_ruby_string rvm_ruby_package_name rvm_ruby_repo_url rvm_ruby_url rvm_archive_extension
- 
          
          
                ;;
- 
          
          
          - 
          
          
              ree)
- 
          
          
                rvm_ruby_interpreter=ree
- 
          
          
                rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ree_version")"}
- 
          
          
          - 
          
          
                case "$rvm_ruby_version" in
- 
          
          
                  1.8.*) true ;; # all good!
- 
          
          
                  *) rvm_error "Unknown Ruby Enterprise Edition version: $rvm_ruby_version" ;;
- 
          
          
                esac
- 
          
          
          - 
          
          
                if [[ -n "${rvm_ruby_patch_level:-0}" ]]
- 
          
          
                then
- 
          
          
                  rvm_ruby_patch_level="$(echo $rvm_ruby_patch_level | \sed 's#^p##')"
- 
          
          
                fi
- 
          
          
          - 
          
          
                rvm_ruby_package_file="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level"
- 
          
          
                rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_${rvm_ruby_patch_level}_url")"
- 
          
          
                rvm_ruby_url="${rvm_ruby_url:-$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")}"
- 
          
          
                rvm_ruby_url="${rvm_ruby_url}/$rvm_ruby_package_file.tar.gz"
- 
          
          
                ;;
- 
          
          
          - 
          
          
              kiji)
- 
          
          
                rvm_ruby_interpreter="kiji"
- 
          
          
                rvm_ruby_version="head"
- 
          
          
                rvm_head_flag=1
- 
          
          
                rvm_ruby_string="kiji-head"
- 
          
          
                rvm_ruby_patch_level=""
- 
          
          
                rvm_ruby_repo_url=${rvm_ruby_repo_url:-"$(__rvm_db "kiji_repo_url")"}
- 
          
          
                rvm_ruby_url=$rvm_ruby_repo_url
- 
          
          
                rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
- 
          
          
                ;;
- 
          
          
          - 
          
          
              goruby)
- 
          
          
                rvm_ruby_interpreter="goruby"
- 
          
          
                rvm_ruby_version="head"
- 
          
          
                rvm_ruby_string="goruby"
- 
          
          
                rvm_ruby_patch_level=""
- 
          
          
                rvm_ruby_repo_url=${rvm_ruby_repo_url:-"$(__rvm_db "goruby_repo_url")"}
- 
          
          
                rvm_ruby_url=$rvm_ruby_repo_url
- 
          
          
                rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
- 
          
          
                ;;
- 
          
          
          - 
          
          
              mruby)
- 
          
          
                rvm_ruby_interpreter="mruby"
- 
          
          
                rvm_ruby_version="head"
- 
          
          
                rvm_ruby_string="mruby-head"
- 
          
          
                rvm_ruby_patch_level=""
- 
          
          
                rvm_ruby_repo_url=${rvm_ruby_repo_url:-"$(__rvm_db "mruby_repo_url")"}
- 
          
          
                rvm_ruby_url=$rvm_ruby_repo_url
- 
          
          
                export rvm_head_flag=1
- 
          
          
                rvm_disable_binary_flag=1
- 
          
          
                export rvm_skip_autoreconf_flag=1
- 
          
          
                rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
- 
          
          
                ;;
- 
          
          
          - 
          
          
              tcs)
- 
          
          
                rvm_ruby_interpreter="tcs"
- 
          
          
                rvm_ruby_version="head"
- 
          
          
                rvm_ruby_string="tcs"
- 
          
          
                rvm_ruby_patch_level=""
- 
          
          
                rvm_ruby_repo_url=${rvm_tcs_repo_url:-"$(__rvm_db "tcs_repo_url")"}
- 
          
          
                rvm_ruby_url=$rvm_ruby_repo_url
- 
          
          
                rvm_ruby_repo_branch="${rvm_ruby_repo_branch:-"$(__rvm_db "tcs_repo_branch")"}"
- 
          
          
                export rvm_head_flag=1
- 
          
          
                rvm_disable_binary_flag=1
- 
          
          
                rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
- 
          
          
                ;;
- 
          
          
          - 
          
          
              jamesgolick)
- 
          
          
                rvm_ruby_interpreter="jamesgolick"
- 
          
          
                rvm_ruby_version="head"
- 
          
          
                rvm_ruby_string="jamesgolick"
- 
          
          
                rvm_ruby_patch_level=""
- 
          
          
                rvm_ruby_repo_url=${rvm_jamesgolick_repo_url:-"$(__rvm_db "jamesgolick_repo_url")"}
- 
          
          
                rvm_ruby_url=$rvm_ruby_repo_url
- 
          
          
                rvm_ruby_repo_branch="${rvm_ruby_repo_branch:-"$(__rvm_db "jamesgolick_repo_branch")"}"
- 
          
          
                export rvm_head_flag=1
- 
          
          
                rvm_disable_binary_flag=1
- 
          
          
                rvm_ruby_configure="" ; rvm_ruby_make="" ; rvm_ruby_make_install=""
- 
          
          
                ;;
- 
          
          
          - 
          
          
          - 
          
          
              ruby)
- 
          223
          
                if [[ -n "${rvm_ruby_patch_level}" ]]
- 
          
          
                then
- 
          223
          
                  rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}"
- 
          223
          
                  rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}"
- 
          
          
                else
- 
          
          
                  rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}"
- 
          
          
                  rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
- 
          
          
                fi
- 
          
          
          - 
          223
          
                if [[ -z "${rvm_ruby_version:-""}" ]] && (( ${rvm_head_flag:=0} == 0 ))
- 
          
          
                then
- 
          
          
                  rvm_error "Ruby version was not specified!"
- 
          
          
                else
- 
          431
          
                  rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}"
- 
          223
          
                  if (( ${rvm_head_flag:=0} == 0 ))
- 
          
          
                  then
- 
          223
          
                    if __rvm_version_compare "${rvm_ruby_version}" -lt "1.8.5"
- 
          
          
                    then
- 
          
          
                      rvm_archive_extension="tar.gz"
- 
          
          
                    else
- 
          223
          
                      rvm_archive_extension="tar.bz2"
- 
          
          
                    fi
- 
          
          
                  else rvm_disable_binary_flag=1
- 
          
          
                  fi
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              ext)
- 
          
          
                if [[ -z "${rvm_ruby_name:-${detected_rvm_ruby_name:-}}" ]]
- 
          
          
                then
- 
          
          
                  rvm_error "External ruby name was not specified!"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              current)
- 
          
          
                ruby_binary="$(builtin command -v ruby)"
- 
          
          
                if
- 
          
          
                  (( $? == 0)) &&
- 
          
          
                  __rvm_string_match "$ruby_binary" "*rvm*"
- 
          
          
                then
- 
          
          
                  rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)"
- 
          
          
                else
- 
          
          
                  rvm_ruby_interpreter="system"
- 
          
          
                fi
- 
          
          
                ;;
- 
          
          
          - 
          
          
              default|system|user)
- 
          10
          
                true
- 
          
          
                ;;
- 
          
          
          - 
          
          
              *)
- 
          
          
                if
- 
          
          
                  [[ -n "${MY_RUBY_HOME:-""}" ]]
- 
          
          
                then
- 
          
          
                   __rvm_select $(basename $MY_RUBY_HOME)
- 
          
          
                elif
- 
          
          
                  [[ -z "${rvm_ruby_string:-""}" ]]
- 
          
          
                then
- 
          
          
                  rvm_error "Ruby implementation '$rvm_ruby_interpreter' is not known."
- 
          
          
                  return 1
- 
          
          
                fi
- 
          
          
            esac
- 
          
          
          - 
          243
          
            if [[ -n "$rvm_ruby_version" ]]
- 
          
          
            then
- 
          233
          
              case "$rvm_ruby_version" in
- 
          
          
                (+([[:digit:]]).+([[:digit:]]).+([[:digit:]]))
- 
          233
          
                  rvm_ruby_release_version="${rvm_ruby_version/.*/}"
- 
          466
          
                  rvm_ruby_major_version=${rvm_ruby_version%.*} ; rvm_ruby_major_version=${rvm_ruby_major_version#*.}
- 
          233
          
                  rvm_ruby_minor_version="${rvm_ruby_version//*.}"
- 
          
          
                  ;;
- 
          
          
                (+([[:digit:]]).+([[:digit:]]))
- 
          
          
                  rvm_ruby_release_version="${rvm_ruby_version/.*/}"
- 
          
          
                  rvm_ruby_major_version="${rvm_ruby_version#*.}"
- 
          
          
                  rvm_ruby_minor_version=""
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            fi
- 
          
          
          - 
          243
          
            if [[ "${rvm_ruby_interpreter}" == ext ]]
- 
          
          
            then
- 
          
          
              rvm_ruby_home="$rvm_externals_path/$rvm_ruby_string"
- 
          
          
              rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
- 
          
          
              rvm_ruby_binary="$( readlink $rvm_ruby_home/bin/ruby )"
- 
          
          
            else
- 
          243
          
              rvm_ruby_package_name="${rvm_ruby_package_name:-${rvm_ruby_string//-n*}}"
- 
          243
          
              rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_string"
- 
          243
          
              rvm_ruby_irbrc="$rvm_ruby_home/.irbrc"
- 
          243
          
              rvm_ruby_binary="$rvm_ruby_home/bin/ruby"
- 
          
          
            fi
- 
          
          
          - 
          
          
            # TODO is this right place to do this ?
- 
          243
          
            if [[ "maglev" == "$rvm_ruby_interpreter" ]]
- 
          
          
            then
- 
          
          
              export MAGLEV_HOME="$rvm_ruby_home"
- 
          
          
              export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
- 
          
          
            fi
- 
          
          
          - 
          243
          
            [[ "system" == "$rvm_ruby_interpreter" ]] ||
- 
          
          
            {
- 
          233
          
              __rvm_gemset_select ||
- 
          34
          
              case $? in
- 
          34
          
                2) true      ;;
- 
          
          
                *) return $? ;;
- 
          
          
              esac
- 
          
          
            }
- 
          
          
          - 
          243
          
            rvm_ruby_selected_flag=1
- 
          
          
          - 
          243
          
            [[ -d "${rvm_log_path}/$rvm_ruby_string" ]] ||
- 
          
          
              \mkdir -p "${rvm_log_path}/$rvm_ruby_string"
- 
          
          
          - 
          243
          
            rvm_ruby_interpreter="${rvm_ruby_interpreter:-system}"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_use_system() {
- 
          
          
          - 
          11
          
            unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
- 
          
          
          - 
          33
          
            new_path="$(__rvm_remove_rvm_from_path ; printf "%b" "$PATH"):${rvm_bin_path}"
- 
          
          
          - 
          11
          
            if [[ -s "$rvm_path/config/system" ]]
- 
          
          
            then
- 
          
          
              if GREP_OPTIONS="" \grep "MY_RUBY_HOME='$rvm_rubies_path" "$rvm_path/config/system" > /dev/null
- 
          
          
              then
- 
          
          
                # 'system' should *not* point to an rvm ruby.
- 
          
          
                if [[ -f "$rvm_path/config/system" ]]
- 
          
          
                then
- 
          
          
                  \rm -f "$rvm_path/config/system"
- 
          
          
                fi
- 
          
          
              else
- 
          
          
                source "$rvm_path/config/system"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          11
          
            if (( ${rvm_default_flag:=0} == 1 ))
- 
          
          
            then
- 
          
          
              "$rvm_scripts_path/alias" delete default &> /dev/null
- 
          
          
          - 
          
          
              \find "${rvm_bin_path}" -maxdepth 0 -name 'default_*' -delete
- 
          
          
              \rm -f "$rvm_path/config/default"
- 
          
          
              \rm -f "$rvm_environments_path/default"
- 
          
          
              __rvm_rm_rf "$rvm_wrappers_path/default"
- 
          
          
            fi
- 
          
          
          - 
          
          
            # Check binaries, remove under the condition they're symlinks.
- 
          11
          
            if (( ${rvm_user_install_flag:=0} == 0 ))
- 
          
          
            then
- 
          88
          
              for binary in ruby gem irb ri rdoc rake erb testrb
- 
          
          
              do
- 
          88
          
                full_binary_path="${rvm_bin_path}/$binary"
- 
          88
          
                if [[ -L "$full_binary_path" ]]
- 
          
          
                then
- 
          
          
                  \rm -f "$full_binary_path"
- 
          
          
                fi
- 
          
          
              done
- 
          
          
            fi
- 
          
          
          - 
          11
          
            if (( ${rvm_verbose_flag:=0} == 1 ))
- 
          
          
            then
- 
          2
          
              rvm_log "Now using system ruby."
- 
          
          
            fi
- 
          
          
          - 
          11
          
            __rvm_remove_rvm_from_path
- 
          
          
          - 
          11
          
            new_path="$PATH:${rvm_bin_path}"
- 
          
          
          - 
          22
          
            export rvm_ruby_string="system"
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_use()
- 
          
          
          {
- 
          188
          
            typeset new_path binary full_binary_path rvm_ruby_gem_home
- 
          
          
          - 
          190
          
            __rvm_select "$@" || return $?
- 
          
          
          - 
          186
          
            if [[ "system" == ${rvm_ruby_interpreter:="system"} ]]
- 
          
          
            then
- 
          10
          
              __rvm_use_system
- 
          
          
            else
- 
          176
          
              if [[ ! -d "$rvm_ruby_home" ]]
- 
          
          
              then
- 
          16
          
                if [[ ${rvm_install_on_use_flag:-0} -eq 1 ]]
- 
          
          
                then
- 
          
          
                  rvm_warn "$rvm_ruby_string is not installed."
- 
          
          
                  __rvm_run_wrapper manage "install" "$rvm_ruby_string"
- 
          
          
                else
- 
          16
          
                  rvm_error "$rvm_ruby_string is not installed."
- 
          16
          
                  rvm_log "To install do: 'rvm install $rvm_ruby_string'"
- 
          32
          
                  export rvm_recommended_ruby="rvm install $rvm_ruby_string"
- 
          16
          
                  return 1
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
          - 
          320
          
              if [[ ! -d "$rvm_ruby_gem_home" || -n "${rvm_expected_gemset_name}" ]]
- 
          
          
              then
- 
          1
          
                if (( ${rvm_gemset_create_on_use_flag:=0} == 1 || ${rvm_create_flag:=0} == 1 ))
- 
          
          
                then
- 
          
          
                  rvm_warn "gemset $rvm_gemset_name is not existing, creating."
- 
          
          
                  "$rvm_scripts_path/gemsets" create "$rvm_gemset_name"
- 
          
          
                else
- 
          1
          
                  rvm_error "Gemset '${rvm_expected_gemset_name}' does not exist, 'rvm gemset create ${rvm_expected_gemset_name}' first, or append '--create'."
- 
          1
          
                  return 2
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
          - 
          159
          
              export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
- 
          159
          
              GEM_HOME="$rvm_ruby_gem_home"
- 
          159
          
              GEM_PATH="$rvm_ruby_gem_path"
- 
          159
          
              MY_RUBY_HOME="$rvm_ruby_home"
- 
          159
          
              RUBY_VERSION="$rvm_ruby_string"
- 
          159
          
              IRBRC="$rvm_ruby_irbrc"
- 
          159
          
              unset BUNDLE_PATH # Ensure that BUNDLE_PATH is not set!
- 
          
          
          - 
          
          
              # Handle MagLev pre-installed gems
- 
          159
          
              if [[ "maglev" == "$rvm_ruby_interpreter" ]]
- 
          
          
              then
- 
          
          
                GEM_PATH="$GEM_PATH:$MAGLEV_HOME/lib/maglev/gems/1.8/"
- 
          
          
              fi
- 
          
          
          - 
          159
          
              [[ -n "${IRBRC:-}" ]] || unset IRBRC
- 
          
          
          - 
          
          
              # Ensure the environment file for the selected ruby exists.
- 
          159
          
              __rvm_ensure_has_environment_files
- 
          
          
          - 
          159
          
              if (( ${rvm_verbose_flag:=0} == 1 ))
- 
          
          
              then
- 
          41
          
                rvm_log "Using ${GEM_HOME/${rvm_gemset_separator:-'@'}/ with gemset }"
- 
          
          
              fi
- 
          
          
          - 
          159
          
              if [[ "$GEM_HOME" != "$rvm_ruby_global_gems_path" ]]
- 
          
          
              then
- 
          456
          
                new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:${rvm_bin_path}:$(__rvm_remove_rvm_from_path ;printf "%b" "$PATH")"
- 
          
          
              else
- 
          21
          
                new_path="$GEM_HOME/bin:$MY_RUBY_HOME/bin:${rvm_bin_path}:$(__rvm_remove_rvm_from_path ;printf "%b" "$PATH")"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          338
          
            [[ -z "${rvm_ruby_string:-}" ]] || export rvm_ruby_string
- 
          249
          
            [[ -z "${rvm_gemset_name:-}" ]] || export rvm_gemset_name
- 
          
          
          - 
          169
          
            if [[ -n "$new_path" ]]
- 
          
          
            then
- 
          338
          
              export PATH="$new_path"
- 
          169
          
              unset new_path
- 
          169
          
              builtin hash -r
- 
          
          
            fi
- 
          
          
          - 
          169
          
            if [[ "$rvm_ruby_string" != "system" ]]
- 
          
          
            then
- 
          159
          
              case "${rvm_rvmrc_flag:-0}" in
- 
          
          
                (rvmrc|versions_conf|ruby_version)
- 
          2
          
                  __rvm_set_${rvm_rvmrc_flag}
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
          - 
          159
          
              typeset environment_id
- 
          318
          
              environment_id="$(__rvm_env_string)"
- 
          
          
          - 
          159
          
              if (( ${rvm_default_flag:=0} == 1 )) &&
- 
          2
          
                [[ "default" != "${rvm_ruby_interpreter:-}" ]] &&
- 
          2
          
                [[ "system"  != "${rvm_ruby_interpreter:-}" ]]
- 
          
          
              then
- 
          
          
                # Switch the default alias to the new environment id
- 
          2
          
                "$rvm_scripts_path/alias" delete default &> /dev/null
- 
          2
          
                "$rvm_scripts_path/alias" create default "$environment_id" >& /dev/null
- 
          
          
              fi
- 
          
          
          - 
          159
          
              rvm_default_flag=0
- 
          
          
          - 
          159
          
              if [[ -n "${rvm_wrapper_name:-}" ]]
- 
          
          
              then
- 
          
          
                "$rvm_scripts_path/wrapper" "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1
- 
          
          
                rvm_wrapper_name=""
- 
          
          
              fi
- 
          
          
          - 
          159
          
              if [[ -n "${rvm_ruby_alias:-}" ]]
- 
          
          
              then
- 
          
          
                rvm_log "Attempting to alias $environment_id to $rvm_ruby_alias"
- 
          
          
                "$rvm_scripts_path/alias" delete "$rvm_ruby_alias" > /dev/null 2>&1
- 
          
          
                rvm_alias_expanded=1 "$rvm_scripts_path/alias" create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
- 
          
          
                ruby_alias="" ; rvm_ruby_alias=""
- 
          
          
              fi
- 
          
          
            else
- 
          10
          
              if (( ${rvm_default_flag:=0} == 1 ))
- 
          
          
              then
- 
          
          
                if ! builtin command -v __rvm_reset >> /dev/null 2>&1
- 
          
          
                then
- 
          
          
                  source "$rvm_scripts_path/functions/reset"
- 
          
          
                  __rvm_reset
- 
          
          
                fi
- 
          
          
              fi
- 
          
          
            fi
- 
          169
          
            rvm_hook="after_use"
- 
          169
          
            source "$rvm_scripts_path/hook"
- 
          169
          
            return 0
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_ruby_string()
- 
          
          
          {
- 
          
          
            # rvm_ruby_string may designate any of the following items:
- 
          
          
            # * rvm_gemset_name
- 
          
          
            # * rvm_ruby_interpreter
- 
          
          
            # * rvm_ruby_version
- 
          
          
            # * rvm_ruby_patch_level
- 
          
          
            # * rvm_ruby_revision
- 
          
          
            # * rvm_ruby_tag
- 
          
          
          - 
          277
          
            typeset ruby_string gemset_name expanded_alias_name repo_url branch_name ruby_name
- 
          
          
          - 
          277
          
            __rvm_default_flags
- 
          
          
          - 
          277
          
            rvm_expanding_aliases=
- 
          
          
          - 
          
          
            true \
- 
          277
          
              "${rvm_ruby_version:=}" "${rvm_gemset_name:=}" "${rvm_ruby_interpreter:=}"\
- 
          
          
              "${rvm_ruby_version:=}" "${rvm_ruby_tag:=}" "${rvm_ruby_patch_level:=}"\
- 
          
          
              "${rvm_ruby_revision:=}" ${rvm_gemset_separator:="@"} "${rvm_ruby_string:=}"\
- 
          
          
              ${rvm_expanding_aliases:=0} ${rvm_head_flag:=0}
- 
          
          
          - 
          831
          
            if echo "$rvm_ruby_string" | GREP_OPTIONS="" \grep "${rvm_gemset_separator}" >/dev/null 2>&1
- 
          
          
            then
- 
          90
          
              rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
- 
          90
          
              rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator}*/}"
- 
          
          
            fi
- 
          
          
          - 
          
          
            # Alias'd rubies
- 
          277
          
            if (( rvm_expanding_aliases == 0 )) &&
- 
          547
          
              [[ -n "${rvm_ruby_string}" && "$rvm_ruby_string" != "system" ]]
- 
          
          
            then
- 
          
          
          - 
          
          
              if
- 
          526
          
                [[ -f "$rvm_path/config/alias" && -s "$rvm_path/config/alias" ]] &&
- 
          72
          
                expanded_alias_name="$("$rvm_scripts_path"/db "$rvm_path/config/alias" "$rvm_ruby_string")" &&
- 
          36
          
                [[ -n "$expanded_alias_name" ]]
- 
          
          
              then
- 
          
          
                rvm_ruby_string="$expanded_alias_name"
- 
          263
          
              elif [[ "$rvm_ruby_string" == default ]]
- 
          
          
              then
- 
          
          
                # Default is not a known value. Instead, we need to therefore set it to system.
- 
          3
          
                rvm_ruby_string="system"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          831
          
            if echo "$rvm_ruby_string" | GREP_OPTIONS="" \grep "${rvm_gemset_separator}" >/dev/null 2>&1 ; then
- 
          
          
              rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
- 
          
          
              rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator}*/}"
- 
          
          
            fi
- 
          
          
          - 
          
          
            # Stash the ruby string.
- 
          277
          
            ruby_string="${rvm_ruby_string:-}"
- 
          277
          
            gemset_name="${rvm_gemset_name:-}"
- 
          277
          
            repo_url="${rvm_ruby_repo_url:-}"
- 
          277
          
            branch_name="${rvm_ruby_repo_branch:-}"
- 
          277
          
            ruby_name="${rvm_ruby_name:-}"
- 
          
          
          - 
          277
          
            __rvm_unset_ruby_variables
- 
          
          
          - 
          277
          
            rvm_ruby_repo_url="${repo_url:-}"
- 
          277
          
            rvm_ruby_repo_branch="${branch_name:-}"
- 
          277
          
            rvm_ruby_name="$ruby_name"
- 
          
          
          - 
          277
          
            if [[ -n "$gemset_name" ]]
- 
          
          
            then
- 
          134
          
              rvm_gemset_name="$gemset_name"
- 
          134
          
              rvm_sticky_flag=1 # <- not sold on this.
- 
          
          
            fi
- 
          
          
          - 
          277
          
            strings=()
- 
          277
          
            __rvm_custom_separated_array strings - "${ruby_string}"
- 
          
          
          - 
          277
          
            if (( ${#strings[@]} == 0 ))
- 
          
          
            then
- 
          21
          
              if echo "${GEM_HOME:-}" | GREP_OPTIONS="" \grep "${rvm_gems_path}" >/dev/null 2>&1
- 
          
          
              then
- 
          
          
                # Current Ruby
- 
          7
          
                strings="${GEM_HOME##*\/}"
- 
          7
          
                strings="${strings/%${rvm_gemset_separator:-"@"}*}"
- 
          7
          
                rvm_ruby_string="$strings"
- 
          14
          
                strings=( $(echo ${rvm_ruby_string//-/ }) )
- 
          
          
              else
- 
          
          
                strings=(system)
- 
          
          
                rvm_ruby_string="system"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          635
          
            for string in ${strings[@]}
- 
          
          
            do
- 
          635
          
              case "$string" in
- 
          
          
                (head)
- 
          
          
                  rvm_ruby_patch_level=""
- 
          
          
                  rvm_ruby_revision=""
- 
          
          
                  rvm_ruby_tag=""
- 
          
          
                  export rvm_head_flag=1
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (system)
- 
          10
          
                  rvm_ruby_interpreter="system"
- 
          10
          
                  rvm_ruby_patch_level=""
- 
          10
          
                  rvm_ruby_tag=""
- 
          10
          
                  rvm_ruby_revision=""
- 
          10
          
                  rvm_ruby_version=""
- 
          10
          
                  rvm_gemset_name=""
- 
          10
          
                  rvm_head_flag=0
- 
          10
          
                  return 0
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (ext|external)
- 
          
          
                  rvm_ruby_interpreter="ext"
- 
          
          
                  rvm_ruby_patch_level=""
- 
          
          
                  rvm_ruby_tag=""
- 
          
          
                  rvm_ruby_revision=""
- 
          
          
                  rvm_ruby_version=""
- 
          
          
                  rvm_head_flag=0
- 
          
          
          - 
          
          
                  unset strings[__array_start]
- 
          
          
                  strings=( ${strings[@]} )
- 
          
          
                  strings="${strings[*]}"
- 
          
          
                  rvm_ruby_name="${strings// /-}"
- 
          
          
                  break
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (nightly|weekly)
- 
          
          
                  if [[ "${rvm_ruby_interpreter}" == "rbx" ]]
- 
          
          
                  then rvm_ruby_patch_level="$string"
- 
          
          
                  else rvm_ruby_version="$string"
- 
          
          
                  fi
- 
          
          
                  rvm_nightly_flag=1
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (nightly*|weekly*) # rbx binary
- 
          
          
                  rvm_ruby_patch_level="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (preview*)
- 
          
          
                  rvm_ruby_patch_level="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (rc[[:digit:]]*)
- 
          
          
                  rvm_ruby_patch_level="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                ([[:digit:]].[[:digit:]]*)
- 
          
          
                  #TODO: use normal code for rbx!
- 
          267
          
                  if [[ "${rvm_ruby_interpreter}" == "rbx" ]]
- 
          
          
                  then
- 
          
          
                    if [[ -z "${rvm_ruby_version}" ]]
- 
          
          
                    then
- 
          
          
                      rvm_ruby_version="${string}"
- 
          
          
                    elif [[ -z "${rvm_ruby_patch_level}" ]]
- 
          
          
                    then
- 
          
          
                      rvm_ruby_patch_level="${string}"
- 
          
          
                    else
- 
          
          
                      rvm_error "Unknown ruby interpreter string component: '$string'."
- 
          
          
                      return 1
- 
          
          
                    fi
- 
          
          
                  else
- 
          267
          
                    case "$string" in
- 
          
          
                      (0.+([[:digit:]])|0.+([[:digit:]]).+([[:digit:]])|1.+([[:digit:]]).+([[:digit:]])|2.+([[:digit:]]).+([[:digit:]])|1.+([[:digit:]]).+([[:digit:]]).+([[:digit:]])|1.+([[:digit:]]))
- 
          264
          
                        rvm_ruby_version="$string"
- 
          264
          
                        rvm_ruby_revision=""
- 
          264
          
                        rvm_ruby_tag=""
- 
          
          
                        ;;
- 
          
          
          - 
          
          
                      (1.+([[:digit:]]).+([[:digit:]]).+([[:alnum:]]))
- 
          
          
                        case "${rvm_ruby_interpreter:-""}" in
- 
          
          
                          (jruby)
- 
          
          
                            rvm_ruby_version="$string"
- 
          
          
                            ;;
- 
          
          
                          (*)
- 
          
          
                            rvm_error "Unknown ruby interpreter version: '$string'."
- 
          
          
                            return 1
- 
          
          
                            ;;
- 
          
          
                        esac
- 
          
          
                        ;;
- 
          
          
          - 
          
          
                      (*)
- 
          3
          
                        rvm_error "Unknown ruby interpreter version: '$string'."
- 
          3
          
                        return 1
- 
          
          
                        ;;
- 
          
          
                    esac
- 
          
          
                  fi
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (p[[:digit:]]*)
- 
          184
          
                  rvm_ruby_patch_level="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                ([[:digit:]][[:digit:]]*)
- 
          
          
          - 
          
          
                  case "${rvm_ruby_interpreter:-""}" in
- 
          
          
                    (ree)
- 
          
          
                      rvm_ruby_patch_level="$string"
- 
          
          
                      rvm_ruby_revision=""
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    (kiji)
- 
          
          
                      rvm_ruby_patch_level="$string"
- 
          
          
                      rvm_ruby_revision=""
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    (rbx)
- 
          
          
                      rvm_ruby_patch_level="$string"
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    (maglev)
- 
          
          
                      rvm_ruby_version="$string"
- 
          
          
                      rvm_ruby_revision=""
- 
          
          
                      rvm_ruby_patch_level=""
- 
          
          
                      ;;
- 
          
          
          - 
          
          
                    (*)
- 
          
          
                      rvm_ruby_revision="r$string"
- 
          
          
                      ;;
- 
          
          
                  esac
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (r[[:digit:]]*)
- 
          
          
                  rvm_ruby_patch_level=""
- 
          
          
                  rvm_ruby_revision="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (s[[:alnum:]]*)
- 
          
          
                  rvm_ruby_revision=""
- 
          
          
                  rvm_ruby_sha="${string#s}"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (tv[[:digit:]]*|t[[:digit:]]*)
- 
          
          
                  rvm_ruby_patch_level="" ; rvm_ruby_revision=""
- 
          
          
                  rvm_ruby_tag="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (m[[:digit:]]*)
- 
          
          
                  rvm_ruby_mode="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (u[[:alnum:]]*)
- 
          
          
                  rvm_ruby_patch_level="" ; rvm_ruby_revision="" ; rvm_ruby_tag="" ; rvm_ruby_patch=""
- 
          
          
                  rvm_ruby_user_tag="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (a[[:digit:]][[:digit:]]*)
- 
          
          
                  rvm_ruby_bits="$string" # Architecture
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (b[[:digit:]]*)
- 
          
          
                  rvm_ruby_repo_branch="${string}"
- 
          
          
                  rvm_head_flag=1
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (opal|ruby|rbx|jruby|macruby|ree|kiji|rubinius|maglev|ironruby|goruby|mruby|tcs|jamesgolick|topaz)
- 
          149
          
                  rvm_ruby_interpreter="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                ([[:alpha:]]*([[:alnum:]]|_))
- 
          25
          
                  rvm_ruby_name="$string"
- 
          
          
                  ;;
- 
          
          
          - 
          
          
                (*)
- 
          
          
                  rvm_error "Unknown ruby interpreter string component: '$string'."
- 
          
          
                  return 1
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            done
- 
          
          
          - 
          264
          
            if [[ -z "${rvm_ruby_interpreter:-""}" ]]
- 
          
          
            then
- 
          
          
              # Detect interpreter based on version.
- 
          115
          
              case "$rvm_ruby_version" in
- 
          105
          
                (1.[8-9]*) rvm_ruby_interpreter="ruby"    ;;
- 
          
          
                (0.[5-6]*) rvm_ruby_interpreter="macruby" ;;
- 
          10
          
                (1.[0-4]*) rvm_ruby_interpreter="rbx"     ;;
- 
          
          
                (1.[5-7]*) rvm_ruby_interpreter="jruby"   ;;
- 
          
          
                (2.0.0*)   rvm_ruby_interpreter="ruby"    ;;
- 
          
          
                (2.*)
- 
          
          
                  rvm_error "Version '$rvm_ruby_version' is ambiguous. Cannot select Ruby implementation/version, please be more specific."
- 
          
          
                  return 2
- 
          
          
                  ;;
- 
          
          
              esac
- 
          
          
            fi
- 
          
          
          - 
          
          
            # Unspecified version
- 
          264
          
            rvm_ruby_version="${rvm_ruby_version:-}"
- 
          264
          
            if [[ -z "${rvm_ruby_version:-}" && "${rvm_ruby_interpreter}" != "ext" ]] && (( ${rvm_head_flag:=0} == 0 ))
- 
          
          
            then
- 
          
          
              rvm_ruby_version="${rvm_ruby_version:-"$(
- 
          
          
              __rvm_db "${rvm_ruby_interpreter}_version"
- 
          
          
              )"}"
- 
          
          
            fi
- 
          
          
          - 
          264
          
            if [[ -z "${rvm_ruby_version:-}" ]]
- 
          
          
            then
- 
          
          
              rvm_ruby_string="${rvm_ruby_interpreter}"
- 
          
          
            else
- 
          264
          
              rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
- 
          
          
            fi
- 
          
          
          - 
          264
          
            if [[ "${rvm_ruby_interpreter}" == "ext" ]]
- 
          
          
            then
- 
          
          
              true # skip checking for external rubies
- 
          
          
          - 
          264
          
            elif (( ${rvm_head_flag:=0} == 1 ))
- 
          
          
            then
- 
          
          
              rvm_ruby_string="${rvm_ruby_string}-head"
- 
          
          
          - 
          264
          
            elif [[ -n "${rvm_ruby_revision:-}" ]]
- 
          
          
            then
- 
          
          
              rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_revision}"
- 
          
          
          - 
          264
          
            elif [[ -n "${rvm_ruby_sha:-}" ]]
- 
          
          
            then
- 
          
          
              rvm_ruby_string="${rvm_ruby_string}-s${rvm_ruby_sha}"
- 
          
          
          - 
          264
          
            elif [[ -n "${rvm_ruby_tag:-}" ]]
- 
          
          
            then
- 
          
          
              rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_tag}"
- 
          
          
          - 
          264
          
            elif [[ -n "${rvm_ruby_patch_level:-}" ]]
- 
          
          
            then
- 
          184
          
              rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
- 
          
          
          - 
          80
          
            elif [[ -n "${rvm_ruby_user_tag:-}" ]]
- 
          
          
            then
- 
          
          
              rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_user_tag}"
- 
          
          
          - 
          
          
            else
- 
          
          
              if
- 
          80
          
                (( ${rvm_fuzzy_flag:-0} == 1 )) &&
- 
          
          
                [[ "${rvm_ruby_interpreter}" == "ruby" || "${rvm_ruby_interpreter}" == "ree" ]]
- 
          
          
              then
- 
          
          
                rvm_ruby_patch_level="$(
- 
          
          
                  "${rvm_scripts_path:-$rvm_path/scripts}/list" strings |
- 
          
          
                    \grep "${rvm_ruby_interpreter}-${rvm_ruby_version}-" |
- 
          
          
                    awk -F- '{print $3}' | sort | tail -n 1
- 
          
          
                )"
- 
          
          
              fi
- 
          
          
              if
- 
          80
          
                (( ${rvm_latest_binary_flag:-0} == 1 )) &&
- 
          
          
                [[ "${rvm_ruby_interpreter}" == "ruby" || "${rvm_ruby_interpreter}" == "ree" ]]
- 
          
          
              then
- 
          
          
                #TODO: MRI only implementation, we need a better db/format/handling for this
- 
          
          
                rvm_ruby_patch_level="$(
- 
          
          
                  __list_remote_rubies_for $( __rvm_system_path_for rubies ) |
- 
          
          
                    awk -F/ '{x=$NF; gsub(".tar.*","",x); print x}' |
- 
          
          
                    \grep "${rvm_ruby_interpreter}-${rvm_ruby_version}-" |
- 
          
          
                    awk -F- '{print $3}' | sort | tail -n 1
- 
          
          
                )"
- 
          
          
              fi
- 
          80
          
              [[ -n "${rvm_ruby_patch_level:-""}" ]] ||
- 
          
          
              rvm_ruby_patch_level="$(
- 
          
          
                __rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level"
- 
          80
          
              )"
- 
          160
          
              if [[ -n "${rvm_ruby_patch_level:-""}" ]]
- 
          80
          
              then rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          
          
            if
- 
          264
          
              [[ -n "${rvm_ruby_name:-}" ]]
- 
          
          
            then
- 
          25
          
              rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_name}"
- 
          
          
              # record the name for validation of -n option
- 
          25
          
              detected_rvm_ruby_name="${rvm_ruby_name}"
- 
          
          
              # clean the name so it is not added again (rbx -n install problem)
- 
          25
          
              rvm_ruby_name=""
- 
          
          
            else
- 
          
          
              # record the no name for validation of -n option
- 
          239
          
              detected_rvm_ruby_name=""
- 
          
          
            fi
- 
          264
          
            true # OSX --trace FIX
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_ruby_strings_exist()
- 
          
          
          {
- 
          27
          
            for rvm_ruby_string in ${@//,/ }
- 
          
          
            do
- 
          27
          
              rvm_gemset_name=""
- 
          57
          
              rvm_verbose_flag=0 __rvm_use "${rvm_ruby_string}" >/dev/null 2>&1 || return $?
- 
          24
          
              printf "%b" "${rvm_ruby_string}${rvm_gemset_name:+@}${rvm_gemset_name:-}\n"
- 
          
          
            done
- 
          23
          
            unset rvm_ruby_string
- 
          
          
          }
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          26
          
          source "$rvm_scripts_path/base"
- 
          
          
          - 
          
          
          __rvm_attempt_single_exec()
- 
          
          
          {
- 
          
          
            # Return if we have multiple rubies. or we're not running exec.
- 
          23
          
            if (( ${#rvm_ruby_strings[@]} == 1 ))
- 
          
          
            then
- 
          22
          
              __rvm_become "$rvm_ruby_strings"
- 
          22
          
              __rvm_load_rvmrc
- 
          66
          
              export rvm_project_rvmrc=0 rvm_ignore_rvmrc=1
- 
          22
          
              exec "${args[@]}"
- 
          
          
            fi
- 
          
          
          - 
          1
          
            return 1
- 
          
          
          }
- 
          
          
          - 
          
          
          __rvm_ruby_do()
- 
          
          
          {
- 
          
          
            # Return on invalid rubies.
- 
          2
          
            __rvm_become "$current_set_ruby" || return 1
- 
          
          
          - 
          2
          
            rvm_hook="before_do"
- 
          2
          
            source "$rvm_scripts_path/hook"
- 
          
          
          - 
          6
          
            if [[ -n "$rvm_json_flag" || -n "$rvm_yaml_flag" || -n "$rvm_summary_flag" ]]
- 
          
          
            then
- 
          
          
              if [[ ! -d "./log/$rvm_ruby_string/" ]]
- 
          
          
              then
- 
          
          
                mkdir -p "./log/$rvm_ruby_string/"
- 
          
          
              fi
- 
          
          
              touch "./log/$rvm_ruby_string/$action.log"
- 
          
          
              "${args[@]}" >> "./log/$rvm_ruby_string/$action.log" 2>&1
- 
          
          
            else
- 
          2
          
              if (( ${rvm_verbose_flag:-0} > 0 ))
- 
          
          
              then
- 
          
          
                current_env="$(__rvm_env_string)"
- 
          
          
                if [[ "$current_env" != "$current_set_ruby" ]]
- 
          
          
                then
- 
          
          
                  current_env="$current_set_ruby ($current_env)"
- 
          
          
                fi
- 
          
          
                rvm_log "$current_env: $(ruby -v $rvm_ruby_mode | \tr "\n" ' ')"
- 
          
          
                unset current_env
- 
          
          
              fi
- 
          
          
              (
- 
          2
          
                __rvm_load_rvmrc
- 
          6
          
                export rvm_project_rvmrc=0 rvm_ignore_rvmrc=1
- 
          2
          
                "${args[@]}"
- 
          
          
              )
- 
          
          
            fi
- 
          2
          
            result=$?
- 
          
          
          - 
          2
          
            string=$rvm_ruby_string #$(basename $rvm_ruby_gem_home)
- 
          
          
          - 
          2
          
            if (( result == 0 ))
- 
          
          
            then
- 
          4
          
              eval "successes=(${successes[*]} $string)"
- 
          
          
            else
- 
          
          
              eval "errors=(${errors[*]} $string)"
- 
          
          
            fi
- 
          4
          
            eval "rubies=(${rubies[*]} $string)"
- 
          4
          
            eval "statuses=(${statuses[*]} $result)"
- 
          2
          
            unset string
- 
          
          
          - 
          2
          
            rvm_hook="after_do"
- 
          2
          
            source "$rvm_scripts_path/hook"
- 
          2
          
            __rvm_unset_ruby_variables
- 
          
          
          }
- 
          
          
          - 
          
          
          # Output the summary in a human readable format.
- 
          
          
          __rvm_summary()
- 
          
          
          {
- 
          
          
            export successes errors statuses
- 
          
          
          - 
          
          
            summary="\nSummary:\n\n"
- 
          
          
          - 
          
          
            if [[ ${#successes[*]} -gt 0 ]]
- 
          
          
            then
- 
          
          
              if rvm_pretty_print stdout
- 
          
          
              then
- 
          
          
                summary="$summary ${rvm_notify_clr:-}${#successes[*]} successful: $(echo "${successes[*]}" | sed 's# #, #g')${rvm_reset_clr:-}\n"
- 
          
          
              else
- 
          
          
                summary="$summary ${#successes[*]} successful: $(echo "${successes[*]}" | sed 's# #, #g')\n"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          
          
            if [[ ${#errors[*]} -gt 0 ]] ; then
- 
          
          
              if rvm_pretty_print stdout
- 
          
          
              then
- 
          
          
                summary="$summary ${rvm_error_clr:-}${#errors[*]} errors: $(echo "${errors[*]}" | sed 's# #, #g')${rvm_reset_clr:-}\n"
- 
          
          
              else
- 
          
          
                summary="$summary ${#errors[*]} errors: $(echo "${errors[*]}" | sed 's# #, #g')\n"
- 
          
          
              fi
- 
          
          
            fi
- 
          
          
          - 
          
          
            total=${#rubies[*]}
- 
          
          
          - 
          
          
            [[ -z "${ZSH_VERSION:-}" ]] ; array_start=$?
- 
          
          
          - 
          
          
            printf "%b" "$summary" | tee -a log/summary.log
- 
          
          
          - 
          
          
            return ${#errors[*]}
- 
          
          
          - 
          
          
          }
- 
          
          
          - 
          
          
          # Output the summary in a yaml format.
- 
          
          
          __rvm_yaml()
- 
          
          
          {
- 
          
          
            export successes errors statuses
- 
          
          
            yaml="totals:\n  rubies: ${#rubies[*]}\n  successes: ${#successes[*]}\n  errors: ${#errors[*]}\nsuccesses:"
- 
          
          
          - 
          
          
            for var in ${successes[*]} ; do yaml="$yaml\n  - $var" ; done
- 
          
          
            yaml="$yaml\nerrors:"
- 
          
          
          - 
          
          
            for var in ${errors[*]} ; do yaml="$yaml\n  - $var" ; done
- 
          
          
            yaml="$yaml\nrubies:"
- 
          
          
            total=${#rubies[*]}
- 
          
          
          - 
          
          
            [[ -z "${ZSH_VERSION:-}" ]] ; array_start=$?
- 
          
          
          - 
          
          
            for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
- 
          
          
              if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
- 
          
          
                rvm_debug "${rubies[$index]}: ${statuses[$index]}"
- 
          
          
              fi
- 
          
          
              yaml="$yaml\n  \"${rubies[$index]}\": ${statuses[$index]}"
- 
          
          
            done
- 
          
          
            unset index array_start
- 
          
          
          - 
          
          
            \mkdir -p log
- 
          
          
          - 
          
          
            printf "%b" "$yaml" | tee -a log/summary.yaml
- 
          
          
          - 
          
          
            return ${#errors[*]}
- 
          
          
          }
- 
          
          
          - 
          
          
          # Output the summary in a json format.
- 
          
          
          __rvm_json()
- 
          
          
          {
- 
          
          
            typeset index array_start
- 
          
          
          - 
          
          
            json="{
- 
          
          
          \"totals\": { \"rubies\": ${#rubies[*]}, \"successes\": ${#successes[*]}, \"errors\": ${#errors[*]} },
- 
          
          
          \"successful\": [$(echo \"${successes[*]}\" | sed 's# #", "#g' | sed 's#\"\"##')],
- 
          
          
          \"errors\": [$(echo \"${errors[*]}\" | sed 's# #", "#g' | sed 's#\"\"##')],
- 
          
          
          \"rubies\": { "
- 
          
          
          - 
          
          
            total=${#rubies[*]}
- 
          
          
            [[ -z "${ZSH_VERSION:-}" ]] ; array_start=$?
- 
          
          
          - 
          
          
            for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
- 
          
          
              if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
- 
          
          
                rvm_debug "${rubies[$index]}: ${statuses[$index]}"
- 
          
          
              fi
- 
          
          
              json="$json\n    {\"${rubies[$index]}\": ${statuses[$index]}}"
- 
          
          
              if (( $index + 1 < $total + $array_start )) ; then json="$json,  " ; fi
- 
          
          
            done
- 
          
          
          - 
          
          
            json="$json\n  }\n}"
- 
          
          
          - 
          
          
            if [[ ! -d log ]] ; then
- 
          
          
              mkdir -p log
- 
          
          
            fi
- 
          
          
            printf "%b" "$json" | tee -a log/summary.json
- 
          
          
          - 
          
          
            return ${#errors[*]}
- 
          
          
          }
- 
          
          
          - 
          
          
          # Loop over a set or all rvm installed rubies to perfo\rm some action.
- 
          
          
          # Record the results and report based on CLI selections.
- 
          
          
          - 
          104
          
          rubies=() ; successes=() ; errors=() ; statuses=()
- 
          
          
          - 
          26
          
          args=( "$@" )
- 
          26
          
          action="${args[$__array_start]}"
- 
          26
          
          unset args[$__array_start]
- 
          26
          
          args=( "${args[@]}" )
- 
          
          
          - 
          26
          
          if [[ -z "$action" ]]
- 
          
          
          then
- 
          
          
            rvm_error "Action must be specified."
- 
          
          
            exit 1
- 
          26
          
          elif [[ "$action" != "do" ]]
- 
          
          
          then
- 
          
          
            rvm_error "Only 'do' action is allowed."
- 
          
          
            exit 1
- 
          
          
          fi
- 
          
          
          - 
          
          
          # deprecated 2011.10.22 for RVM 1.9.0, removed 2012.09.13 for RVM 1.16.0
- 
          26
          
          if [[ -z "${rvm_ruby_strings}" ]]
- 
          
          
          then
- 
          
          
            rvm_error "\`rvm do ${args[@]}\` was removed, use \`rvm 1.9.2,1.9.3 do ${args[@]}\` or \`rvm all do ${args[@]}\` instead."
- 
          
          
            exit 1
- 
          
          
          fi
- 
          
          
          - 
          26
          
          previous_rvm_ruby_strings="$rvm_ruby_strings"
- 
          52
          
          rvm_ruby_strings=( $( __rvm_expand_ruby_string "$rvm_ruby_strings" ) ) || {
- 
          3
          
            rvm_ruby_string="${previous_rvm_ruby_strings## }"
- 
          3
          
            __rvm_ruby_string
- 
          3
          
            rvm_error "Ruby ${rvm_ruby_string} is not installed."
- 
          3
          
            exit 1
- 
          
          
          }
- 
          23
          
          unset previous_rvm_ruby_strings
- 
          
          
          - 
          23
          
          __rvm_attempt_single_exec
- 
          
          
          - 
          2
          
          for current_set_ruby in ${rvm_ruby_strings[@]}
- 
          
          
          do
- 
          2
          
            __rvm_ruby_do
- 
          
          
          done
- 
          
          
          - 
          1
          
          if [[ -n "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
- 
          1
          
          if [[ -n "$rvm_yaml_flag" ]]    ; then __rvm_yaml    ; fi
- 
          1
          
          if [[ -n "$rvm_json_flag" ]]    ; then __rvm_json    ; fi
- 
          
          
          - 
          2
          
          rvm_hook="after_do" ; source "$rvm_scripts_path/hook"
- 
          
          
          - 
          1
          
          exit ${#errors[*]}
 
      
        
      
        
  
  
  
    
      
        - 
          
          
          #!/usr/bin/env bash
- 
          
          
          - 
          46
          
          default_flag="$rvm_default_flag"
- 
          
          
          - 
          
          
          # Prevent recursion
- 
          46
          
          unset rvm_default_flag rvm_wrapper_name prefix
- 
          
          
          - 
          46
          
          source "$rvm_scripts_path/base"
- 
          46
          
          source "$rvm_scripts_path/initialize"
- 
          
          
          - 
          
          
          usage()
- 
          
          
          {
- 
          1
          
            printf "%b" "
- 
          
          
            Usage:
- 
          
          
          - 
          
          
              rvm wrapper ruby_string [wrapper_prefix] [binary[ binary[ ...]]]
- 
          
          
          - 
          
          
            Binaries
- 
          
          
          - 
          
          
              ruby, gem, rake, irb, rdoc, ri, testrb
- 
          
          
          - 
          
          
            Notes
- 
          
          
          - 
          
          
              For more information, see 'rvm help wrapper'
- 
          
          
          - 
          
          
            Example
- 
          
          
          - 
          
          
              # Wrap the spec binary as 'rails3_spec' for 1.9.2@rails3
- 
          
          
              rvm wrapper 1.9.2@rails3 rails3 spec
- 
          
          
          - 
          
          
              # To create a single binary you can do the following,
- 
          
          
              user$ rvm use --create 1.8.7@ey ; gem install ey
- 
          
          
              user$ rvm wrapper 1.8.7@ey --no-prefix ey
- 
          
          
              # So that it is clear I am now in a different env,
- 
          
          
              user$ rvm 1.9.2
- 
          
          
              user$ ruby -v
- 
          
          
              ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
- 
          
          
              # And we have the desired result,
- 
          
          
              user$ ey
- 
          
          
              Usage:
- 
          
          
                ey [--help] [--version] COMMAND [ARGS]
- 
          
          
                ...
- 
          
          
          - 
          
          
          "
- 
          
          
          }
- 
          
          
          - 
          
          
          wrap()
- 
          
          
          {
- 
          221
          
            [[ -n "${file_name:-""}" ]] ||
- 
          
          
            {
- 
          
          
              rvm_error "wrap() : file_name unkown variable for wrap()."
- 
          
          
              return 1
- 
          
          
            }
- 
          221
          
            mkdir -p "${file_name%/*}"
- 
          221
          
            \rm -f "$file_name"
- 
          221
          
            printf "%b" \
- 
          
          
          "#!/usr/bin/env bash
- 
          
          
          - 
          
          
          if [[ -s \"$rvm_environments_path/${environment_identifier}\" ]]
- 
          
          
          then
- 
          
          
            source \"$rvm_environments_path/${environment_identifier}\"
- 
          
          
            exec $binary_name \"\$@\"
- 
          
          
          else
- 
          
          
            echo \"ERROR: Missing RVM environment file: '$rvm_environments_path/${environment_identifier}'\" >&2
- 
          
          
            exit 1
- 
          
          
          fi
- 
          
          
          " > "$file_name"
- 
          221
          
            chmod +x "$file_name"
- 
          
          
          }
- 
          
          
          - 
          
          
          symlink_binary()
- 
          
          
          {
- 
          
          
            # Generate the default wrapper with the given binary name.
- 
          
          
            # We first check if we can wrap the binary and if we were able to,
- 
          
          
            # we then symlink it into place.
- 
          
          
            if
- 
          22
          
              wrap_binary && [[ -f "$file_name" ]]
- 
          
          
            then
- 
          11
          
              file_link="$rvm_bin_path/${prefix}_${binary_name##*\/}"
- 
          11
          
              file_link=${file_link// /_}
- 
          11
          
              \rm -f "$rvm_bin_path/${prefix}_${binary_name##*\/}"
- 
          11
          
              ln -fs "$file_name" "$file_link"
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          wrap_binary()
- 
          
          
          {
- 
          
          
            # We wrap when the given binary is in the path or override_check is set to one.
- 
          
          
            if
- 
          221
          
              [[ "$override_check" == "1" ]] ||
- 
          11
          
              builtin command -v $binary_name > /dev/null
- 
          
          
            then
- 
          221
          
              wrap
- 
          
          
            else
- 
          
          
              rvm_error "Binary '$binary_name' not found."
- 
          
          
              return 1
- 
          
          
            fi
- 
          
          
          }
- 
          
          
          - 
          
          
          # Empty ruby string: show usage and exit.
- 
          92
          
          (( $# )) && [[ -n "$1" ]] ||
- 
          
          
          {
- 
          1
          
            usage
- 
          1
          
            exit 1
- 
          
          
          }
- 
          45
          
          ruby_string="$1"
- 
          45
          
          shift
- 
          45
          
          prefix="${1:-}"
- 
          71
          
          (( $# == 0 )) || shift
- 
          
          
          - 
          45
          
          if (( $# ))
- 
          12
          
          then binaries=("$@")
- 
          33
          
          else binaries=(ruby gem irb ri rdoc rake erb testrb)
- 
          
          
          fi
- 
          45
          
          override_check=0
- 
          45
          
          (( ${rvm_default_flag:-0} == 0 )) || prefix="default"
- 
          
          
          - 
          
          
          # Use the correct ruby.
- 
          45
          
          __rvm_become "$ruby_string" || {
- 
          14
          
            rvm_error "Could not load ruby $ruby_string."
- 
          14
          
            exit 3
- 
          
          
          }
- 
          
          
          - 
          
          
          # strip trailing / so we can use ${...%/*} to get parent
- 
          31
          
          rvm_bin_path="${rvm_bin_path%/}"
- 
          31
          
          rvm_wrappers_path="${rvm_wrappers_path%/}"
- 
          
          
          if
- 
          62
          
            [[   -d "$rvm_bin_path" && ! -w "$rvm_bin_path"      ]] ||
- 
          31
          
            [[ ! -d "$rvm_bin_path" && ! -w "${rvm_bin_path%/*}" ]]
- 
          
          
          then
- 
          
          
            # can not write currently set location, try to switch relatively to wrappers path
- 
          
          
            if
- 
          
          
              [[ -w "${rvm_wrappers_path%/*}" || -w "${rvm_wrappers_path%/*}/bin" ]]
- 
          
          
            then
- 
          
          
              rvm_bin_path="${rvm_wrappers_path%/*}/bin"
- 
          
          
              rvm_warn "Wrappers will be saved to '$rvm_bin_path', make sure it's accessible in your PATH before using them."
- 
          
          
            else
- 
          
          
              rvm_error "No bin path suitable for lining wrapper. Try setting 'rvm_bin_path'."
- 
          
          
              exit 4
- 
          
          
            fi
- 
          
          
          fi
- 
          31
          
          [[ -d "$rvm_bin_path" ]] || mkdir -p "$rvm_bin_path"
- 
          
          
          - 
          31
          
          __rvm_ensure_has_environment_files
- 
          62
          
          environment_identifier="$(__rvm_env_string)"
- 
          
          
          - 
          
          
          find_all_wrappers()
- 
          
          
          {
- 
          2
          
            typeset -a search_paths
- 
          2
          
            typeset _path
- 
          2
          
            search_paths=()
- 
          6
          
            for _path in \
- 
          
          
              "$rvm_gems_path/${environment_identifier}"/bin/ \
- 
          
          
              "$rvm_gems_path/${environment_identifier%%@*}@global"/bin/ \
- 
          
          
              "$rvm_rubies_path/${environment_identifier%%@*}"/bin/
- 
          
          
            do
- 
          6
          
              if [[ -d "${_path}" ]]
- 
          2
          
              then search_paths+=( "${_path}" )
- 
          
          
              fi
- 
          
          
            done
- 
          2
          
            (( ${#search_paths[@]} )) || return 0
- 
          4
          
            find "${search_paths[@]}" -type f -perm -u=x | awk -F/ '{print $NF}'
- 
          
          
          }
- 
          
          
          - 
          
          
          if
- 
          31
          
            [[ " ${binaries[*]} " =~ " --all " ]]
- 
          
          
          then
- 
          2
          
            old_binaries=( "${binaries[@]}" )
- 
          2
          
            __rvm_read_lines binaries <(
- 
          2
          
              for binary_name in "${old_binaries[@]}"
- 
          
          
              do
- 
          
          
                if
- 
          2
          
                  [[ "$binary_name" == "--all" ]]
- 
          
          
                then
- 
          2
          
                  find_all_wrappers "${environment_identifier}"
- 
          
          
                else
- 
          
          
                  echo "${binary_name}"
- 
          
          
                fi
- 
          2
          
              done | sort -u
- 
          
          
            )
- 
          
          
          fi
- 
          
          
          - 
          31
          
          _log="${rvm_log_path}${rvm_ruby_string:+/}${rvm_ruby_string:-}/wrappers.log"
- 
          
          
          - 
          31
          
          if [[ "--no-links" == "$prefix" ]]
- 
          2
          
          then wrappers_target="$rvm_wrappers_path/${environment_identifier}"
- 
          29
          
          else wrappers_target="$rvm_bin_path"
- 
          
          
          fi
- 
          
          
          - 
          31
          
          echo "prefix: '$prefix'." > "$_log"
- 
          
          
          - 
          
          
          # For each binary, we want to generate the wrapper / symlink
- 
          
          
          # it to the existing wrapper if needed.
- 
          221
          
          for binary_name in "${binaries[@]}"
- 
          
          
          do
- 
          221
          
            echo "wrapper: '$binary_name'."
- 
          221
          
            file_name="$rvm_wrappers_path/${environment_identifier}/${binary_name##*\/}"
- 
          221
          
            file_name=${file_name// /_}
- 
          
          
            if
- 
          221
          
              [[ -z "${prefix:-}" ]]
- 
          
          
            then
- 
          160
          
              override_check=1
- 
          160
          
              wrap_binary
- 
          
          
              # Symlink it into place.
- 
          
          
              if
- 
          160
          
                [[ -f "$file_name" ]]
- 
          
          
              then
- 
          
          
                if
- 
          160
          
                  [[ "$binary_name" == "ruby" ]]
- 
          
          
                then
- 
          20
          
                  destination="$rvm_bin_path/$environment_identifier"
- 
          
          
                else
- 
          140
          
                  destination="$rvm_bin_path/${binary_name##*\/}-${environment_identifier}"
- 
          
          
                fi
- 
          160
          
                \rm -f "$destination"
- 
          160
          
                ln -sf "$file_name" "$destination"
- 
          
          
              fi
- 
          
          
            elif
- 
          61
          
              [[ "--no-links" == "$prefix" ]]
- 
          
          
            then
- 
          15
          
              override_check=1
- 
          15
          
              wrap_binary
- 
          
          
            elif
- 
          46
          
              [[ "--no-prefix" == "$prefix" ]]
- 
          
          
            then
- 
          35
          
              override_check=1
- 
          35
          
              wrap_binary
- 
          
          
              if
- 
          35
          
                [[ -f  "$file_name" ]]
- 
          
          
              then
- 
          35
          
                destination="$rvm_bin_path/${binary_name##*\/}"
- 
          
          
                if
- 
          35
          
                  [[ -s "$destination" ]]
- 
          
          
                then
- 
          1
          
                  \rm -f "$destination"
- 
          
          
                fi
- 
          35
          
                ln -sf "$file_name" "$destination"
- 
          
          
              fi
- 
          
          
            else
- 
          11
          
              symlink_binary
- 
          
          
            fi
- 
          62
          
          done | tee -a "$_log" | __rvm_dotted "Saving wrappers to '$wrappers_target'" ||
- 
          
          
          {
- 
          
          
            rvm_error "Failed generating wrappers, check for details in '${_log}'."
- 
          
          
            exit 1
- 
          
          
          }