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/utility CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ # ZSH has 1 based array indexing, bash has 0 based.
4
+ if [[ ! -z "$ZSH_VERSION" ]] ; then __shell_array_start=1 ; else __shell_array_start=0 ; fi
5
+
3
6
  # Query the rvm key-value database for a specific key
4
7
  # Allow overrides from user specifications in $rvm_config_path/user
5
8
  __rvm_db() {
@@ -24,104 +27,10 @@ __rvm_db() {
24
27
 
25
28
  is_a_function() { type $1 | head -n 1 | grep -q "function" ; }
26
29
 
27
- # Ouput rvm environment information.
28
- __rvm_info() {
29
- if [[ ! -z "$rvm_ruby_args" ]] ; then
30
- cat < <(rvm_ruby_string="$rvm_ruby_args"; __rvm_select ; __rvm_use ; __rvm_environment_info; echo -e "$environment_info")
31
- else
32
- __rvm_environment_info
33
- echo -e "$environment_info"
34
- fi
35
- }
36
-
37
- __rvm_environment_info() {
38
- environment_info="" ; full_version=""
39
- ruby=$(command -v ruby)
40
- if [[ $? -eq 0 ]] && [[ -x "$ruby" ]] ; then full_version="$($ruby -v)" ; fi
41
-
42
- environment_info="$environment_info\nsystem:\n uname: \"$(uname -a)\""
43
-
44
- if [[ ! -z "$ZSH_VERSION" ]] ; then
45
- environment_info="$environment_info\n shell: \"zsh\"\n version: \"$ZSH_VERSION\""
46
- fi
47
- if [[ ! -z "$BASH_VERSION" ]] ; then
48
- environment_info="$environment_info\n shell: \"bash\"\n version: \"$BASH_VERSION\""
49
- fi
50
- environment_info="$environment_info\n\nrvm:"
51
- environment_info="$environment_info\n type: \"$(head -n 1 < <(type rvm))\""
52
- environment_info="$environment_info\n version: \"$(__rvm_version | tr "\n" ' ' | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//')\""
53
- environment_info="$environment_info\n\nruby:"
54
- environment_info="$environment_info\n interpreter: \"$(echo "${full_version}" | awk '{print $1}')\""
55
- environment_info="$environment_info\n version: \"$(echo "${full_version}" | awk '{print $2}')\""
56
- environment_info="$environment_info\n date: \"$(echo "${full_version}" | sed 's/^.*(\([0-9]\{4\}\(-[0-9][0-9]\)\{2\}\).*$/\1/')\""
57
- environment_info="$environment_info\n platform: \"$(echo "${full_version}" | sed 's/^.*\[//' | sed 's/\].*$//')\""
58
- environment_info="$environment_info\n patchlevel: \"$(echo "${full_version}" | sed 's/^.*(//' | sed 's/).*$//')\""
59
- environment_info="$environment_info\n full_version: \"${full_version}\""
60
- environment_info="$environment_info\n\nhomes:"
61
- environment_info="$environment_info\n gem: \"${GEM_HOME:-'not set'}\""
62
- environment_info="$environment_info\n ruby: \"${MY_RUBY_HOME:-'not set'}\""
63
- environment_info="$environment_info\n\nbinaries:"
64
- environment_info="$environment_info\n ruby: \"$(command -v ruby)\""
65
- environment_info="$environment_info\n irb: \"$(command -v irb)\""
66
- environment_info="$environment_info\n gem: \"$(command -v gem)\""
67
- environment_info="$environment_info\n rake: \"$(command -v rake)\""
68
- environment_info="$environment_info\n\nenvironment:"
69
- environment_info="$environment_info\n GEM_HOME: \"$GEM_HOME\""
70
- environment_info="$environment_info\n GEM_PATH: \"$GEM_PATH\""
71
- environment_info="$environment_info\n BUNDLE_PATH: \"$BUNDLE_PATH\""
72
- environment_info="$environment_info\n MY_RUBY_HOME: \"$MY_RUBY_HOME\""
73
- environment_info="$environment_info\n IRBRC: \"$IRBRC\""
74
- environment_info="$environment_info\n RUBYOPT: \"$RUBYOPT\""
75
- environment_info="$environment_info\n gemset: \"$(echo $GEM_HOME | awk -F${rvm_gemset_separator:-'@'} '{print $2}')\"\n"
76
- if [[ ! -z "$MAGLEV_HOME" ]] ; then
77
- environment_info="$environment_info\n MAGLEV_HOME: \"$MAGLEV_HOME\""
78
- fi
79
- unset full_version
80
- }
81
-
82
- # Output debugging information that has been found useful to help people identify and resolve issues.
83
- __rvm_debug() {
84
- __rvm_version
85
- __rvm_environment_info
86
- $rvm_scripts_path/log "debug" "PATH:\n$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"$5}')"
87
- $rvm_scripts_path/log "debug" "uname -a: $(uname -a)"
88
- $rvm_scripts_path/log "debug" "permissions: $(\ls -la $rvm_path{,/rubies})"
89
-
90
- if [[ "Darwin" = "$(uname)" ]] ; then
91
- $rvm_scripts_path/log "debug" "uname -r: $(uname -r)"
92
- $rvm_scripts_path/log "debug" "uname -m: $(uname -m)"
93
- $rvm_scripts_path/log "debug" "sw_vers: $(sw_vers | tr "\n" ',')"
94
- $rvm_scripts_path/log "debug" "ARCHFLAGS: $ARCHFLAGS"
95
- $rvm_scripts_path/log "debug" "LDFLAGS: $LDFLAGS"
96
- $rvm_scripts_path/log "debug" "CFLAGS: $CFLAGS"
97
- $rvm_scripts_path/log "debug" "/Developer/SDKs/*:$(/usr/bin/basename -a /Developer/SDKs/* | tr "\n" ',')"
98
- fi
99
-
100
- for file_name in $(echo $rc_files) ; do
101
- if [[ -s "$file_name" ]] ; then
102
- $rvm_scripts_path/log "debug" "$file_name:\n$(grep 'rvm' $file_name 2>/dev/null)"
103
- fi
104
- done
105
-
106
- if [[ "root" = "$(whoami)" ]] ; then
107
- debug_files="$rvm_config_path/default $rvm_config_path/system $rvm_config_path/db /etc/rvmrc /etc/gemrc"
108
- else
109
- debug_files="$rvm_config_path/default $rvm_config_path/system $rvm_config_path/db $HOME/.rvmrc $HOME/.gemrc"
110
- fi
111
-
112
- for file_name in $(echo $debug_files); do
113
- if [[ -f "$file_name" ]] && [[ -s "$file_name" ]] ; then
114
- $rvm_scripts_path/log "debug" "$file_name \(filtered\):\n$(cat $file_name | awk '!/assword|_key/')\n"
115
- fi
116
- done
117
-
118
- $rvm_scripts_path/log "debug" "gem sources:\n$(gem sources | awk '/gems/')"
119
- }
120
-
121
30
  __rvm_strings() {
122
31
  unset results
123
32
  for rvm_ruby_string in $(echo $rvm_ruby_args) ; do
124
- __rvm_ruby_string
33
+ #__rvm_ruby_string
125
34
  if [[ $? -gt 0 ]] ; then
126
35
  return 1
127
36
  else
@@ -133,9 +42,6 @@ __rvm_strings() {
133
42
  return 0
134
43
  }
135
44
 
136
- # ZSH has 1 based array indexing, bash has 0 based.
137
- if [[ ! -z "$ZSH_VERSION" ]] ; then __shell_array_start=1 ; else __shell_array_start=0 ; fi
138
-
139
45
  # Push an item onto a given array.
140
46
  __rvm_push() {
141
47
  array=$1 ; shift ; item=$2
@@ -185,12 +91,12 @@ __rvm_cleanup_variables() {
185
91
 
186
92
  if [[ "$rvm_sticky_flag" = "1" ]] ; then export rvm_gemset_name ; else unset rvm_gemset_name ; fi
187
93
 
188
- unset rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_url rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_ruby_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_ruby_patch rvm_sticky_flagrvm_rvmrc_flag rvm_gems_flag
94
+ unset rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_url rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_ruby_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_ruby_patch rvm_sticky_flagrvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag
189
95
  }
190
96
 
191
97
  # Unset ruby-specific variables
192
98
  __rvm_unset_ruby_variables() {
193
- unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_alias
99
+ unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_release_version rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_alias
194
100
  }
195
101
 
196
102
  __rvm_set_rvmrc() {
@@ -226,14 +132,14 @@ __rvm_load_rvmrc() {
226
132
  # Wrap the specified ruby code file in a Benchmark.bmbm block and execute it.
227
133
  __rvm_benchmark() {
228
134
  code="require \"benchmark\" \n Benchmark.bmbm do |benchmark| \n benchmark.report(\"${rvm_ruby_file}\") do \n"
229
- echo -e "$code" > "$rvm_tmp_path/$$.rb"
135
+ printf "\n$code" > "$rvm_tmp_path/$$.rb"
230
136
  unset code
231
137
  cat $rvm_ruby_file >> "$rvm_tmp_path/$$.rb"
232
- echo -e "\n end \nend\n" >> "$rvm_tmp_path/$$.rb"
138
+ printf "\n end \nend\n" >> "$rvm_tmp_path/$$.rb"
233
139
  rvm_ruby_args="$rvm_tmp_path/$$.rb"
234
140
  rvm_benchmark_flag=1
235
141
  rvm_action="ruby"
236
- if [[ ! -z "$rvm_debug_flag" ]] ; then echo -e "$rvm_tmp_path/$$.rb:\n$(cat $rvm_tmp_path/$$.rb)" ; fi
142
+ if [[ ! -z "$rvm_debug_flag" ]] ; then printf "\n$rvm_tmp_path/$$.rb:\n$(cat $rvm_tmp_path/$$.rb)" ; fi
237
143
  $rvm_scripts_path/set $rvm_action $rvm_ruby_args
238
144
  }
239
145
 
@@ -273,45 +179,6 @@ RubyWrapper
273
179
  chmod +x $rvm_bin_path/$rvm_ruby_package_name
274
180
  }
275
181
 
276
- # Load default ruby, if default is not set load system ruby.
277
- __rvm_load_defaults() {
278
- if [[ ! -s "$rvm_config_path/system" ]] && [[ "root" != "$(whoami)" ]] ; then
279
- for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME ; do
280
- eval value=\$${variable}
281
- if [[ -z "${value/ /}" ]] ; then
282
- echo "unset ${variable}" >> $rvm_config_path/system
283
- else
284
- eval "export $variable"
285
- eval value=\$${variable}
286
- echo "${variable}='$value' ; export ${variable}" >> $rvm_config_path/system
287
- fi
288
- done
289
- fi
290
-
291
- __rvm_db "system_ruby" "rvm_system_ruby"
292
- if [[ ! -z "$rvm_system_ruby" ]] ; then
293
- rvm_system_ruby=$(command -v ruby)
294
- if [[ $? -ne 0 ]] ; then
295
- $rvm_scripts_path/log "info" "System ruby not found, no system default will be stored."
296
- else
297
- $rvm_scripts_path/db "$rvm_config_path/user" "system_ruby" "$rvm_system_ruby"
298
- # Now store system system & user gem paths
299
- if [[ ! -z "$(command -v gem)" ]] ; then
300
- __rvm_db "system_user_gem_path" "rvm_system_user_gem_path"
301
- if [[ -z "$rvm_system_user_gem_path" ]] ; then
302
- rvm_system_user_gem_path=$( rvm system ; gem env gemdir user; )
303
- $rvm_scripts_path/db "$rvm_config_path/user" "system_user_gem_path" "$rvm_system_user_gem_path"
304
- fi
305
- __rvm_db "system_gem_path" "rvm_system_gem_path"
306
- if [[ -z "$rvm_system_gem_path" ]] ; then
307
- rvm_system_gem_path=$( rvm system ; gem env gemdir; )
308
- $rvm_scripts_path/db "$rvm_config_path/user" "system_gem_path" "$rvm_system_gem_path"
309
- fi
310
- fi
311
- fi
312
- fi
313
- }
314
-
315
182
  # Reset any rvm gathered information about the system and its state.
316
183
  # rvm will refresh the stored information the next time it is called after reset.
317
184
  __rvm_reset() {
@@ -371,110 +238,6 @@ __rvm_source_dir() {
371
238
  fi
372
239
  }
373
240
 
374
- # Query for valid rvm ruby strings
375
- # This is meant to be used with scripting.
376
- __rvm_list_strings() {
377
- echo $(\ls $rvm_rubies_path)
378
- }
379
-
380
- # List all rvm installed rubies, default ruby and system ruby.
381
- # Display the rubies, indicate their architecture and indicate which is currently used.
382
- # This is not meant to be used with scripting. This is for interactive mode usage only.
383
- __rvm_list() {
384
- action="$(echo $rvm_ruby_args | awk '{print $1}')"
385
-
386
- if [[ "known" = "$action" ]] ; then
387
- __rvm_list_known
388
- elif [[ "default" = "$action" ]] ; then
389
- __rvm_list_default
390
- elif [[ -z "$action" ]] || [[ "rubies" = "$action" ]] ; then
391
- __rvm_list_rubies
392
- elif [[ "strings" = "$action" ]] ; then
393
- __rvm_list_strings
394
- else # help
395
- echo -e "Usage: rvm list {known,default,rubies,strings}"
396
- fi
397
- }
398
-
399
- __rvm_list_default() {
400
- strings="$(echo $rvm_ruby_args | awk '{print $2}')"
401
- if [[ "$strings" = "string" ]] ; then
402
- echo $(grep 'MY_RUBY_HOME' $rvm_config_path/default | awk -F"'" '{print $2}' | xargs basename)
403
- else
404
- if [[ -f "$rvm_config_path/default" ]] && [[ -s $rvm_config_path/default ]] ; then
405
- version=$(grep 'MY_RUBY_HOME' $rvm_config_path/default | awk -F"'" '{print $2}' | xargs basename)
406
- if [[ ! -z "$version" ]] ; then
407
- echo -e "\nDefault Ruby (for new shells)\n"
408
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
409
- echo -e " $(tput setaf 2)$version$(tput sgr0) $string\n"
410
- fi ; unset version
411
- fi
412
- fi
413
- }
414
-
415
- __rvm_list_known() {
416
- while read -r tag
417
- do
418
- prefix="$(echo ${tag/\//} | sed 's#^v1_##' | awk -F'_' '{print "(ruby-)1."$1"."$2}' | sed 's#p$##')"
419
- echo "${prefix}-t${tag/\//}"
420
- unset prefix tag
421
- done < <(svn list http://svn.ruby-lang.org/repos/ruby/tags/ | awk '/^v1_[8|9]/')
422
- echo -e "(ruby-)1.8.6(-p399)\n(ruby-)1.8.6-head\n(ruby-)1.8.7(-p249)\n(ruby-)1.8.7-head\n(ruby-)1.9.1(-p243)\n(ruby-)1.9.1(-p376)\n(ruby-)1.9.1-head\n(ruby-)1.9.2-preview1\n(ruby-)1.9.2-head\nruby-head\n"
423
- echo -e "jruby-1.2.0\njruby-1.3.1\njruby-1.4.0\njruby(-1.5.0) # the default\njruby-head"
424
- echo -e "rbx(-prc5) # default\nrbx-head"
425
- echo -e "ree-1.8.6\nree(-1.8.7) # the default\nree-1.8.6-head\nree-1.8.7-head"
426
- echo -e "maglev(-23464)\nmaglev-head"
427
- echo -e "mput(-head) # shyouhei head, the default mput"
428
- echo -e "ironruby-0.9.3\nironruby-1.0-rc2\nironruby-head"
429
- if [[ "Darwin" = "$(uname)" ]] ; then
430
- echo -e "macruby(-nightly) # the default macruby\nmacruby-head # Build from the macruby git repository"
431
- fi
432
- }
433
-
434
- __rvm_list_rubies() {
435
- echo
436
- ruby=$(command -v ruby) ; current_ruby=""
437
- if [[ ! -z "$ruby" ]] && [[ ! -z "$(echo $ruby | awk '/rvm/')" ]] ; then
438
- current_ruby="$(echo $ruby | xargs dirname | xargs dirname | xargs basename 2> /dev/null)"
439
- fi
440
-
441
- echo -e "rvm Rubies\n"
442
- for version in $(\ls $rvm_rubies_path/ 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
443
- if [[ ! -z "$(echo $version | awk '/^jruby-/')" ]] ; then
444
- string="[ $($rvm_rubies_path/$version/bin/ruby -v | awk '{print $NF}') ]"
445
- elif [[ ! -z "$(echo $version | awk '/^maglev-|^macruby-/')" ]] ; then
446
- string="[ x86_64 ]"
447
- else
448
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
449
- fi
450
- if [[ "$version" = "$current_ruby" ]] ; then echo -n "=> " ; else echo -n " " ; fi
451
- echo -e "$(tput setaf 2)$version$(tput sgr0) $string"
452
- done ; unset version
453
-
454
- if [[ -f "$rvm_config_path/default" ]] && [[ -s $rvm_config_path/default ]] ; then
455
- version=$(grep 'MY_RUBY_HOME' $rvm_config_path/default | awk -F"'" '{print $2}' | xargs basename)
456
- if [[ ! -z "$version" ]] ; then
457
- echo -e "\nDefault Ruby (for new shells)\n"
458
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
459
- echo -e " $(tput setaf 2)$version$(tput sgr0) $string"
460
- fi ; unset version
461
- fi
462
-
463
- system_ruby="$(rvm system ; command -v ruby)"
464
- if [[ ! -z "$system_ruby" ]] && [[ -x "$system_ruby" ]] ; then
465
- echo -e "\nSystem Ruby\n"
466
- system_version=$($system_ruby -v)
467
- binary=$(\ls -l "$system_ruby" | awk '{print $NF}') # Account for symbolic links.
468
- string="[ $(file $binary | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
469
-
470
- if [[ ! -z "$system_ruby" ]] && [[ "$current_ruby" = "$system_version" ]] ; then echo -n "=> " ; else echo -n " " ; fi
471
- echo -e "$(tput setaf 2)system$(tput sgr0) $string"
472
- fi
473
-
474
- unset current_ruby version selected system_ruby system_version string binary
475
- echo
476
- }
477
-
478
241
  # Initialize rvm, ensuring that the path and directories are as expected.
479
242
  __rvm_initialize() {
480
243
  rvm_ruby_load_path="."
@@ -777,14 +540,52 @@ __rvm_mono_env() {
777
540
  PATH="$rvm_usr_path/bin:$PATH"
778
541
  }
779
542
 
543
+ __rvm_environment_identifier() {
544
+ rvm_environment_identifier="${rvm_ruby_string}"
545
+ if [[ -n "${rvm_gemset_name}" ]]; then
546
+ rvm_environment_identifier="${rvm_environment_identifier}${rvm_gemset_separator}${rvm_gemset_name}"
547
+ fi
548
+ echo "$rvm_environment_identifier"
549
+ unset rvm_environment_identifier
550
+ }
551
+
552
+ __rvm_ensure_has_enviroment_files() {
553
+ local environment_identifier="$(__rvm_environment_identifier)"
554
+ file_name="${rvm_environments_path}/$environment_identifier"
555
+ if [[ ! -s "$file_name" ]] ; then
556
+ mkdir -p "${rvm_environments_path}"
557
+ echo "export PATH=\"${rvm_ruby_gem_home}/bin:${rvm_ruby_global_gems_path}/bin:${rvm_ruby_home}/bin:${rvm_bin_path}:\$PATH\"" > $file_name
558
+ for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME IRBRC rvm_ruby_string rvm_gemset_name MAGLEV_HOME ; do
559
+ eval "export $variable"
560
+ eval value=\$${variable}
561
+ if [[ ! -z "$value" ]] ; then
562
+ echo "export ${variable}='$value'" >> $file_name
563
+ else
564
+ echo "unset ${variable}" >> $file_name
565
+ fi
566
+ done ; unset variable value
567
+ fi ; unset file_name
568
+ # Next, ensure we have default wrapper files. Also, prevent it from recursing.
569
+ if [[ -z "$rvm_creating_default_wrappers" ]]; then
570
+ rvm_creating_default_wrappers=1
571
+ directory_name="$rvm_wrappers_path/$environment_identifier"
572
+ if [[ ! -L "$directory_name" && ! -d "$directory_name" ]]; then
573
+ mkdir -p "$directory_name"
574
+ # Install the default wrappers.
575
+ $rvm_scripts_path/wrapper "$environment_identifier" &> /dev/null
576
+ fi
577
+ unset rvm_creating_default_wrappers directory_name
578
+ fi
579
+ }
580
+
780
581
  __rvm_Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything() {
781
582
  for index in {1..750} ; do perl -e 'sleep 0.2'; echo -n '.' ; done ; printf "%d" 0x2A ; echo
782
583
  }
783
584
 
784
585
  __rvm_ultimate_question() {
785
- echo "I do not know the Ultimate Question, "
786
- echo "however I can help you build a more "
787
- echo "powerful Ruby which can compute the "
788
- echo "Ultimate Question."
586
+ printf "\nI do not know the Ultimate Question, "
587
+ printf "\nhowever I can help you build a more "
588
+ printf "\npowerful Ruby which can compute the "
589
+ printf "\nUltimate Question."
789
590
  }
790
591
 
data/scripts/wrapper ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Recursive loops, oh my!
4
+ unset rvm_default_flag
5
+
6
+ source $rvm_scripts_path/initialize
7
+ source $rvm_scripts_path/utility
8
+ source $rvm_scripts_path/selector
9
+
10
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
11
+
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
+ wrap() {
15
+ mkdir -p "$(dirname "$file_name")"
16
+ printf "#!/usr/bin/env sh\n" > "$file_name"
17
+ printf ". \"${rvm_environments_path}/${environment_identifier}\"\n" >> "$file_name"
18
+ printf "exec $binary_name \"\$@\"\n" >> "$file_name"
19
+ if [[ -f $file_name ]] ; then chmod +x $file_name ; fi
20
+ }
21
+
22
+ usage() {
23
+ printf "Usage: 'rvm wrapper [ruby_string] [wrapper_prefix] [binary[ binary[ ...]]]'\n"
24
+ printf " Where binary defaults to ruby, gem, rake, irb, rdoc, ri, testrb\n"
25
+ printf " For more information, see 'rvm help wrapper'\n"
26
+ }
27
+
28
+ args="$*"
29
+ ruby_string="$(echo "$args" | awk '{print $1}')"
30
+ prefix="$(echo "$args" | awk '{print $2}')"
31
+ binaries=$(echo "$args" | awk '{$1="" ; $2=""; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
32
+
33
+ if [[ -z "$ruby_string" ]]; then
34
+ usage ; exit 1
35
+ fi
36
+
37
+ if [[ -z "$binaries" ]] ; then
38
+ # TODO: Extract out into a rvm_ variable.
39
+ binaries="ruby gem irb ri rdoc rake erb testrb"
40
+ fi
41
+
42
+ rvm_ruby_string="${ruby_string}"
43
+ __rvm_select &>/dev/null
44
+ __rvm_use &> /dev/null
45
+
46
+ environment_identifier="$(__rvm_environment_identifier)"
47
+
48
+ for binary_name in $(echo $binaries); do
49
+ if [[ -z "$prefix" ]] ; then
50
+ file_name="${rvm_wrappers_path}/${environment_identifier}/${binary_name}"
51
+ else
52
+ file_name="${rvm_bin_path}/${prefix}_${binary_name}"
53
+ fi
54
+
55
+ if command -v $binary_name > /dev/null; then
56
+ wrap
57
+ else
58
+ $rvm_scripts_path/log "error" "Binary '$binary_name' not found in path."
59
+ fi
60
+ unset file_name
61
+ done
62
+
63
+ unset rvm_ruby_string args ruby_string prefix binaries environment_identifier
64
+ __rvm_unset_ruby_variables
65
+
66
+ exit $?
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 89
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 32
9
- version: 0.1.32
9
+ - 33
10
+ version: 0.1.33
10
11
  platform: ruby
11
12
  authors:
12
13
  - Wayne E. Seguin
@@ -14,11 +15,11 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-16 00:00:00 -04:00
18
+ date: 2010-05-27 00:00:00 -04:00
18
19
  default_executable: rvm-install
19
20
  dependencies: []
20
21
 
21
- description: Manages Ruby Environments.
22
+ description: Manages Ruby interpreter environments and switching between them.
22
23
  email: wayneeseguin@gmail.com
23
24
  executables:
24
25
  - rvm-install
@@ -37,6 +38,34 @@ files:
37
38
  - config/db
38
39
  - config/md5
39
40
  - examples/rvmrc
41
+ - gemsets/default.gems
42
+ - gemsets/global.gems
43
+ - help/alias
44
+ - help/benchmark
45
+ - help/debug
46
+ - help/fetch
47
+ - help/gem
48
+ - help/gemdir
49
+ - help/gemset
50
+ - help/implode
51
+ - help/info
52
+ - help/install
53
+ - help/list
54
+ - help/monitor
55
+ - help/notes
56
+ - help/package
57
+ - help/rake
58
+ - help/remove
59
+ - help/reset
60
+ - help/ruby
61
+ - help/rvmrc
62
+ - help/specs
63
+ - help/srcdir
64
+ - help/tests
65
+ - help/uninstall
66
+ - help/update
67
+ - help/use
68
+ - help/wrapper
40
69
  - install
41
70
  - lib/VERSION.yml
42
71
  - lib/rvm.rb
@@ -45,6 +74,7 @@ files:
45
74
  - lib/rvm/shell.rb
46
75
  - lib/rvm/version.rb
47
76
  - rvm.gemspec
77
+ - scripts/alias
48
78
  - scripts/aliases
49
79
  - scripts/array
50
80
  - scripts/cd
@@ -52,14 +82,19 @@ files:
52
82
  - scripts/color
53
83
  - scripts/completion
54
84
  - scripts/db
85
+ - scripts/docs
86
+ - scripts/env
55
87
  - scripts/fetch
56
88
  - scripts/gemsets
57
89
  - scripts/hash
90
+ - scripts/help
58
91
  - scripts/hook
92
+ - scripts/info
59
93
  - scripts/initialize
60
94
  - scripts/install
61
95
  - scripts/irbrc
62
96
  - scripts/irbrc.rb
97
+ - scripts/list
63
98
  - scripts/log
64
99
  - scripts/maglev
65
100
  - scripts/manage
@@ -72,35 +107,10 @@ files:
72
107
  - scripts/rvm-install
73
108
  - scripts/selector
74
109
  - scripts/set
75
- - scripts/symlink
76
110
  - scripts/update
77
111
  - scripts/utility
78
112
  - scripts/version
79
- - help/alias
80
- - help/benchmark
81
- - help/debug
82
- - help/fetch
83
- - help/gem
84
- - help/gemdir
85
- - help/gemset
86
- - help/implode
87
- - help/info
88
- - help/install
89
- - help/list
90
- - help/monitor
91
- - help/notes
92
- - help/package
93
- - help/rake
94
- - help/remove
95
- - help/reset
96
- - help/ruby
97
- - help/rvmrc
98
- - help/specs
99
- - help/srcdir
100
- - help/tests
101
- - help/uninstall
102
- - help/update
103
- - help/use
113
+ - scripts/wrapper
104
114
  - bin/rvm-install
105
115
  has_rdoc: true
106
116
  homepage: http://github.com/wayneeseguin/rvm
@@ -127,6 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
137
  requirements:
128
138
  - - ">="
129
139
  - !ruby/object:Gem::Version
140
+ hash: 3
130
141
  segments:
131
142
  - 0
132
143
  version: "0"
@@ -135,6 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
146
  requirements:
136
147
  - - ">="
137
148
  - !ruby/object:Gem::Version
149
+ hash: 3
138
150
  segments:
139
151
  - 0
140
152
  version: "0"