rvm 0.1.32 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
data/scripts/log CHANGED
@@ -8,21 +8,21 @@ message=$1
8
8
 
9
9
  if [[ -z "$rvm_interactive" ]] || [[ -z "$TERM" ]] || [[ "unknown" = "$TERM" ]] ; then
10
10
  case "$level" in
11
- debug) shift ; echo -e "<d>$message </d>" ;;
12
- info) shift ; echo -e "<i>$message </i>" ;;
13
- warn) shift ; echo -e "<w>$message </w>" ;;
14
- error) shift ; echo -e "<e>$message </e>" >&2 ;;
15
- fail) shift ; echo -e "<f>$message </f>" >&2 ;;
16
- *) echo -e "$message"
11
+ debug) shift ; printf "\n<d>$message </d>\n" ;;
12
+ info) shift ; printf "\n<i>$message </i>\n" ;;
13
+ warn) shift ; printf "\n<w>$message </w>\n" ;;
14
+ error) shift ; printf "\n<e>$message </e>\n" >&2 ;;
15
+ fail) shift ; printf "\n<f>$message </f>\n" >&2 ;;
16
+ *) printf "$message"
17
17
  esac
18
18
  else
19
19
  case "$level" in
20
- debug) shift ; echo -e "$(tput setaf 5)$message$(tput sgr0)" ;;
21
- info) shift ; echo -e "$(tput setaf 2)$message$(tput sgr0)" ;;
22
- warn) shift ; echo -e "$(tput setaf 3)$message$(tput sgr0)" ;;
23
- error) shift ; echo -e "$(tput setaf 1)$message$(tput sgr0)" >&2 ;;
24
- fail) shift ; echo -e "$(tput setaf 1)$message$(tput sgr0)" >&2 ;;
25
- *) echo -e "$message"
20
+ debug) shift ; printf "\n$(tput setaf 5)$message$(tput sgr0)\n" ;;
21
+ info) shift ; printf "\n$(tput setaf 2)$message$(tput sgr0)\n" ;;
22
+ warn) shift ; printf "\n$(tput setaf 3)$message$(tput sgr0)\n" ;;
23
+ error) shift ; printf "\n$(tput setaf 1)$message$(tput sgr0)\n" >&2 ;;
24
+ fail) shift ; printf "\n$(tput setaf 1)$message$(tput sgr0)\n" >&2 ;;
25
+ *) printf "$message"
26
26
  esac
27
27
  fi
28
28
 
data/scripts/manage CHANGED
@@ -267,12 +267,10 @@ RubyWrapper
267
267
  PATH=$rvm_bin_path:$PATH ; export PATH
268
268
 
269
269
  if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[ -z "$rvm_head_flag" ]] ; then
270
- if [[ ! -f "$rvm_archives_path/$rvm_ruby_package_file" ]] ; then
271
- $rvm_scripts_path/log "info" "Downloading $rvm_ruby_file, this may take a while depending on your connection..."
272
- $rvm_scripts_path/fetch "$rvm_url"
273
- result=$? ; if [[ "$result" -gt 0 ]] ; then
274
- $rvm_scripts_path/log "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
275
- fi
270
+ $rvm_scripts_path/log "info" "Downloading $rvm_ruby_file, this may take a while depending on your connection..."
271
+ $rvm_scripts_path/fetch "$rvm_url"
272
+ result=$? ; if [[ "$result" -gt 0 ]] ; then
273
+ $rvm_scripts_path/log "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
276
274
  fi
277
275
  __rvm_run "extract" "cat $rvm_archives_path/$(basename $rvm_ruby_package_file) | gunzip | tar xf - -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
278
276
 
@@ -303,7 +301,7 @@ RubyWrapper
303
301
 
304
302
  builtin cd "$rvm_ruby_src_path" ; chmod +x ./configure
305
303
  rvm_ruby_configure_flags="${rvm_ruby_configure_flags:-"--skip-system"}"
306
- rvm_ruby_configure="./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags" ; message="Configuring rbx"
304
+ rvm_ruby_configure="ruby configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags" ; message="Configuring rbx"
307
305
  if [[ "$rvm_llvm_flag" = "0" ]] ; then
308
306
  rvm_ruby_configure="$rvm_ruby_configure --disable-llvm"
309
307
  else
@@ -334,7 +332,7 @@ RubyWrapper
334
332
  for binary_name in "gem" ; do
335
333
  if [[ $binary_name != "gem" ]] ; then prefix="-S " ; else unset prefix; fi
336
334
 
337
- ruby_wrapper=$(echo -e "#!/usr/bin/env bash\nexec $rvm_ruby_home/bin/rbx $prefix$binary_name \"\$@\"")
335
+ ruby_wrapper=$(printf "#!/usr/bin/env bash\nexec $rvm_ruby_home/bin/rbx $prefix$binary_name \"\$@\"")
338
336
  for file_name in "$rvm_ruby_home/bin/$binary_name" "$rvm_bin_path/$binary_name-$rvm_ruby_string" ; do
339
337
  rm -f $file_name
340
338
  echo "$ruby_wrapper" > $file_name
@@ -352,7 +350,7 @@ RubyWrapper
352
350
 
353
351
  jruby)
354
352
  if ! command -v java > /dev/null; then
355
- echo -e "java must be installed and in your path in order to install JRuby." ; return 1
353
+ printf "java must be installed and in your path in order to install JRuby." ; return 1
356
354
  fi
357
355
 
358
356
  __rvm_pushpop $rvm_src_path
@@ -384,8 +382,9 @@ RubyWrapper
384
382
  done ; unset binary
385
383
  __rvm_pushpop
386
384
 
387
- sed -e 's#^JAVA_VM=-client#JAVA_VM=-server#' $rvm_ruby_home/bin/jruby > $rvm_ruby_home/bin/jruby.new &&
388
- mv $rvm_ruby_home/bin/jruby.new $rvm_ruby_home/bin/jruby
385
+ # -server is "a lot slower for short-lived scripts like rake tasks, and takes longer to load"
386
+ #sed -e 's#^JAVA_VM=-client#JAVA_VM=-server#' $rvm_ruby_home/bin/jruby > $rvm_ruby_home/bin/jruby.new &&
387
+ # mv $rvm_ruby_home/bin/jruby.new $rvm_ruby_home/bin/jruby
389
388
  chmod +x $rvm_ruby_home/bin/jruby
390
389
 
391
390
  for binary in jrubyc jirb_swing jirb jgem rdoc ri spec autospec testrb ast generate_yaml_index.rb ; do
@@ -399,6 +398,8 @@ RubyWrapper
399
398
  __rvm_bin_script
400
399
  __rvm_use
401
400
 
401
+ __rvm_post_install
402
+
402
403
  for rvm_gem_name in rake jruby-openssl ; do
403
404
  __rvm_run "gems" "$rvm_ruby_home/bin/gem install $rvm_gem_name $rvm_gem_options" "Installing $rvm_gem_name"
404
405
  done ; unset rvm_gem_name
@@ -424,7 +425,7 @@ RubyWrapper
424
425
  fi
425
426
 
426
427
  if [[ ! -z "$rvm_head_flag" ]] ; then
427
- cd $rvm_ruby_src_path
428
+ builtin cd $rvm_ruby_src_path
428
429
  rvm_gemstone_package_file="GemStone-$(grep ^GEMSTONE version.txt | cut -f2 -d-).$(uname -sm | tr ' ' '-')"
429
430
  rvm_gemstone_url="${rvm_gemstone_url:-"$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"}"
430
431
  fi
@@ -496,7 +497,7 @@ RubyWrapper
496
497
 
497
498
  ironruby|ir)
498
499
  if ! command -v mono > /dev/null ; then
499
- echo -e "mono must be installed and in your path in order to install IronRuby." ; return 1
500
+ printf "mono must be installed and in your path in order to install IronRuby." ; return 1
500
501
  fi
501
502
 
502
503
  if [[ "$rvm_head_flag" = 1 ]] ; then
@@ -505,12 +506,12 @@ RubyWrapper
505
506
  mono_major_ver="$(echo $mono_version | cut -d '.' -f1)"
506
507
  mono_minor_ver="$(echo $mono_version | cut -d '.' -f2)"
507
508
  if [[ $mono_major_ver -lt 2 ]] || ( [[ $mono_major_ver -eq 2 ]] && [[ $mono_minor_ver -lt 6 ]] ) ; then
508
- echo -e "Mono 2.6 (or greater) must be installed and in your path in order to build IronRuby from the repository."
509
- echo -e "Version detected: ${mono_version}"
509
+ printf "Mono 2.6 (or greater) must be installed and in your path in order to build IronRuby from the repository."
510
+ printf "Version detected: ${mono_version}"
510
511
  return 1
511
512
  fi
512
513
  else
513
- echo -e "Cannot recognize mono version."
514
+ printf "Cannot recognize mono version."
514
515
  return 1
515
516
  fi
516
517
 
@@ -695,7 +696,7 @@ __rvm_fetch_ruby() {
695
696
  rvm_archive_extension="${rvm_archive_extension:-tar.gz}"
696
697
  if [[ ! -s "$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension" ]] ; then
697
698
  if [[ "ruby" = "$rvm_ruby_interpreter" ]] ; then
698
- rvm_url="ftp://ftp.ruby-lang.org/pub/ruby/1.$rvm_major_version/$rvm_ruby_package_file.$rvm_archive_extension"
699
+ rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_release_version}.${rvm_major_version}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
699
700
  elif [[ "ree" = "$rvm_ruby_interpreter" ]] ; then
700
701
  rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
701
702
  elif [[ "jruby" = "$rvm_ruby_interpreter" ]] ; then
@@ -765,12 +766,12 @@ __rvm_fetch_ruby() {
765
766
  if [[ -z "$rvm_minor_version" ]] || [[ "$rvm_minor_version" = 3 ]] ; then
766
767
  rvm_url="${rvm_url:-"$rvm_ruby_repo_url/trunk"}"
767
768
  else
768
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}"}"
769
+ rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_release_version}_${rvm_major_version}_${rvm_minor_version}"}"
769
770
  fi
770
771
  elif [[ -z "$rvm_minor_version" ]] || [[ "$rvm_major_version.$rvm_minor_version" = "8.8" ]] ; then
771
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}"}"
772
+ rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_release_version}_${rvm_major_version}"}"
772
773
  else
773
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}"}"
774
+ rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_release_version}_${rvm_major_version}_${rvm_minor_version}"}"
774
775
  fi
775
776
 
776
777
  rvm_rev=""
@@ -855,23 +856,27 @@ __rvm_remove_gemsets() {
855
856
  }
856
857
 
857
858
  __rvm_post_install() {
858
- binaries="${binaries:-"gem irb erb ri rdoc testrb rake"}"
859
- for binary in $(echo $binaries) ; do
860
- if [[ -e "$rvm_ruby_home/bin/$binary" ]] || [[ -e "$rvm_ruby_src_path/bin/$binary" ]] ; then
861
- if [[ "$rvm_ruby_src_path" != "$rvm_ruby_home" ]] && [[ -f "$rvm_ruby_src_path/bin/$binary" ]] ; then
862
- cp -f "$rvm_ruby_src_path/bin/$binary" "$rvm_ruby_home/bin/$binary"
863
- elif [[ -f "$rvm_ruby_gem_home/bin/$binary" ]] ; then
864
- cp -f "$rvm_ruby_gem_home/bin/$binary" "$rvm_ruby_home/bin/$binary"
859
+ if [[ "$rvm_ruby_interpreter" != "jruby" ]] ; then
860
+ binaries="${binaries:-"gem irb erb ri rdoc testrb rake"}"
861
+ $rvm_scripts_path/log "info" "adjusting shebangs for $rvm_ruby_string ($binaries)."
862
+ for binary in $(echo $binaries) ; do
863
+ if [[ -e "$rvm_ruby_home/bin/$binary" ]] || [[ -e "$rvm_ruby_src_path/bin/$binary" ]] ; then
864
+ if [[ "$rvm_ruby_src_path" != "$rvm_ruby_home" ]] && [[ -f "$rvm_ruby_src_path/bin/$binary" ]] ; then
865
+ cp -f "$rvm_ruby_src_path/bin/$binary" "$rvm_ruby_home/bin/$binary"
866
+ elif [[ -f "$rvm_ruby_gem_home/bin/$binary" ]] ; then
867
+ cp -f "$rvm_ruby_gem_home/bin/$binary" "$rvm_ruby_home/bin/$binary"
868
+ fi
869
+ __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
870
+ __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
871
+ chmod +x "$rvm_ruby_home/bin/$binary"
865
872
  fi
866
- __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
867
- __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
868
- chmod +x "$rvm_ruby_home/bin/$binary"
869
- fi
870
- done ; unset binary binaries
871
-
872
- $rvm_scripts_path/log "info" "Installing gems for $rvm_ruby_string."
873
+ done ; unset binary binaries
874
+ fi
873
875
 
874
- for rvm_gem_name in rdoc rake ; do
876
+ # TODO: Merge this vvv into the default gemset loading.
877
+ post_install_gems="rdoc rake"
878
+ $rvm_scripts_path/log "info" "Installing gems for $rvm_ruby_string ($post_install_gems)."
879
+ for rvm_gem_name in $(echo $post_install_gems); do
875
880
  home="$GEM_HOME" ; path="$GEM_PATH" # Save
876
881
  for dir in $rvm_ruby_global_gems_path $rvm_ruby_gem_home ; do
877
882
  GEM_HOME="$dir" ; GEM_PATH="$dir" ; BUNDLE_PATH="$dir"
@@ -888,10 +893,38 @@ __rvm_post_install() {
888
893
  done ; unset home path dir
889
894
  GEM_HOME="$home" ; GEM_PATH="$path" ; BUNDLE_PATH="$home"
890
895
  export GEM_HOME GEM_PATH BUNDLE_PATH
891
- done ; unset rvm_gem_name
896
+ done ; unset rvm_gem_name post_install_gems
892
897
  $rvm_scripts_path/log "info" "Installation of gems for $rvm_ruby_string is complete."
893
898
 
894
899
  __rvm_irbrc
900
+ __rvm_load_gemsets
901
+ }
902
+
903
+ __rvm_load_gemsets() {
904
+ # Gemset for every interpreter's global gems
905
+ if [[ -s "$rvm_gemsets_path/global.gems" ]] ; then
906
+ dir=$rvm_ruby_global_gems_path
907
+ GEM_HOME="$dir" ; GEM_PATH="$dir" ; BUNDLE_PATH="$dir" ; export GEM_HOME GEM_PATH BUNDLE_PATH
908
+
909
+ $rvm_scripts_path/gemsets "import" "$rvm_gemsets_path/global.gems"
910
+
911
+ GEM_HOME="$home" ; GEM_PATH="$path" ; BUNDLE_PATH="$home" ; export GEM_HOME GEM_PATH BUNDLE_PATH
912
+ fi ; unset home path dir
913
+
914
+ # gemset for any installed ruby.
915
+ if [[ -s "$rvm_gemsets_path/default.gems" ]] ; then
916
+ $rvm_scripts_path/gemsets "import" "$rvm_gemsets_path/default.gems"
917
+ fi
918
+
919
+ # gemset for any installation of a given interpreter.
920
+ if [[ -s "$rvm_gemsets_path/$rvm_ruby_interpreter.gems" ]] ; then
921
+ $rvm_scripts_path/gemsets "import" "$rvm_gemsets_path/$rvm_ruby_interpreter.gems"
922
+ fi
923
+
924
+ # gemset for a specific match of the ruby string.
925
+ if [[ -s "$rvm_gemsets_path/$rvm_ruby_string.gems" ]] ; then
926
+ $rvm_scripts_path/gemsets "import" "$rvm_gemsets_path/$rvm_ruby_string.gems"
927
+ fi
895
928
  }
896
929
 
897
930
  __rvm_rubygems_setup() {
@@ -922,7 +955,7 @@ __rvm_rubygems_setup() {
922
955
 
923
956
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
924
957
  __rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
925
- ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/1.$rvm_major_version"
958
+ ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/${rvm_release_version}.$rvm_major_version"
926
959
  elif [[ ! -z "$(echo $rvm_ruby_interpreter | awk '/^rbx|jruby/')" ]] ; then
927
960
  # Hands off rubygems for rbx & jruby
928
961
  if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Skipping rubygems update for $rvm_ruby_version" ; fi
@@ -963,7 +996,7 @@ __rvm_rubygems_setup() {
963
996
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
964
997
 
965
998
  if [[ ! -z "$rvm_major_version" ]] ; then
966
- ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/1.$rvm_major_version"
999
+ ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/${rvm_release_version}.$rvm_major_version"
967
1000
  else
968
1001
  ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/$interpreter"
969
1002
  fi
data/scripts/notes CHANGED
@@ -7,64 +7,65 @@ if [[ "Linux" = "$system" ]] ; then
7
7
  for file in /etc/*-release ; do
8
8
  release="( $(cat $file) )" ; break
9
9
  done
10
- echo -e "\n$(tput setaf 2)Notes for ${system} $release$(tput sgr0)\n"
10
+ printf "\n\n$(tput setaf 2)Notes for ${system} $release$(tput sgr0)\n"
11
11
 
12
12
  rvm_apt_get_binary="$(command -v aptitude)"
13
13
  rvm_emerge_binary="$(command -v emerge)"
14
14
  rvm_pacman_binary="$(command -v pacman)"
15
15
  rvm_yum_binary="$(command -v yum)"
16
16
 
17
- echo -e "\n $item curl is required.\n"
18
- echo -e "\n $item patch is required (for ree, some ruby head's).\n"
17
+ printf "\n $item curl is required.\n"
18
+ printf "\n $item patch is required (for ree, some ruby head's).\n"
19
+ printf "\n $item If you wish to install rbx and/or any MRI head (eg. 1.9.2-head) then you must install and use rvm 1.8.7 first.\n"
19
20
  if [[ ! -z "$rvm_apt_get_binary" ]] ; then
20
- echo -e " $item For JRuby (if you wish to use it) you will need:"
21
- echo -e "\n $ aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk"
21
+ printf "\n $item For JRuby (if you wish to use it) you will need:"
22
+ printf "\n $ aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk"
22
23
 
23
- echo -e "\n $item For MRI & ree (if you wish to use it) you will need:"
24
- echo -e "\n $ aptitude install curl bison build-essential zlib1g zlib1g-dev libssl-dev libreadline5-dev libreadline6-dev libxml2-dev git-core subversion autoconf"
24
+ printf "\n $item For MRI & ree (if you wish to use it) you will need:"
25
+ printf "\n $ aptitude install curl bison build-essential zlib1g zlib1g-dev libssl-dev libreadline5-dev libreadline6-dev libxml2-dev git-core subversion autoconf"
25
26
 
26
- echo -e "\n $item For IronRuby (if you wish to use it) you will need:"
27
- echo -e "\n $ aptitude install curl mono-2.0-devel"
27
+ printf "\n $item For IronRuby (if you wish to use it) you will need:"
28
+ printf "\n $ aptitude install curl mono-2.0-devel"
28
29
 
29
30
  elif [[ ! -z "$rvm_emerge_binary" ]] ; then
30
- echo -e " $item For JRuby (if you wish to use it) you will need:"
31
- echo -e "\n $ emerge dev-java/sun-jdk dev-java/sun-jre-bin"
31
+ printf "\n $item For JRuby (if you wish to use it) you will need:"
32
+ printf "\n $ emerge dev-java/sun-jdk dev-java/sun-jre-bin"
32
33
 
33
- echo -e "\n $item For IronRuby (if you wish to use it) you will need:"
34
- echo -e "\n $ emerge dev-lang/mono"
34
+ printf "\n $item For IronRuby (if you wish to use it) you will need:"
35
+ printf "\n $ emerge dev-lang/mono"
35
36
 
36
37
  elif [[ ! -z "$rvm_pacman_binary" ]] ; then
37
- echo -e " $item For MRI based rubies you will need:"
38
- echo -e "\n $ pacman -Sy autoconf diffutils patch curl bison zlib readline libxml2 git"
38
+ printf "\n $item For MRI based rubies you will need:"
39
+ printf "\n $ pacman -Sy autoconf diffutils patch curl bison zlib readline libxml2 git"
39
40
 
40
- echo -e " $item For JRuby (if you wish to use it) you will need:"
41
- echo -e "\n $ pacman -Sy jdk jre curl"
41
+ printf "\n $item For JRuby (if you wish to use it) you will need:"
42
+ printf "\n $ pacman -Sy jdk jre curl"
42
43
 
43
- echo -e "\n $item For IronRuby (if you wish to use it) you will need:"
44
- echo -e "\n $ pacman -Sy mono"
44
+ printf "\n $item For IronRuby (if you wish to use it) you will need:"
45
+ printf "\n $ pacman -Sy mono"
45
46
 
46
47
  elif [[ ! -z "$rvm_yum_binary" ]] ; then
47
- echo -e " $item For MRI/ree (if you wish to use it) you will need:"
48
- echo -e "\n $ yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel"
49
- echo -e "\n $ yum install -y iconv-devel # NOTE: For centos 5.4 final iconv-devel might not be available :("
48
+ printf "\n $item For MRI/ree (if you wish to use it) you will need:"
49
+ printf "\n $ yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel"
50
+ printf "\n $ yum install -y iconv-devel # NOTE: For centos 5.4 final iconv-devel might not be available :("
50
51
 
51
- echo -e "\n $item For JRuby (if you wish to use it) you will need:"
52
- echo -e "\n $ yum install -y java"
52
+ printf "\n $item For JRuby (if you wish to use it) you will need:"
53
+ printf "\n $ yum install -y java"
53
54
 
54
55
  else
55
- echo -e " $item For JRuby (if you wish to use it) you will need:"
56
- echo -e "\n The SUN java runtime environment and development kit."
57
- echo -e "\n $item For IronRuby (if you wish to use it) you will need:"
58
- echo -e "\n The Mono Runtime and Development Platform (version 2.6 or greater is recommended)."
56
+ printf "\n $item For JRuby (if you wish to use it) you will need:"
57
+ printf "\n The SUN java runtime environment and development kit."
58
+ printf "\n $item For IronRuby (if you wish to use it) you will need:"
59
+ printf "\n The Mono Runtime and Development Platform (version 2.6 or greater is recommended)."
59
60
  fi
60
61
  elif [[ "Darwin" = "$system" ]] ; then
61
62
  release="( $(sw_vers -productName) )"
62
- echo -e "\n$(tput setaf 2)Notes for ${system} $release $(tput sgr0)\n"
63
- echo -e "\n $item For Snow Leopard be sure to have XCode Tools Version 3.2.1 (1613) or later (there were bugs with the dvd release version)."
64
- echo -e "\n $item You should download the latest XCode tools from developer.apple.com. This is necessary since the dvd install for Snow Leopard has bugs."
65
- echo -e "\n $item If you intend on installing MacRuby you must install LLVM first."
66
- echo -e "\n $item If you intend on installing JRuby you must install the JDK."
67
- echo -e "\n $item If you intend on installing IronRuby you must install Mono (version 2.6 or greater is recommended)."
63
+ printf "\n$(tput setaf 2)Notes for ${system} $release $(tput sgr0)\n"
64
+ printf "\n $item For Snow Leopard be sure to have XCode Tools Version 3.2.1 (1613) or later (there were bugs with the dvd release version)."
65
+ printf "\n $item You should download the latest XCode tools from developer.apple.com. This is necessary since the dvd install for Snow Leopard has bugs."
66
+ printf "\n $item If you intend on installing MacRuby you must install LLVM first."
67
+ printf "\n $item If you intend on installing JRuby you must install the JDK."
68
+ printf "\n $item If you intend on installing IronRuby you must install Mono (version 2.6 or greater is recommended)."
68
69
  fi
69
70
 
70
71
  echo
data/scripts/package CHANGED
@@ -22,8 +22,8 @@ __rvm_load_rvmrc
22
22
  trap "rm -f $rvm_tmp_path/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15
23
23
  if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
24
24
 
25
- action="$(echo $* | awk '{print $1}')"
26
- library="$(echo $* | awk '{print $2}')"
25
+ action="$(echo "$*" | awk '{print $1}')"
26
+ library="$(echo "$*" | awk '{print $2}')"
27
27
  args=$(echo "$*" | awk '{$1="" ; $2="" ; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
28
28
 
29
29
  install_package() {
@@ -44,7 +44,7 @@ install_package() {
44
44
  $rvm_scripts_path/fetch "$package_url/$package-$version.$archive_format" || (result=$? && return $result)
45
45
  __rvm_run "$package/extract" "unzip -q -o $rvm_archives_path/$package-$version.$archive_format -d $rvm_src_path/$package-$version" "Extracting $package-$version.$archive_format to $rvm_src_path"
46
46
  else
47
- echo -e "Unrecognized archive format '$archive_format'" ; return 1
47
+ printf "\nUnrecognized archive format '$archive_format'" ; return 1
48
48
  fi
49
49
 
50
50
  builtin cd "$rvm_src_path/$package-$version"
@@ -107,7 +107,7 @@ autoconf() {
107
107
  package_url="ftp.gnu.org/gnu/autoconf"
108
108
  package="autoconf" ; version="2.65" ; archive_format="tar.gz"
109
109
 
110
- prefix_path="${rvm_symlink_path:-"${rvm_path:-"$HOME/.rvm"}"}"
110
+ prefix_path="${rvm_bin_path:-"${rvm_path:-"$HOME/.rvm"}"}"
111
111
  install_package
112
112
  }
113
113
 
data/scripts/rvm CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- # rvm : Ruby Version Manager
3
+ # rvm : Ruby enVironment Manager
4
4
  # http://rvm.beginrescueend.com
5
5
  # http://gitub.com/wayneeseguin/rvm
6
6
 
@@ -12,7 +12,7 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
12
12
  for rvmrc in /etc/rvmrc $HOME/.rvmrc ; do
13
13
  if [[ -f "$rvmrc" ]] ; then
14
14
  if grep -q '^\s*rvm .*$' $rvmrc ; then
15
- echo -e "Error: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
15
+ printf "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
16
16
  return 1
17
17
  else
18
18
  source "$rvmrc"
@@ -72,15 +72,11 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
72
72
 
73
73
  alias rvm-restart="source '${rvm_path}/scripts/rvm'"
74
74
 
75
- if [[ -s "$HOME/.rvm/default" ]] ; then
76
- source "$HOME/.rvm/default"
77
- elif [[ -s "$rvm_config_path/default" ]] ; then
78
- source "$rvm_config_path/default"
79
- elif [[ -s "$rvm_prefix/rvm/config/default" ]] ; then
80
- source "$rvm_prefix/rvm/config/default"
75
+ if command -v ruby >/dev/null 2>&1 && command -v ruby | grep -v rvm >/dev/null ; then
76
+ [[ -s "$rvm_environments_path/default" ]] && source "$rvm_environments_path/default"
81
77
  fi
82
78
  else
83
- echo -e "\$rvm_path is not set. rvm cannot load."
79
+ printf "\n\$rvm_path is not set. rvm cannot load."
84
80
  fi
85
81
  fi
86
82
 
data/scripts/rvm-install CHANGED
@@ -11,7 +11,7 @@ source scripts/version
11
11
  source scripts/utility
12
12
 
13
13
  usage() {
14
- echo -e "
14
+ printf "
15
15
  Usage:
16
16
  ${0} [options]
17
17
 
@@ -27,7 +27,7 @@ spinner_counter=0
27
27
  spinner() {
28
28
  array=('/' '-' '\\' '|' '/' '-' '\\' '|')
29
29
  index=$((($spinner_counter % 8)))
30
- echo -e -n "\r${array[$index]}"
30
+ printf "\r${array[$index]}"
31
31
  let "spinner_counter=spinner_counter+1"
32
32
  command -v perl > /dev/null 2>&1 && perl -e 'sleep 0.5'
33
33
  }
@@ -86,19 +86,17 @@ rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
86
86
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
87
87
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
88
88
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
89
- rvm_symlink_path="${rvm_symlink_path:-$rvm_prefix/bin}"
90
89
 
91
90
  export rvm_gemset_separator="@" # TODO: Remove this after a while.
92
91
 
93
- echo -e "\n$(tput setaf 2)RVM$(tput sgr0) - shell scripts which allow management of multiple ruby interpreters and environments."
94
- echo -e "\n $(tput setaf 2)RTFM: $(tput sgr0) http://rvm.beginrescueend.com/"
95
- echo -e "\n $(tput setaf 2)HELP: $(tput sgr0) http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)"
92
+ printf "\n$(tput setaf 2)RVM:$(tput sgr0) shell scripts which allow management of multiple ruby interpreters and environments."
93
+ printf "\n$(tput setaf 2)RTFM: $(tput sgr0) http://rvm.beginrescueend.com/"
94
+ printf "\n$(tput setaf 2)HELP: $(tput sgr0) http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)"
96
95
 
97
- echo -e "\n********************************************************************************"
98
96
  if [[ "$upgrade_flag" -eq 1 ]] ;then
99
- echo -e -n " Upgrading the RVM installation in $rvm_path/"
97
+ printf "\n\n Upgrading the RVM installation in $rvm_path/"
100
98
  else
101
- echo -e -n " Installing rvm to $rvm_path/"
99
+ printf "\n\n Installing rvm to $rvm_path/"
102
100
  fi
103
101
 
104
102
  spinner
@@ -150,19 +148,19 @@ chmod +x $rvm_bin_path/*
150
148
  #
151
149
  spinner
152
150
  if [[ ! -z "$rvm_auto_flag" ]] ; then
153
- echo -e "Checking rc files... ($rvm_rc_files)"
151
+ printf "Checking rc files... ($rvm_rc_files)"
154
152
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
155
153
  for rcfile in $(echo $rvm_rc_files) ; do
156
154
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
157
155
  if [[ -s "$HOME/.profile" ]] ; then
158
156
  if ! grep -q '.profile' "$rcfile" ; then
159
157
  echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
160
- echo -e "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
158
+ printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
161
159
  fi
162
160
  fi
163
161
  if ! grep -q "scripts\/rvm" "$rcfile" ; then
164
162
  echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile."
165
- echo -e "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> $rcfile
163
+ printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> $rcfile
166
164
  fi
167
165
  done
168
166
  fi
@@ -196,12 +194,12 @@ done
196
194
  # Migrate old gemset directories to new gemset pattern.
197
195
  #
198
196
  spinner
199
- echo -e -n "\r*" # Stop spinner.
197
+ printf "\r*" # Stop spinner.
200
198
 
201
199
  for gemset in $rvm_path/gems/*\%* ; do
202
200
  new_path=${gemset/\%/${rvm_gemset_separator}}
203
201
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
204
- echo -e " Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
202
+ printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
205
203
  mv $gemset $new_path
206
204
  fi
207
205
  done
@@ -209,22 +207,26 @@ done
209
207
  for gemset in $rvm_path/gems/*\+* ; do
210
208
  new_path=${gemset/\+/${rvm_gemset_separator}}
211
209
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
212
- echo -e " Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
210
+ printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
213
211
  mv $gemset $new_path
214
212
  fi
215
213
  done
216
214
  for gemset in $rvm_path/gems/*\@ ; do
217
215
  new_path=$(echo $gemset | sed -e 's#\@$##')
218
216
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
219
- echo -e " Fixing: $(basename $gemset) to $(basename $new_path) for new gemset separator."
217
+ printf "\n Fixing: $(basename $gemset) to $(basename $new_path) for new gemset separator."
220
218
  mv $gemset $new_path
221
219
  fi
222
220
  done
223
221
 
224
- # Upgrade any default file.
225
- if [[ -s $rvm_config_path/default ]] && grep -q '\%' $rvm_config_path/default ; then
226
- sed -e "s#\%#${rvm_gemset_separator}#g" $rvm_config_path/default > $rvm_config_path/default.new
227
- mv $rvm_config_path/default.new $rvm_config_path/default
222
+ # Move from legacy defaults to the new, alias based system.
223
+ if [[ -s "$rvm_config_path/default" ]]; then
224
+ original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
225
+ if [[ -n "$original_version" ]]; then
226
+ $rvm_scripts_path/alias create default "$original_version" &> /dev/null
227
+ fi
228
+ unset original_version
229
+ rm -rf "$rvm_config_path/default"
228
230
  fi
229
231
 
230
232
  #
@@ -232,64 +234,60 @@ fi
232
234
  #
233
235
 
234
236
  if [[ "root" = "$(whoami)" ]] ; then
235
- echo -e "\n Symlinking rvm to $rvm_symlink_path/rvm ..."
236
- mkdir -p $rvm_symlink_path
237
- ln -nfs $rvm_bin_path/rvm $rvm_symlink_path/rvm
238
- ln -nfs $rvm_bin_path/rvmsudo $rvm_symlink_path/rvmsudo
239
- chmod +x $rvm_symlink_path/rvm
240
- chmod +x $rvm_symlink_path/rvmsudo
237
+ printf "\n Symlinking rvm to $rvm_bin_path/rvm ..."
238
+ mkdir -p $rvm_bin_path
239
+ chmod +x $rvm_bin_path/rvm
240
+ chmod +x $rvm_bin_path/rvmsudo
241
241
  fi
242
242
 
243
243
  if [[ "$upgrade_flag" -eq 0 ]] ; then
244
- echo -e "\n********************************************************************************"
245
244
  ./scripts/notes
246
245
  fi
247
246
 
248
- echo -e "\n********************************************************************************"
249
247
  name="$(awk -F= '/^[[:space:]]*name/{print $2}' ~/.gitconfig 2>/dev/null)"
250
- echo -e "\n${name:-"$(whoami)"},\n"
251
- echo -e "\nThank you for using rvm. I hope that it makes your work easier and more enjoyable."
252
- echo -e "If you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know."
253
- echo -e "My irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST."
254
- echo -e "If I do not respond right away, please hang around after asking your question, I will respond as soon as I am back."
255
- echo -e "Be sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'."
256
- echo -e "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!"
257
- echo -e "\n ~ Wayne"
258
- echo -e "\n********************************************************************************"
248
+ printf "\n\n${name:-"$(whoami)"},\n"
249
+ printf "\nThank you for using rvm. I hope that it makes your work easier and more enjoyable."
250
+ printf "\nIf you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know."
251
+ printf "\nMy irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST."
252
+ printf "\nIf I do not respond right away, please hang around after asking your question, I will respond as soon as I am back."
253
+ printf "\nBe sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'."
254
+ printf "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!"
255
+ printf "\n ~ Wayne\n"
259
256
 
260
257
  if [[ "$upgrade_flag" -eq 1 ]] ; then
261
- echo -e "\n$(tput setaf 6)**** NOTICE *************************************************************************************"
262
- echo -e "* Gemset separator has changed, it is now @ and will remain unless any rubies error using it. *"
263
- echo -e "* If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' *"
264
- echo -e "*************************************************************************************************$(tput sgr0)\n"
265
- echo -e "Upgrade of RVM in $rvm_path/ is complete.\n"
258
+ printf "\n$(tput setaf 6)Upgrade Notes\n"
259
+ printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
260
+ printf "\n * If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' "
261
+ printf "\n * Do not forget that 'rvm notes' tells you OS dependency packages for installing rubies."
262
+ printf "\n$(tput sgr0)\n"
263
+ printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
266
264
  else
267
265
  if [[ "root" != "$(whoami)" ]] ; then
268
- echo -e "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
269
- echo -e "\n1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:"
270
- echo -e "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
271
- echo -e "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
272
- echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:"
273
- echo -e "\n if [[ ! -z "$PS1" ]] ; then"
274
- echo -e "\n ... original content that was below the && return line ..."
275
- echo -e "\n fi # <= be sure to close the if."
276
- echo -e "\n #EOF .bashrc"
277
- echo -e "\n Be absolutely *sure* to REMOVE the '&& return'."
278
- echo -e "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
279
- echo -e "\n placing all non-interactive items in the .bashrc"
280
- echo -e "\n3) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
266
+ printf "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
267
+ printf "\n1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:"
268
+ printf "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
269
+ printf "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
270
+ printf "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:"
271
+ printf "\n if [[ ! -z "$PS1" ]] ; then"
272
+ printf "\n ... original content that was below the && return line ..."
273
+ printf "\n fi # <= be sure to close the if."
274
+ printf "\n #EOF .bashrc"
275
+ printf "\n Be absolutely *sure* to REMOVE the '&& return'."
276
+ printf "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
277
+ printf "\n placing all non-interactive items in the .bashrc"
278
+ printf "\n3) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
281
279
  fi
282
280
  if [[ -s $HOME/.bashrc ]] && grep '&& return' $HOME/.bashrc ; then
283
- echo -e "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
284
- This means that if you see '[ -z "\$PS1" ] && return' then you must change this line to:
285
- if [[ -n "\$PS1" ]] ; then
286
- ... original content that was below the && return line ...
287
- fi # <= be sure to close the if.
288
- #EOF .bashrc
289
-
290
- If you have any questions about this please visit #rvm on irc.freenode.net.\n"
281
+ printf "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc."
282
+ printf "\n This means that if you see '[ -z "\$PS1" ] && return' then you must change this line to:"
283
+ printf "\n if [[ -n "\$PS1" ]] ; then"
284
+ printf "\n ... original content that was below the && return line ..."
285
+ printf "\n fi # <= be sure to close the if."
286
+ printf "\n #EOF .bashrc"
287
+ printf "\nEven if you use zsh you should still adjust the .bashrc as above."
288
+ printf "\nIf you have any questions about this please visit #rvm on irc.freenode.net.\n"
291
289
  fi
292
- echo -e "Installation of RVM to $rvm_path/ is complete.\n\n"
290
+ printf "\nInstallation of RVM to $rvm_path/ is complete.\n\n"
293
291
  fi
294
292
 
295
293
  exit 0