rvm 0.1.38 → 0.1.39

Sign up to get free protection for your applications and to get access to all the features.
@@ -106,7 +106,7 @@ gemset_copy() {
106
106
  cp -Rf "$source_path/$dir" "$destination_path/"
107
107
  done
108
108
  $rvm_scripts_path/log "info" "Making gemset for $destination_ruby pristine."
109
- $(rvm $destination_ruby ; gem pristine --all)
109
+ (rvm "$destination_ruby" ; gemset_pristine)
110
110
  else
111
111
  $rvm_scripts_path/log "error" "Gems directory does not exist for $source_path ($source_path)"
112
112
  return 1
@@ -331,7 +331,7 @@ gemset_prune() {
331
331
  mv "$temporary_cache_path" "$live_cache_path"
332
332
  }
333
333
 
334
- gem_pristine() {
334
+ gemset_pristine() {
335
335
  gem pristine --all
336
336
  }
337
337
 
@@ -400,7 +400,7 @@ elif [[ "gemdir" = "$action" ]] || [[ "gempath" = "$action" ]] || [[ "gemhome" =
400
400
  elif [[ "install" = "$action" ]] ; then
401
401
  gem_install $*
402
402
  elif [[ "pristine" = "$action" ]] ; then
403
- gem_pristine $*
403
+ gemset_pristine $*
404
404
  elif [[ "initial" = "$action" ]] ; then
405
405
  gemset_initial
406
406
  elif [[ "prune" = "$action" ]] ; then
@@ -25,12 +25,12 @@ info_system() {
25
25
 
26
26
  info_rvm() {
27
27
  rvm_info="$rvm_info\n rvm:"
28
- rvm_info="$rvm_info\n type: \"$(head -n 1 < <(type rvm))\""
29
28
  rvm_info="$rvm_info\n version: \"$(__rvm_version | tr "\n" ' ' | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//')\""
30
29
  rvm_info="$rvm_info\n"
31
30
  }
32
31
 
33
32
  info_ruby() {
33
+ [[ "$(__rvm_environment_identifier)" == "system" ]] && return
34
34
  ruby=$(command -v ruby)
35
35
  if [[ $? -eq 0 ]] && [[ -x "$ruby" ]] ; then full_version="$($ruby -v)" ; fi
36
36
  rvm_info="$rvm_info\n ruby:"
@@ -61,6 +61,7 @@ info_binaries() {
61
61
 
62
62
  info_environment() {
63
63
  rvm_info="$rvm_info\n environment:"
64
+ rvm_info="$rvm_info\n PATH: \"$PATH\""
64
65
  rvm_info="$rvm_info\n GEM_HOME: \"$GEM_HOME\""
65
66
  rvm_info="$rvm_info\n GEM_PATH: \"$GEM_PATH\""
66
67
  rvm_info="$rvm_info\n BUNDLE_PATH: \"$BUNDLE_PATH\""
@@ -11,12 +11,17 @@ if [[ ! -z "$rvm_archflags" ]] ; then rvm_make_flags_flag=1 ; fi
11
11
  rvm_project_rvmrc="${rvm_project_rvmrc:-1}"
12
12
  rvm_project_rvmrc_default="${rvm_project_rvmrc_default:-0}"
13
13
 
14
+ if [[ "root" = "$(whoami)" ]] ; then
15
+ rvm_bin_path="${rvm_bin_path:-"/usr/local/bin"}"
16
+ else
17
+ rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
18
+ fi
19
+
14
20
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
15
21
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
16
22
  rvm_repo_path="${rvm_repo_path:-"$rvm_path/repos"}"
17
23
  rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
18
24
  rvm_docs_path="${rvm_docs_path:-"$rvm_path/docs"}"
19
- rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
20
25
  rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}"
21
26
  rvm_gemsets_path="${rvm_gemsets_path:-"$rvm_path/gemsets"}"
22
27
  rvm_gems_cache_path="${rvm_gems_cache_path:-"$rvm_gems_path/cache"}"
@@ -79,7 +79,13 @@ source_path="${source_path:-$cwd}"
79
79
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
80
80
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
81
81
  rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
82
- rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
82
+
83
+ if [[ "root" = "$(whoami)" ]] ; then
84
+ rvm_bin_path="${rvm_bin_path:-"/usr/local/bin"}"
85
+ else
86
+ rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
87
+ fi
88
+
83
89
  rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}"
84
90
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
85
91
  rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
@@ -55,7 +55,10 @@ __rvm_install_source() {
55
55
  $rvm_scripts_path/log "error" "There has been an error while configuring. Aborting the installation." ; __rvm_pushpop ; return $result
56
56
  fi
57
57
  elif [[ -s ./configure ]] ; then
58
- __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
58
+ # REE stores configure flags differently for head vs. the distributed release.
59
+ if [[ "ree" != "$rvm_ruby_interpreter" ]]; then
60
+ __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
61
+ fi
59
62
  __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_string, this may take a while depending on your cpu(s)..."
60
63
  result=$? ; if [[ "$result" -gt 0 ]] ; then
61
64
  $rvm_scripts_path/log "error" "There has been an error while running configure. Aborting the installation." ; __rvm_pushpop ; return $result
@@ -66,7 +69,19 @@ __rvm_install_source() {
66
69
 
67
70
  if [[ ! -z "$rvm_ruby_patch" ]] ; then
68
71
  for patch in $(echo $rvm_ruby_patch | tr ',' ' ') ; do
69
- __rvm_run "patch" "patch -p0 -f < $patch" "Applying patch '$patch'..."
72
+ # detecting patch prefix (see '-p' option desc for 'patch')
73
+ # patch prefix is separated from patch path with '%' symbol
74
+ patch_prefix_separator='%'
75
+ # default prefix is 0
76
+ rvm_patch_prefix=0
77
+ # checking, if the patch file path has a prefix separator
78
+ patch_has_prefix=$(echo $patch | grep -q ${patch_prefix_separator}; echo $?)
79
+ if [[ "x${patch_has_prefix}" = "x0" ]]; then
80
+ # so, if it has...
81
+ rvm_patch_prefix=$(echo $patch | cut -d ${patch_prefix_separator} -f 2)
82
+ patch=$(echo $patch | cut -d ${patch_prefix_separator} -f 1)
83
+ fi
84
+ __rvm_run "patch" "patch -p${rvm_patch_prefix} -f < $patch" "Applying patch '$patch'..."
70
85
  if [[ $? -gt 0 ]] ; then
71
86
  $rvm_scripts_path/log "error" "Patch $patch did not apply cleanly... back to the patching board :(" ; exit 1
72
87
  fi
@@ -101,7 +116,7 @@ __rvm_install_source() {
101
116
  }
102
117
 
103
118
  __rvm_install_ruby() {
104
-
119
+
105
120
  if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
106
121
 
107
122
  if [[ ! -z "$RUBYOPT" ]] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
@@ -271,16 +286,7 @@ RubyWrapper
271
286
  else
272
287
  __rvm_db "rubinius_repo_url" "rvm_ruby_repo_url"
273
288
  #rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
274
- if [[ ! -d "$rvm_ruby_repo_path" ]] || [[ ! -d "$rvm_ruby_repo_path/.git" ]] ; then
275
- rm -rf "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
276
- builtin cd "$rvm_home"
277
- __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_url"
278
- __rvm_run "rbx.copy" "cp -R \"$rvm_ruby_repo_path\" \"$rvm_ruby_src_path\"" "Copying from repo to source..."
279
- builtin cd "$rvm_ruby_src_path"
280
- else
281
- builtin cd "$rvm_ruby_src_path"
282
- __rvm_run "rbx.repo" "git pull origin master" "Pulling from origin master"
283
- fi
289
+ __rvm_fetch_from_github "rbx"
284
290
  result=$? ; if [[ "$result" -gt 0 ]] ; then
285
291
  $rvm_scripts_path/log "error" "There has been an error while fetching the rbx git repo. Aborting the installation." ; __rvm_pushpop ; return $result
286
292
  fi
@@ -290,8 +296,10 @@ RubyWrapper
290
296
 
291
297
  __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
292
298
 
299
+ export ruby="$rvm_bin_path/ruby-1.8.7-p$(__rvm_db "ruby_1.8.7_patch_level")"
300
+
293
301
  rvm_ruby_configure_flags="${rvm_ruby_configure_flags:-"--skip-system"}"
294
- rvm_ruby_configure="ruby configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_ruby_configure_flags" ; message="Configuring rbx"
302
+ rvm_ruby_configure="$ruby configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_ruby_configure_flags" ; message="Configuring rbx"
295
303
  if [[ "$rvm_llvm_flag" = "0" ]] ; then
296
304
  rvm_ruby_configure="$rvm_ruby_configure --disable-llvm"
297
305
  else
@@ -305,25 +313,26 @@ RubyWrapper
305
313
  fi
306
314
 
307
315
  if [[ "$rvm_trace_flag" -eq 1 ]] ; then
308
- rvm_ruby_make="$rvm_bin_path/ruby-1.8.7-p$(__rvm_db "ruby_1.8.7_patch_level") -S rake install --trace" ; message="Compiling rbx (with --trace)"
316
+ rvm_ruby_make="$ruby -S rake install --trace" ; message="Compiling rbx (with --trace)"
309
317
  else
310
- rvm_ruby_make="$rvm_bin_path/ruby-1.8.7-p$(__rvm_db "ruby_1.8.7_patch_level") -S rake install" ; message="Compiling rbx"
318
+ rvm_ruby_make="$ruby -S rake install" ; message="Compiling rbx"
311
319
  fi
312
320
  __rvm_run "rake" "$rvm_ruby_make" "$message"
313
321
  result=$? ; if [[ "$result" -gt 0 ]] ; then
314
322
  $rvm_scripts_path/log "error" "There has been an error while running '$rvm_ruby_configure'. Aborting the installation." ; __rvm_pushpop ; return $result
315
323
  fi
316
324
 
325
+ unset ruby
326
+
317
327
  # Symlink rubinius wrappers
318
328
  ln -fs "$rvm_ruby_home/bin/rbx" "$rvm_ruby_home/bin/irb"
319
329
  ln -fs "$rvm_ruby_home/bin/rbx" "$rvm_ruby_home/bin/ruby"
320
330
  # Install a wrapper around gem.
321
331
  file_name="$rvm_ruby_home/bin/gem"
322
- if [[ ! -f "$file_name" ]]; then
323
- echo "#!/usr/bin/env bash" > "$file_name"
324
- echo "exec $rvm_ruby_home/bin/rbx gem \"\$@\"" >> "$file_name"
325
- [[ -f "$file_name" ]] && chmod +x "$file_name"
326
- fi
332
+ cp -f "$rvm_ruby_home/lib/bin/gem.rb" "$file_name"
333
+
334
+ __rvm_inject_ruby_shebang "$file_name"
335
+ [[ -f "$file_name" ]] && chmod +x "$file_name"
327
336
  unset file_name
328
337
 
329
338
  binaries="erb ri rdoc"
@@ -562,17 +571,7 @@ RubyWrapper
562
571
 
563
572
  rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
564
573
 
565
- builtin cd $rvm_src_path
566
-
567
- if [[ ! -d "$rvm_ruby_src_path" ]] || [[ ! -d "$rvm_ruby_src_path/.git" ]] ; then
568
- rm -rf $rvm_ruby_src_path $rvm_ruby_repo_path
569
- __rvm_run "mput.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_url"
570
- __rvm_run "mput.copy" "cp -R \"$rvm_ruby_repo_path\" \"$rvm_ruby_src_path\"" "Copying from repo to source..."
571
- builtin cd $rvm_ruby_src_path
572
- else
573
- builtin cd $rvm_ruby_src_path
574
- __rvm_run "mput.repo" "git pull origin trunk" "Pulling from origin trunk"
575
- fi
574
+ __rvm_fetch_from_github "mput" "trunk"
576
575
 
577
576
  if [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
578
577
  if command -v autoconf &> /dev/null ; then
@@ -639,15 +638,27 @@ RubyWrapper
639
638
  *) $rvm_scripts_path/log "fail" "Ruby interpreter '$rvm_ruby_interpreter' is not known."
640
639
 
641
640
  esac
642
-
643
- # Import the initial gemsets.
644
- (source $rvm_scripts_path/rvm; rvm use "$rvm_ruby_string"; $rvm_scripts_path/gemsets initial)
645
641
 
646
642
  rvm_hook="after_install" ; source $rvm_scripts_path/hook
647
643
 
648
644
  if [[ ! -z "$ruby_options" ]] ; then RUBYOPT=$ruby_options ; export RUBYOPT ; fi
649
645
  }
650
646
 
647
+ __rvm_fetch_from_github() {
648
+ rm -rf "$rvm_ruby_src_path"
649
+ if [[ ! -d "$rvm_ruby_repo_path/.git" ]] ; then
650
+ rm -rf "$rvm_ruby_repo_path"
651
+ builtin cd "$rvm_home"
652
+ __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_url"
653
+ else
654
+ local branch="${2:-"master"}"
655
+ builtin cd "$rvm_ruby_repo_path"
656
+ __rvm_run "$1.repo" "git pull origin $branch" "Pulling from origin $branch"
657
+ fi
658
+ __rvm_run "$1.copy" "cp -R \"$rvm_ruby_repo_path\" \"$rvm_ruby_src_path\"" "Copying from repo to source..."
659
+ builtin cd "$rvm_ruby_src_path"
660
+ }
661
+
651
662
  __rvm_fetch_ruby() {
652
663
  if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
653
664
 
@@ -697,7 +708,7 @@ __rvm_fetch_ruby() {
697
708
  builtin cd $rvm_ruby_repo_path
698
709
  if [[ -z "$rvm_ruby_revision" ]] ; then
699
710
  $rvm_scripts_path/log "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
700
- git pull origin master
711
+ git pull origin master --force
701
712
  result=$? ; if [[ "$result" -gt 0 ]] ; then
702
713
  $rvm_scripts_path/log "error" "There has been an error while trying to update the source from the remote repository. Aborting the installation." ; __rvm_pushpop ; return $result
703
714
  fi
@@ -712,8 +723,9 @@ __rvm_fetch_ruby() {
712
723
  fi
713
724
  fi
714
725
  else
726
+ rm -rf "$rvm_ruby_repo_path"
715
727
  $rvm_scripts_path/log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
716
- git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path
728
+ git clone --depth 1 "$rvm_ruby_repo_url" "$rvm_ruby_repo_path"
717
729
  result=$? ; if [[ "$result" -gt 0 ]] ; then
718
730
  $rvm_scripts_path/log "error" "There has been an error while trying to fetch the repository. Aborting the installation." ; __rvm_pushpop ; return $result
719
731
  fi
@@ -760,7 +772,8 @@ __rvm_fetch_ruby() {
760
772
 
761
773
  fi
762
774
  $rvm_scripts_path/log "info" "Copying from repo to src path..."
763
- cp -r "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
775
+ rm -rf "$rvm_ruby_src_path"
776
+ cp -R "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
764
777
  fi
765
778
  }
766
779
 
@@ -768,8 +781,7 @@ __rvm_check_default() {
768
781
  default_ruby_interpreter="$(rvm alias show default 2>/dev/null | awk -F"${rvm_gemset_seperator:-"@"}" '{print $1}')"
769
782
  current_ruby_interpreter="$(echo "$rvm_ruby_string" | awk -F"${rvm_gemset_seperator:-"@"}" '{print $1}')"
770
783
  if [[ -n "$current_ruby_interpreter" && "$current_ruby_interpreter" == "$default_ruby_interpreter" ]]; then
771
- # In a new subshell, set the default interpeter to system.
772
- (source $rvm_scripts_path/rvm; rvm use system --default)
784
+ __rvm_run_with_env 'default.restore' 'system' 'rvm use system --default' 'Removing default ruby interpreter'
773
785
  fi
774
786
  unset default_ruby_interpreter current_ruby_interpreter
775
787
  }
@@ -818,16 +830,56 @@ __rvm_remove_ruby() {
818
830
 
819
831
  done ; unset dir
820
832
  __rvm_remove_gemsets
833
+ __rvm_remove_archives
834
+ __rvm_remove_aliases
835
+ __rvm_remove_wrappers
836
+ __rvm_remove_environments
821
837
  else
822
- $rvm_scripts_path/log "fail" "Cannot uninstall unknown package '$rvm_ruby_string'"
838
+ $rvm_scripts_path/log "fail" "Cannot remove unknown package '$rvm_ruby_string'"
823
839
  fi ; unset rvm_remove_flag
824
840
  }
825
841
 
826
842
  __rvm_remove_gemsets() {
843
+ $rvm_scripts_path/log "info" "Removing $rvm_ruby_string gemsets..."
827
844
  if [[ ! -z "$rvm_gems_flag" ]] ; then
828
- if [[ -d "$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}" ]] ; then
829
- rm -rf $rvm_gems_path/${rvm_ruby_string}*
830
- fi
845
+ gemsets="$rvm_gems_path/$rvm_ruby_string $(ls -d "${rvm_gems_path}"/* | awk '/'$rvm_ruby_string'@/')"
846
+ for gemset in $gemsets ; do
847
+ if [[ -d "$gemset" ]] ; then
848
+ rm -rf "$gemset"
849
+ fi
850
+ done ; unset gemset gemsets
851
+ fi
852
+ }
853
+
854
+ __rvm_remove_wrappers() {
855
+ $rvm_scripts_path/log "info" "Removing $rvm_ruby_string wrappers..."
856
+ wrappers="$rvm_wrappers_path/$rvm_ruby_string $(ls -d "$rvm_wrappers_path"/* | awk '/'$rvm_ruby_string'@/')"
857
+ for wrapper in $wrappers ; do
858
+ rm -rf "$wrapper"
859
+ done ; unset wrapper wrappers
860
+ }
861
+ __rvm_remove_environments() {
862
+ $rvm_scripts_path/log "info" "Removing $rvm_ruby_string environments..."
863
+ environments="$rvm_environments_path/$rvm_ruby_string $(ls -d "$rvm_environments_path"/* | awk '/'$rvm_ruby_string'@/')"
864
+ for environment in $environments ; do
865
+ rm -rf "$environment"
866
+ done ; unset environment environments
867
+ }
868
+ __rvm_remove_aliases() {
869
+ $rvm_scripts_path/log "info" "Removing $rvm_ruby_string aliases..."
870
+ aliases=$(awk '/'$rvm_ruby_string'/' $rvm_config_path/alias)
871
+ for alias_name in $aliases ; do
872
+ # Remove from alias key-value store
873
+ $rvm_scripts_path/db $rvm_config_path/alias $alias_name delete
874
+ # Remove the place holding symlink
875
+ rm -f $rvm_rubies_path/$alias_name
876
+ done ; unset alias_name aliases
877
+ }
878
+
879
+ __rvm_remove_archives() {
880
+ $rvm_scripts_path/log "info" "Removing $rvm_ruby_string archives..."
881
+ if [[ ! -z "$rvm_archive_flag" ]] ; then
882
+ rm -f $rvm_archives_path/${rvm_ruby_package_file}.${rvm_archive_extension}
831
883
  fi
832
884
  }
833
885
 
@@ -849,25 +901,26 @@ __rvm_post_install() {
849
901
  done ; unset binary binaries
850
902
  fi
851
903
 
904
+ # Import the initial gemsets.
905
+ __rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" 'rvm gemset initial' "Importing initial gems..."
906
+
852
907
  __rvm_irbrc
853
908
  __rvm_generate_default_docs
854
909
 
855
910
  if [[ -n "$rvm_ruby_aliases" ]]; then
856
911
  $rvm_scripts_path/log "info" "Setting up aliases for $rvm_ruby_string"
857
912
  for ruby_alias in $rvm_ruby_aliases; do
858
- $rvm_scripts_path/log "info" "Aliasing $rvm_ruby_string to $ruby_alias"
913
+ $rvm_scripts_path/log info "Aliasing $rvm_ruby_string to $ruby_alias"
859
914
  $rvm_scripts_path/alias delete "$ruby_alias" > /dev/null 2>&1
860
915
  $rvm_scripts_path/alias create "$ruby_alias" "$rvm_ruby_string" > /dev/null 2>&1
861
916
  done
862
917
  unset rvm_ruby_aliases ruby_alias
863
918
  fi
864
-
865
919
  }
866
920
 
867
921
  __rvm_generate_default_docs() {
868
922
  if [[ "$rvm_docs_flag" = "1" && "$rvm_ruby_interpreter" != "macruby" ]]; then
869
- $rvm_scripts_path/log "info" "Attempting to generate ri docs..."
870
- (source $rvm_scripts_path/rvm; rvm use "$rvm_ruby_string"; rvm docs generate-ri) > ~/rvm-install-docs 2>&1
923
+ __rvm_run_with_env "docs.generate" "$rvm_ruby_string" "rvm docs generate-ri" "Attempting to generate ri documentation..."
871
924
  fi
872
925
  }
873
926
 
@@ -906,7 +959,8 @@ __rvm_rubygems_setup() {
906
959
  ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/jruby"
907
960
  else
908
961
  $rvm_scripts_path/log "info" "Installing rubygems dedicated to $rvm_ruby_string..."
909
- rvm_rubygems_version=$(__rvm_db "rubygems_version")
962
+ rvm_rubygems_version="$(__rvm_db "${rvm_ruby_interpreter}_rubygems_version")"
963
+ rvm_rubygems_version="${rvm_rubygems_version:-"$(__rvm_db "rubygems_version")"}"
910
964
  rvm_rubygems_url=$(__rvm_db "rubygems_${rvm_rubygems_version}_url")
911
965
  rvm_gem_package_name="rubygems-$rvm_rubygems_version"
912
966
  rvm_gem_url="$rvm_rubygems_url/$rvm_gem_package_name.tgz"
@@ -1,16 +1,5 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- if [[ -z "$1" ]] || [[ -z "$2" ]] ; then
4
- exit 1
5
- fi
3
+ if [[ -z "$1" ]] || [[ -z "$2" ]] ; then exit 1 ; fi
6
4
 
7
- if [[ ! -z "$BASH_VERSION" ]] && [[ ${BASH_VERSION:0:1} -gt 2 ]] ; then
8
- [[ "$1" =~ $2 ]]
9
- exit $?
10
- else
11
- if echo "$1" | grep -q "${2}" ; then
12
- exit 0
13
- else
14
- exit 1
15
- fi
16
- fi
5
+ if [[ -n "$(echo "$1" | awk "/${2}/")" ]] ; then exit 0 ; else exit 1 ; fi
@@ -9,7 +9,7 @@ if [[ "Linux" = "$system" ]] ; then
9
9
  done
10
10
  printf "\n\n$(tput setaf 2)Notes for ${system} $release$(tput sgr0)\n"
11
11
 
12
- rvm_apt_get_binary="$(command -v aptitude)"
12
+ rvm_aptitude_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)"
@@ -17,12 +17,12 @@ if [[ "Linux" = "$system" ]] ; then
17
17
  printf "\n $item curl is required.\n"
18
18
  printf "\n $item patch is required (for ree, some ruby head's).\n"
19
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"
20
- if [[ ! -z "$rvm_apt_get_binary" ]] ; then
20
+ if [[ ! -z "$rvm_aptitude_binary" ]] ; then
21
21
  printf "\n $item For JRuby (if you wish to use it) you will need:"
22
22
  printf "\n $ aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk"
23
23
 
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"
24
+ printf "\n $item For MRI & ree (if you wish to use it) you will need (depending on what you are installing):"
25
+ printf "\n $ aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline5-dev libreadline6-dev libxml2-dev git-core subversion autoconf"
26
26
 
27
27
  printf "\n $item For IronRuby (if you wish to use it) you will need:"
28
28
  printf "\n $ aptitude install curl mono-2.0-devel"
@@ -86,14 +86,21 @@ curl() {
86
86
  }
87
87
 
88
88
  openssl() {
89
- if $rvm_scripts_path/match "$rvm_archflags" "x86_64" ; then
90
- export openssl_os="os/compiler darwin64-x86_64-cc"
91
- else
92
- export openssl_os="os/compiler darwin-i386-cc"
93
- fi
94
89
  package="openssl" ; version="0.9.8n" ; archive_format="tar.gz"
95
90
  package_url="http://www.openssl.org/source"
96
- configure="./config --prefix=$rvm_usr_path zlib no-asm no-krb5 shared"
91
+ if [[ "Darwin" = "$(uname)" ]] ; then
92
+ if $rvm_scripts_path/match "$rvm_archflags" "x86_64" ; then
93
+ export openssl_os="os/compiler darwin64-x86_64-cc"
94
+ else
95
+ export openssl_os="os/compiler darwin-i386-cc"
96
+ fi
97
+ configure_command="./Configure"
98
+ patches="$rvm_patches_path/$package/Makefile.org.patch,$rvm_patches_path/$package/crypto-Makefile.patch"
99
+
100
+ else
101
+ configure_command="./config"
102
+ fi
103
+ configure="$configure_command $openssl_os -I$rvm_usr_path/include -L$rvm_usr_path/lib --prefix=$rvm_usr_path zlib no-asm no-krb5 shared"
97
104
  install_package
98
105
  }
99
106
 
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env bash
2
+
3
+ source $rvm_scripts_path/initialize
4
+ source $rvm_scripts_path/utility
5
+ source $rvm_scripts_path/selector
6
+
7
+ result=0
8
+
9
+ __rvm_select
10
+
11
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
12
+ trap "if [[ -d $rvm_tmp_path/ ]] && [[ -s $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
13
+
14
+ rubygems_setup() {
15
+ unset RUBYOPT
16
+ if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.9/')" ]] || [[ ! -z "$(echo $rvm_ruby_interpreter | awk '/^mput/')" ]] ; then
17
+ install=0
18
+ elif [[ "$rvm_ruby_string" = "ruby-head" ]] ; then
19
+ install=0
20
+ elif [[ -n "$(echo "$rvm_ruby_string" | awk '/^rbx|jruby|rubinius/')" ]]; then
21
+ install=0
22
+ else
23
+ install=1
24
+ fi
25
+
26
+ if [[ "$install" -eq 0 ]] ; then
27
+ $rvm_scripts_path/log "error" "Cannot switch to ${version} for this interpreter."
28
+ exit 1
29
+ else
30
+ $rvm_scripts_path/log "info" "Removing old Rubygems files..."
31
+ rubygems_dir="$(ruby -rrbconfig -e "puts Config::CONFIG.values_at('sitelibdir','vendorlibdir').detect {|path| File.directory?(File.join(path, 'rubygems')) }.to_s")"
32
+ if [[ -n "$rubygems_dir" && -d "$rubygems_dir" ]]; then
33
+ # Remove common files installed by ruby gems.
34
+ rm -rf "${rubygems_dir}/ubygems.rb" "${rubygems_dir}/rubygems.rb" "${rubygems_dir}/rubygems" "${rubygems_dir}/gauntlet_rubygems.rb"
35
+ fi
36
+
37
+ $rvm_scripts_path/log "info" "Installing rubygems dedicated to $rvm_ruby_string..."
38
+ rvm_rubygems_version="$version"
39
+ rvm_gem_package_name="rubygems-$rvm_rubygems_version"
40
+ rvm_rubygems_url=$(__rvm_db "rubygems_${rvm_rubygems_version}_url")
41
+ rvm_gem_url="$rvm_rubygems_url/$rvm_gem_package_name.tgz"
42
+
43
+ # Sanity check... If setup.rb is missing from the rubygems source path,
44
+ # something went wrong. Cleanup, aisle 3!
45
+ if [[ ! -f "$rvm_src_path/$rvm_gem_package_name/setup.rb" ]]; then
46
+ rm -rf "$rvm_src_path/$rvm_gem_package_name"
47
+ fi
48
+
49
+ if [[ ! -d "$rvm_src_path/$rvm_gem_package_name" ]] ; then
50
+ $rvm_scripts_path/log "info" "Retrieving $rvm_gem_package_name"
51
+ $rvm_scripts_path/fetch "$rvm_gem_url"
52
+ result=$? ; if [[ "$result" -gt 0 ]] ; then
53
+ $rvm_scripts_path/log "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
54
+ fi
55
+ mkdir -p "$rvm_src_path/$rvm_gem_package_name"
56
+ __rvm_run "rubygems.extract" "cat $rvm_archives_path/$rvm_gem_package_name.tgz | gunzip | tar xf - -C $rvm_src_path" "Extracting $rvm_gem_package_name ..."
57
+ fi
58
+
59
+ builtin cd "$rvm_src_path/$rvm_gem_package_name"
60
+
61
+ __rvm_run "rubygems.install" "GEM_PATH=$rvm_ruby_gem_path GEM_HOME=$rvm_ruby_gem_home BUNDLE_PATH=$rvm_ruby_gem_home $rvm_ruby_home/bin/ruby $rvm_src_path/$rvm_gem_package_name/setup.rb" "Installing rubygems for $rvm_ruby_home/bin/ruby"
62
+ result=$?
63
+ if [[ "$result" == 0 ]] ; then
64
+ $rvm_scripts_path/log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
65
+ else
66
+ $rvm_scripts_path/log "warning" "Installation of rubygems $rvm_ruby_package_name did not complete successfully."
67
+ fi
68
+
69
+ if [[ ! -z "$rvm_major_version" ]] ; then
70
+ ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/${rvm_release_version}.${rvm_major_version}"
71
+ else
72
+ ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/$interpreter"
73
+ fi
74
+ fi
75
+
76
+ # Add ruby's gem path to ruby's lib direcotry.
77
+ mkdir -p "$(dirname $ruby_lib_gem_path)"
78
+
79
+ if [[ -d "$ruby_lib_gem_path" ]] ; then rm -rf "$ruby_lib_gem_path" ; fi
80
+
81
+ ln -nfs "$rvm_ruby_gem_home" "$ruby_lib_gem_path"
82
+
83
+ unset ruby_lib_gem_path
84
+ }
85
+
86
+ if ! command -v ruby > /dev/null ; then
87
+ $rvm_scripts_path/log "error" "'ruby' was not found, cannot install rubygems unless ruby is present (Do you have an RVM ruby installed & selected?)"
88
+ exit 1
89
+ fi
90
+
91
+ #
92
+ # rvm rubygems use X
93
+ #
94
+ if [[ $# -gt 0 ]] ; then
95
+ version="$1" ; shift
96
+ args=$(echo "$@" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
97
+ else
98
+ $rvm_scripts_path/log "error" "A version must be specified, for example 'rvm rubygems 1.3.7'"
99
+ exit 1
100
+ fi
101
+
102
+ rubygems_setup
103
+
104
+ exit $result