rvm 0.1.39 → 0.1.40

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,13 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- source $rvm_scripts_path/initialize
4
- source $rvm_scripts_path/utility
5
- source $rvm_scripts_path/selector
3
+ source "$rvm_scripts_path/base"
6
4
 
7
5
  result=0
8
6
 
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
7
+ __rvm_become
13
8
 
14
9
  rubygems_setup() {
10
+ __rvm_warn_on_rubyopt
15
11
  unset RUBYOPT
16
12
  if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.9/')" ]] || [[ ! -z "$(echo $rvm_ruby_interpreter | awk '/^mput/')" ]] ; then
17
13
  install=0
@@ -23,6 +23,13 @@ usage() {
23
23
  "
24
24
  }
25
25
 
26
+ check_rubyopt_conditions() {
27
+ if [[ -n "$RUBYOPT" ]]; then
28
+ printf "\n\nWARNING: You have RUBYOPT set in your current environment. This may interfere with normal rvm"
29
+ printf "\n operation. If errors show up, please try unsetting RUBYOPT first.\n"
30
+ fi
31
+ }
32
+
26
33
  spinner_counter=0
27
34
  spinner() {
28
35
  array=('/' '-' '\\' '|' '/' '-' '\\' '|')
@@ -282,12 +289,14 @@ if [[ "$upgrade_flag" -eq 1 ]] ; then
282
289
  printf "\n * 1.8.7 default patchlevel is p174, override ~/.rvm/config/db in ~/.rvm/config/user"
283
290
  printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
284
291
  printf "\n$(tput sgr0)\n"
292
+ check_rubyopt_conditions
285
293
  printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
286
294
  else
287
295
  if [[ "root" != "$(whoami)" ]] ; then
288
296
  printf "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
289
297
  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:"
290
298
  printf "\n [[ -s \$HOME/.rvm/scripts/rvm ]] && source \$HOME/.rvm/scripts/rvm"
299
+ printf "\n Please note that this must only occur once - so, you only need to add it the first time you install rvm."
291
300
  printf "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
292
301
  printf "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:"
293
302
  printf "\n if [[ ! -z "$PS1" ]] ; then"
@@ -309,6 +318,7 @@ else
309
318
  printf "\nEven if you use zsh you should still adjust the .bashrc as above."
310
319
  printf "\nIf you have any questions about this please visit #rvm on irc.freenode.net.\n"
311
320
  fi
321
+ check_rubyopt_conditions
312
322
  printf "\nInstallation of RVM to $rvm_path/ is complete.\n\n"
313
323
  fi
314
324
 
@@ -192,7 +192,7 @@ __rvm_select() {
192
192
 
193
193
  __rvm_gemset_select
194
194
 
195
- if [[ ! -z "$rvm_ruby_interpreter" ]] && [[ "system" != "$rvm_ruby_interpreter" ]] && [[ "default" != "$rvm_ruby_interpreter" ]] ; then
195
+ if [[ -n "$rvm_ruby_interpreter" && "system" != "$rvm_ruby_interpreter" && "default" != "$rvm_ruby_interpreter" ]] ; then
196
196
  if [[ ! -z "$rvm_ruby_version" ]] ; then
197
197
  rvm_release_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $1 }')
198
198
  rvm_major_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $2 }')
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- source $rvm_scripts_path/initialize
4
- source $rvm_scripts_path/utility
5
- source $rvm_scripts_path/selector
6
-
7
- if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
8
-
9
- 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
3
+ source "$rvm_scripts_path/base"
10
4
 
11
5
  if [[ -z "$1" ]] ; then
12
6
  $rvm_scripts_path/log "error" "Action must be specified."
@@ -21,13 +15,14 @@ __rvm_attempt_single_exec() {
21
15
  if [[ "$action" != "exec" ]] || $rvm_scripts_path/match "$rvm_ruby_strings" ' '; then
22
16
  return 1
23
17
  fi
18
+ __rvm_become "$rvm_ruby_strings"
24
19
  eval "exec $args"
25
20
  }
26
21
 
27
22
  # Perform an action using one of a selected ruby's specified binaries.
28
23
  __rvm_ruby_do() {
29
24
  # Return on invalid rubies.
30
- __rvm_become || return 1
25
+ __rvm_become "$current_set_ruby" || return 1
31
26
  if [[ "$action" = "exec" ]]; then
32
27
  # Exec is a special case.
33
28
  rvm_command="$args"
@@ -73,7 +68,12 @@ __rvm_ruby_do() {
73
68
  eval "$rvm_command" >> ./log/$rvm_ruby_string/$action.log 2>> ./log/$rvm_ruby_string/$action.error.log
74
69
  else
75
70
  if [[ "$rvm_verbose_flag" != "0" ]] ; then
76
- $rvm_scripts_path/log "info" "$rvm_ruby_string: $(ruby -v $rvm_ruby_mode | tr "\n" ' ')\n"
71
+ current_env="$(__rvm_environment_identifier)"
72
+ if [[ "$current_env" != "$current_set_ruby" ]]; then
73
+ current_env="$current_set_ruby ($current_env)"
74
+ fi
75
+ $rvm_scripts_path/log "info" "$current_env: $(ruby -v $rvm_ruby_mode | tr "\n" ' ')\n"
76
+ unset current_env
77
77
  fi
78
78
  eval "$rvm_command"
79
79
  fi
@@ -165,9 +165,9 @@ rvm_ruby_strings="$(echo "$rvm_ruby_strings" | tr ',' ' ')"
165
165
  # Check for a single ruby && exec if present.
166
166
  __rvm_attempt_single_exec
167
167
 
168
- for rvm_ruby_string in ${rvm_ruby_strings} ; do
168
+ for current_set_ruby in ${rvm_ruby_strings} ; do
169
169
  __rvm_ruby_do
170
- done
170
+ done; unset current_set_ruby
171
171
 
172
172
  if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
173
173
  if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
@@ -23,6 +23,13 @@ usage() {
23
23
  "
24
24
  }
25
25
 
26
+ check_rubyopt_conditions() {
27
+ if [[ -n "$RUBYOPT" ]]; then
28
+ printf "\n\nWARNING: You have RUBYOPT set in your current environment. This may interfere with normal rvm"
29
+ printf "\n operation. If errors show up, please try unsetting RUBYOPT first.\n"
30
+ fi
31
+ }
32
+
26
33
  spinner_counter=0
27
34
  spinner() {
28
35
  array=('/' '-' '\\' '|' '/' '-' '\\' '|')
@@ -282,12 +289,14 @@ if [[ "$upgrade_flag" -eq 1 ]] ; then
282
289
  printf "\n * 1.8.7 default patchlevel is p174, override ~/.rvm/config/db in ~/.rvm/config/user"
283
290
  printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
284
291
  printf "\n$(tput sgr0)\n"
292
+ check_rubyopt_conditions
285
293
  printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
286
294
  else
287
295
  if [[ "root" != "$(whoami)" ]] ; then
288
296
  printf "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
289
297
  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:"
290
298
  printf "\n [[ -s \$HOME/.rvm/scripts/rvm ]] && source \$HOME/.rvm/scripts/rvm"
299
+ printf "\n Please note that this must only occur once - so, you only need to add it the first time you install rvm."
291
300
  printf "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
292
301
  printf "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:"
293
302
  printf "\n if [[ ! -z "$PS1" ]] ; then"
@@ -309,6 +318,7 @@ else
309
318
  printf "\nEven if you use zsh you should still adjust the .bashrc as above."
310
319
  printf "\nIf you have any questions about this please visit #rvm on irc.freenode.net.\n"
311
320
  fi
321
+ check_rubyopt_conditions
312
322
  printf "\nInstallation of RVM to $rvm_path/ is complete.\n\n"
313
323
  fi
314
324
 
@@ -63,6 +63,15 @@ __rvm_quote_args() {
63
63
  echo "$quoted_string" | sed -e 's/^ *//g' -e 's/ *$//g'
64
64
  }
65
65
 
66
+ __rvm_warn_on_rubyopt() {
67
+ if [[ -n "$RUBYOPT" ]]; then
68
+ $rvm_scripts_path/log "warn" "Please note: You have the RUBYOPT environment variable set and this may interfere with normal rvm operations. We sugges unsetting it."
69
+ return 1
70
+ else
71
+ return 0
72
+ fi
73
+ }
74
+
66
75
  __rvm_strings() {
67
76
  unset results
68
77
  for rvm_ruby_string in $(echo $rvm_ruby_args) ; do
@@ -169,6 +178,57 @@ __rvm_with_env() {
169
178
  unset rvm_env_args rvm_env_command
170
179
  }
171
180
 
181
+ # Returns the first 1.8.7-compatible (partly) ruby for use
182
+ # with things like rbx etc which require a ruby be installed.
183
+ __rvm_18_compat_ruby() {
184
+ rubies=""
185
+ for ruby_name in $(\ls $rvm_rubies_path); do
186
+ if [[ ! -L "$rvm_rubies_path/$ruby_name" ]] && $rvm_scripts_path/match "$ruby_name" '^(ruby-1.8.[[:digit:]]|rbx|ree)-'; then
187
+ rubies="$rubies $ruby_name"
188
+ fi
189
+ done; unset ruby_name
190
+ echo "$rubies" | sed 's/^ //' | tr ' ' '\n' | sort | tail -n1
191
+ unset rubies
192
+ }
193
+
194
+ __rvm_ensure_has_18_compat_ruby() {
195
+ if [[ -z "$(__rvm_18_compat_ruby)" ]]; then
196
+ # TODO: install currently doesn't return the correct status.
197
+ original_ruby="$(__rvm_environment_identifier)"
198
+ local compat_result=0
199
+ if ! $rvm_bin_path/rvm install 1.8.7; then
200
+ $rvm_scripts_path/log "fatal" "To proceed rvm requires a 1.8-compatible ruby is installed. We attempted to install 1.8.7 automatically but it failed."
201
+ $rvm_scripts_path/log "fatal" "Please install it manually (or a compatible alternative) to proceed."
202
+ compat_result=1
203
+ fi
204
+ __rvm_unset_ruby_variables
205
+ __rvm_become "$original_ruby"
206
+ unset original_ruby
207
+ return $compat_result
208
+ fi
209
+ }
210
+
211
+ __rvm_inherit_trace_flag() {
212
+ if [[ -n "$rvm_trace_flag" ]]; then
213
+ set -x
214
+ export rvm_trace_flag
215
+ fi
216
+ }
217
+
218
+ # Cleans up temp folders for a given prefix,
219
+ # typically the current process id.
220
+ __rvm_cleanup_temp_for() {
221
+ [[ -z "$1" ]] && return 1
222
+ if [[ -d "$rvm_tmp_path/" ]]; then
223
+ rm -rf "$rvm_tmp_path/$1"* >/dev/null 2>&1
224
+ fi
225
+ exit
226
+ }
227
+
228
+ __rvm_cleanup_temp_on_exit() {
229
+ trap "__rvm_cleanup_temp_for '$$'" 0 1 2 3 15
230
+ }
231
+
172
232
  __rvm_set_rvmrc() {
173
233
  if [[ "$HOME" != "$(pwd)" ]] ; then
174
234
  if [[ "$rvm_verbose_flag" -eq 1 ]] ; then flags="use " ; fi
@@ -246,16 +306,16 @@ __rvm_reset() {
246
306
  PATH="$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)"
247
307
  PATH="$rvm_bin_path:$PATH" ; export PATH
248
308
 
249
- for variable in RUBY_VERSION GEM_HOME BUNDLE_PATH MY_RUBY_HOME ; do unset $variable ; done
250
-
251
309
  for flag in default passenger editor ; do rm -f "$rvm_bin_path"/${flag}_* ; done
310
+ unset flag
252
311
 
253
312
  for file in system default ; do
254
- if [[ -f "$rvm_path/$file" ]] ; then rm -f $rvm_path/$file ; fi
255
- if [[ -f "$rvm_config_path/$file" ]] ; then rm -f $rvm_config_path/$file ; fi
256
- done
257
- rvm_ruby_interpreter="system"
258
- __rvm_select
313
+ rm -f "$rvm_path/$file" "$rvm_config_path/$file" "$rvm_environments_path/$file"
314
+ done; unset file
315
+
316
+ # Go back to a clean state.
317
+ __rvm_become "system"
318
+ __rvm_unset_ruby_variables
259
319
 
260
320
  for system_config in system_ruby system_gem_path system_user_gem_path ; do
261
321
  $rvm_scripts_path/db "$rvm_config_path/user" "$system_config" "delete"
@@ -316,7 +376,7 @@ __rvm_initialize() {
316
376
  # Update rubygems or binscripts based on CLI selection.
317
377
  __rvm_update() {
318
378
  __rvm_pushpop $rvm_path
319
- if [[ "head" = "$rvm_ruby_revision" ]] || [[ ! -z "$rvm_self_flag" ]] || [[ "update" = "$rvm_action" ]] || [[ ! -z "$rvm_update_flag" ]] ; then
379
+ if [[ "$rvm_head_flag" == "1" ]] || [[ ! -z "$rvm_self_flag" ]] || [[ "update" = "$rvm_action" ]] || [[ ! -z "$rvm_update_flag" ]] ; then
320
380
  __rvm_version
321
381
  __rvm_update_rvm
322
382
  fi
@@ -333,18 +393,18 @@ __rvm_update_rvm() {
333
393
  mkdir -p "$rvm_src_path"
334
394
  __rvm_pushpop "$rvm_src_path"
335
395
 
336
- if [[ "head" = "$rvm_ruby_revision" ]] || [[ -z "$system_ruby" ]] ; then
396
+ if [[ "$rvm_head_flag" == "1" ]] ; then
337
397
  if [[ -d "$rvm_src_path/rvm/.git" ]] ; then
338
398
  builtin cd $rvm_src_path/rvm/ && git pull origin master && ./scripts/install
339
399
  else
340
- builtin cd $rvm_src_path && git clone git://github.com/wayneeseguin/rvm.git && builtin cd rvm/ && ./install
400
+ builtin cd $rvm_src_path && git clone http://github.com/wayneeseguin/rvm.git && builtin cd rvm/ && ./scripts/install
341
401
  fi
342
402
  else
343
403
  stable_version=$(curl -s http://rvm.beginrescueend.com/releases/stable-version.txt)
344
404
 
345
405
  __rvm_run "fetch" "$rvm_scripts_path/fetch 'http://rvm.beginrescueend.com/releases/rvm-${stable_version}.tar.gz'" "fetching rvm-${stable_version}.tar.gz"
346
406
 
347
- __rvm_run "extract" "cat $rvm_archives_path/rvm-${stable_version}.tar.gz | gunzip | tar xf - -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
407
+ __rvm_run "extract" "cat $rvm_archives_path/rvm-${stable_version}.tar.gz | gunzip | tar xf - -C $rvm_src_path" "Extracting rvm-${stable_version}.tar.gz ..."
348
408
 
349
409
  __rvm_run "install" "builtin cd $rvm_src_path/rvm-${stable_version}/ ; ./install" "Installing rvm-${stable_version}..."
350
410
  fi
@@ -534,6 +594,14 @@ __rvm_gemset_select() {
534
594
 
535
595
  # Ensure that the ruby gem home exists.
536
596
  mkdir -p "$rvm_ruby_gem_home"
597
+ if [[ -n "$rvm_ruby_gem_home" ]] && echo "$rvm_ruby_gem_home" | grep -q 'rvm'; then
598
+ if __rvm_using_gemset_globalcache && [[ ! -L "$rvm_ruby_gem_home/cache" ]]; then
599
+ mv "$rvm_ruby_gem_home/cache/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
600
+ rm -rf "$rvm_ruby_gem_home/cache"
601
+ ln -nfs "$rvm_gems_cache_path" "$rvm_ruby_gem_home/cache"
602
+ fi
603
+ fi
604
+
537
605
  export rvm_ruby_gem_path rvm_ruby_gem_home
538
606
  }
539
607
 
@@ -640,6 +708,18 @@ __rvm_ensure_has_enviroment_files() {
640
708
  fi
641
709
  }
642
710
 
711
+ __rvm_using_gemset_globalcache() {
712
+ $rvm_scripts_path/db "$rvm_config_path/user" "use_gemset_globalcache" | grep -q '^true$'
713
+ }
714
+
715
+ __rvm_current_gemcache_dir() {
716
+ if __rvm_using_gemset_globalcache; then
717
+ echo "$rvm_gems_cache_path"
718
+ else
719
+ echo "${rvm_ruby_gem_home:-"$GEM_HOME"}/cache"
720
+ fi
721
+ }
722
+
643
723
  __rvm_Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything() {
644
724
  for index in {1..750} ; do perl -e 'sleep 0.2'; echo -n '.' ; done ; printf "%d" 0x2A ; echo
645
725
  }
@@ -4,13 +4,7 @@ default_flag="$rvm_default_flag"
4
4
  # Prevent it from recursing.
5
5
  unset rvm_default_flag rvm_wrapper_name
6
6
 
7
- source $rvm_scripts_path/initialize
8
- source $rvm_scripts_path/utility
9
- source $rvm_scripts_path/selector
10
-
11
- if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
12
-
13
- 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
7
+ source "$rvm_scripts_path/base"
14
8
 
15
9
  full_binary_name() {
16
10
  echo "$binary_name" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 85
4
+ hash: 75
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 39
10
- version: 0.1.39
9
+ - 40
10
+ version: 0.1.40
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wayne E. Seguin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-18 00:00:00 -04:00
18
+ date: 2010-06-22 00:00:00 -04:00
19
19
  default_executable: rvm-install
20
20
  dependencies: []
21
21
 
@@ -79,7 +79,9 @@ files:
79
79
  - scripts/alias
80
80
  - scripts/aliases
81
81
  - scripts/array
82
+ - scripts/base
82
83
  - scripts/cd
84
+ - scripts/cleanup
83
85
  - scripts/cli
84
86
  - scripts/color
85
87
  - scripts/completion