rvm 0.0.42 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 42
4
+ :patch: 43
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rvm}
8
- s.version = "0.0.42"
8
+ s.version = "0.0.43"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wayne E. Seguin"]
12
- s.date = %q{2009-09-17}
12
+ s.date = %q{2009-09-18}
13
13
  s.default_executable = %q{rvm-install}
14
14
  s.description = %q{Manages Ruby interpreter installations and switching between them.}
15
15
  s.email = %q{wayneeseguin@gmail.com}
@@ -36,8 +36,8 @@ function __rvm_usage {
36
36
  uninstall - Uninstall a ruby version
37
37
  reset - Remove default and current settings, exit the shell.
38
38
  (If you experience odd behavior try this first)
39
- rubydo - Used with -f to run a ruby file against specified or all rubies
40
- gemdo - Used with -f to execute a command using selected ruby's 'gem'
39
+ rubydo - Used with -S to run a ruby file against specified or all rubies
40
+ gemdo - Used with -S to execute a command using selected ruby's 'gem'
41
41
  debug - Emit environment & configuration information for *current* ruby
42
42
 
43
43
  reload - Reload rvm source itself (useful after changing rvm source)
@@ -106,11 +106,7 @@ function __rvm_parse-args {
106
106
  while [ $# -gt 0 ] ; do
107
107
  rvm_token="$1" ; shift
108
108
  case "$rvm_token" in
109
- install|uninstall|remove|path|info|setup|version|srcdir|list|symlinks|reset|debug|reload|usage|help|implode|update|readline|iconv)
110
- rvm_action=$rvm_token
111
- ;;
112
-
113
- use)
109
+ install|uninstall|remove|path|info|setup|version|srcdir|list|symlinks|reset|debug|reload|usage|help|implode|update|readline|iconv|benchmark|bench|use)
114
110
  rvm_action=$rvm_token
115
111
  ;;
116
112
 
@@ -139,6 +135,8 @@ function __rvm_parse-args {
139
135
  rvm_ruby_interpreter="default"
140
136
  elif [ "$1" = "system" ] ; then
141
137
  rvm_ruby_interpreter=$1 ; shift
138
+ elif [ "$1" = "user" ] ; then
139
+ rvm_ruby_interpreter=$1 ; shift
142
140
  elif [ "$1" = "default" ] ; then
143
141
  rvm_ruby_interpreter=$1 ; shift
144
142
  else
@@ -262,7 +260,7 @@ function __rvm_parse-args {
262
260
 
263
261
  -f|--file)
264
262
  rvm_action="rubydo"
265
- rvm_ruby_args="$1"
263
+ rvm_ruby_file="$1"
266
264
  shift
267
265
  ;;
268
266
 
@@ -313,7 +311,7 @@ function __rvm_parse-args {
313
311
  --rm-gem-set) rvm_gem_set_name_rm="$1" ; shift ;;
314
312
  tests|specs) rvm_action="tests" ;;
315
313
 
316
- --self|--gem|--rubygems|--reconfigure|--default|--debug|debug|--force|--all|--dump|--summary|--jit|--latest)
314
+ --self|--gem|--rubygems|--reconfigure|--default|--debug|debug|--force|--all|--dump|--summary|--jit|--latest|--yaml|yaml|--json|json)
317
315
  eval "rvm_$(echo $rvm_token | sed 's/-//g')_flag=1"
318
316
  ;;
319
317
 
@@ -330,9 +328,10 @@ function __rvm_parse-args {
330
328
  rvm_action="rubydo" # Not sure if we really want to do this but we'll try it out.
331
329
  fi
332
330
  else
333
- echo $rvm_token | grep '\.rb$' > /dev/null
334
- if [ $? -eq 0 ] ; then # we have a specified ruby script
331
+
332
+ if [ ! -z "`echo $rvm_token | awk '/\.rb$/{print}' 2> /dev/null`" ] ; then # we have a specified ruby script
335
333
  rvm_ruby_args=$rvm_token
334
+ rvm_ruby_file=$rvm_token
336
335
  if [ -z "$rvm_action" ] ; then
337
336
  rvm_action="rubydo" # Not sure if we really want to do this but we'll try it out.
338
337
  fi
@@ -386,6 +385,7 @@ function rvm {
386
385
  iconv) __rvm_iconv_install ; result=$? ;;
387
386
  reboot) __rvm_reboot ; result=$? ;;
388
387
  usage|help) __rvm_usage ; result=$? ;;
388
+ bench|benchmark) __rvm_benchmark ; result=$? ;;
389
389
  rubydo|rakedo|gemdo) __rvm_do ; result=$? ;;
390
390
 
391
391
  tests|specs)
@@ -1,5 +1,5 @@
1
1
  #!/bin/bash
2
- if [ ! -z "$(echo `which ruby` | grep '\.rvm')" ] ; then
2
+ if [ ! -z "$(which ruby | awk '/\.rvm/{print}')" ] ; then
3
3
  echo "[$(which ruby | xargs dirname | xargs dirname | xargs basename | tr '-' ':')]"
4
4
  fi
5
5
 
@@ -204,7 +204,7 @@ function __rvm_install-ruby {
204
204
  __rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
205
205
  done
206
206
 
207
- __rvm_bin_script
207
+ __rvm_bin_scripts
208
208
 
209
209
  popd > /dev/null
210
210
  ;;
@@ -235,7 +235,26 @@ function __rvm_install-ruby {
235
235
  for binary in ruby irb ; do
236
236
  ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary
237
237
  done
238
- __rvm_bin_script
238
+ $rvm_ruby_home/bin/rbx -S gem install rake --no-rdoc --no-ri
239
+
240
+ ruby_wrapper=$(cat <<RubyWrapper
241
+ #!/bin/bash
242
+
243
+ GEM_HOME="$rvm_gem_home" ; export GEM_HOME
244
+ GEM_PATH="$rvm_gem_home" ; export GEM_PATH
245
+ MY_RUBY_HOME="$rvm_ruby_home" ; export MY_RUBY_HOME
246
+ PATH="$rvm_ruby_home/bin:$rvm_gem_home/bin:\$PATH" ; export PATH
247
+
248
+ exec $rvm_ruby_home/bin/rbx -S gem "\$@"
249
+ RubyWrapper
250
+ )
251
+ echo "$ruby_wrapper" > $rvm_bin_path/gem-$rvm_ruby_package_name
252
+ echo "$ruby_wrapper" > $rvm_ruby_home/bin/gem
253
+ unset ruby_wrapper
254
+ chmod +x $rvm_bin_path/$rvm_ruby_package_name
255
+ chmod +x $rvm_ruby_home/bin/gem
256
+
257
+ __rvm_bin_scripts
239
258
  ;;
240
259
 
241
260
  jruby)
@@ -279,7 +298,7 @@ function __rvm_install-ruby {
279
298
  ln -fs $rvm_ruby_home/bin/$binary $rvm_ruby_home/bin/${binary#j}
280
299
  done
281
300
 
282
- __rvm_bin_script
301
+ __rvm_bin_scripts
283
302
 
284
303
  ln -fs $rvm_ruby_home/bin/ruby $rvm_path/bin/$rvm_ruby_package_name
285
304
  for rvm_gem_name in rake jruby-openssl ; do
@@ -209,12 +209,11 @@ function __rvm_use {
209
209
  done
210
210
 
211
211
  if [ -s $rvm_path/bin/$rvm_ruby_package_name ] ; then
212
- ln -fs $rvm_path/bin/$rvm_ruby_package_name $rvm_path/bin/ruby
213
212
  ln -fs $rvm_path/bin/$rvm_ruby_package_name $rvm_path/bin/default-ruby # So that people know what it's for :)
214
- ln -fs $rvm_path/bin/gem-$rvm_ruby_package_name $rvm_path/bin/gem
215
- ln -fs $rvm_path/bin/irb-$rvm_ruby_package_name $rvm_path/bin/irb
213
+ ln -fs $rvm_path/bin/gem-$rvm_ruby_package_name $rvm_path/bin/default-gem
214
+ ln -fs $rvm_path/bin/irb-$rvm_ruby_package_name $rvm_path/bin/default-irb
216
215
  else
217
- rm -f $rvm_path/bin/ruby $rvm_path/bin/default-ruby $rvm_path/bin/gem $rvm_path/bin/irb
216
+ rm -f $rvm_path/bin/default*
218
217
  fi
219
218
  unset rvm_default_flag
220
219
  fi
@@ -175,7 +175,7 @@ function __rvm_load-defaults {
175
175
  fi
176
176
 
177
177
  rvm_system_ruby=`__rvm_db "system_ruby"`
178
- if [ -z "$rvm_system_ruby" ] ; then
178
+ if [ ! -z "$rvm_system_ruby" ] ; then
179
179
  rvm_system_ruby=`which ruby`
180
180
  if [ $? -ne 0 ] ; then
181
181
  __rvm_log "info" "System ruby not found, no db will be stored."
@@ -185,12 +185,12 @@ function __rvm_load-defaults {
185
185
  # Now store system system & user gem paths
186
186
  rvm_system_user_gem_path=`__rvm_db "system_user_gem_path"`
187
187
  if [ -z "$rvm_system_user_gem_path" ] ; then
188
- rvm_system_user_gem_path=`ruby -r rubygems -e "puts Gem::default_path.compact.first"`
188
+ rvm_system_user_gem_path=$( rvm system ; gem env gemdir user; )
189
189
  __rvm_db "system_user_gem_path" "$rvm_system_user_gem_path"
190
190
  fi
191
191
  rvm_system_gem_path=`__rvm_db "system_gem_path"`
192
192
  if [ -z "$rvm_system_gem_path" ] ; then
193
- rvm_system_gem_path=`ruby -r rubygems -e "puts Gem::default_path.compact[1] || Gem::default_path.compact.first"`
193
+ rvm_system_gem_path=$( rvm system ; gem env gemdir; )
194
194
  __rvm_db "system_gem_path" "$rvm_system_gem_path"
195
195
  fi
196
196
  fi
@@ -212,6 +212,8 @@ function __rvm_reset {
212
212
  __rvm_db "$system_config" "delete"
213
213
  done ; unset system_config variable
214
214
 
215
+ rm -f $rvm_path/bin/ruby $rvm_path/bin/gem $rvm_path/bin/rake $rvm_path/bin/irb $rvm_path/bin/default*
216
+
215
217
  }
216
218
 
217
219
  function __rvm_implode {
@@ -258,13 +260,17 @@ function __rvm_src-dir {
258
260
 
259
261
  # clones from source implementation/version to default
260
262
  function __rvm_gem-dup {
261
-
262
- if [ "$1" = "default" ] ; then
263
+ __rvm_log "debug" "$rvm_ruby_interpreter"
264
+ if [ "$rvm_ruby_interpreter" = "default" ] ; then
265
+ # TODO: ~/.rvm/default first, then system user
263
266
  rvm_source_gem_dir="$rvm_system_user_gem_path"
264
- elif [ "$1" = "system" ] ; then
267
+ elif [ "$rvm_ruby_interpreter" = "user" ] ; then
268
+ rvm_source_gem_dir="$rvm_system_user_gem_path"
269
+ elif [ "$rvm_ruby_interpreter" = "system" ] ; then
265
270
  rvm_source_gem_dir="$rvm_system_gem_path"
266
271
  else
267
- rvm_source_gem_dir=${1:-$rvm_system_user_gem_path} # TODO: check for and remove trailing /gems
272
+ # TODO: use selector for this?
273
+ rvm_source_gem_dir=${rvm_gem_home/$rvm_ruby_interpreter/$rvm_ruby_version}
268
274
  fi
269
275
 
270
276
  if [ ! -z "$rvm_source_gem_dir" ] ; then
@@ -281,7 +287,6 @@ function __rvm_gem-dup {
281
287
  else
282
288
  __rvm_log "fail" "Unknown $rvm_ruby_interpreter version: $rvm_ruby_version"
283
289
  fi
284
-
285
290
  }
286
291
 
287
292
  function __rvm_db {
@@ -530,8 +535,8 @@ function __rvm_ruby_do {
530
535
  else
531
536
  eval "errors=(${errors[*]} $rvm_ruby_string)"
532
537
  fi
533
- eval "all=(${all[*]} $rvm_ruby_string)"
534
- eval "results=(${results[*]} $result)"
538
+ eval "rubies=(${rubies[*]} $rvm_ruby_string)"
539
+ eval "statuses=(${statuses[*]} $result)"
535
540
  # TODO: keep track of and re-set the previous selected ruby ;)
536
541
  else
537
542
  __rvm_log "warn" "'$rvm_ruby_home/bin/$binary' either does not exist or is not executable? :("
@@ -540,7 +545,7 @@ function __rvm_ruby_do {
540
545
  }
541
546
 
542
547
  function __rvm_do {
543
- all=() ; successes=() ; errors=() ; results=()
548
+ rubies=() ; successes=() ; errors=() ; statuses=()
544
549
  # TODO: Extract the common functionality out of the if below
545
550
  if [ ! -z "$rvm_ruby_version" ] ; then
546
551
  for rvm_ruby_selector in `echo $rvm_ruby_version | tr ',' ' '` ; do
@@ -566,19 +571,78 @@ function __rvm_do {
566
571
  fi
567
572
 
568
573
  if [ ! -z "$rvm_summary_flag" ] ; then
569
- export successes errors results
574
+ export successes errors statuses
570
575
  echo -e "\nSummary:"
571
576
  echo -e "\033[0;32msuccessful (${#successes[*]}) : [ $(echo "${successes[*]}" | sed 's/ /, /g') ]\033[0m"
572
577
  echo -e "\033[0;31merrors (${#errors[*]}) : [ $(echo "${errors[*]}" | sed 's/ /, /g') ]\033[0m"
573
- echo -e "all (${#all[*]}) : [ $(echo "${all[*]}" | sed 's/ /, /g') ]"
574
- echo -e "exit results: [ $(echo "${results[*]}" | sed 's/ /, /g') ]\n"
578
+ echo -e "rubies (${#rubies[*]}) : [ $(echo "${rubies[*]}" | sed 's/ /, /g') ]"
579
+ echo -e "statuses: [ $(echo "${statuses[*]}" | sed 's/ /, /g') ]\n"
580
+ fi
581
+
582
+ if [ ! -z "$rvm_yaml_flag" ] ; then
583
+ export successes errors statuses
584
+ echo -e "\nYAML:"
585
+ echo -e " totals:"
586
+ echo -e " rubies: ${#rubies[*]}"
587
+ echo -e " successes: ${#successes[*]}"
588
+ echo -e " errors: ${#errors[*]}"
589
+ echo -e " successes:"
590
+ for var in ${successes[*]} ; do
591
+ echo -e " - $var"
592
+ done
593
+ echo -e " errors:"
594
+ for var in ${errors[*]} ; do
595
+ echo -e " - $var"
596
+ done
597
+ echo -e " rubies:"
598
+ for var in ${rubies[*]} ; do
599
+ echo -e " - $var"
600
+ done
601
+ echo -e " statuses:"
602
+ for var in ${statuses[*]} ; do
603
+ echo -e " - $var"
604
+ done
605
+ fi
606
+
607
+ if [ ! -z "$rvm_json_flag" ] ; then
608
+ summary=$(cat <<-Summary
609
+ \nSummary:
610
+ JSON:
611
+ {
612
+ "totals": { "rubies": ${#rubies[*]}, "successes": ${#successes[*]}, "errors": ${#errors[*]}},
613
+ "successful": [ "$(echo ${successes[*]} | sed 's/ /", "/g')" ],
614
+ "errors": [ "$(echo ${errors[*]} | sed 's/ /", "/g')" ],
615
+ "rubies": [ "$(echo ${rubies[*]} | sed 's/ /", "/g')" ],
616
+ "statuses": [ $(echo ${statuses[*]} | sed 's/ /, /g') ]
617
+ }
618
+ Summary
619
+ )
620
+ echo -e "$summary"
575
621
  else
576
- unset bin_line rvm_summary_flag
577
- # successes errors
622
+ unset bin_line rvm_summary_flag
578
623
  fi
579
624
  return ${#errors[*]}
580
625
  }
581
626
 
627
+ function __rvm_benchmark {
628
+ rvm_code="$(cat <<RubyCode
629
+ #!/usr/bin/env ruby
630
+ require "benchmark"
631
+ Benchmark.bmbm do|benchmark|
632
+ benchmark.report("benchmarking '$rvm_ruby_file'") do
633
+
634
+ RubyCode
635
+ )"
636
+ echo "$rvm_code" > /tmp/$$.rb
637
+ cat $rvm_ruby_file >> /tmp/$$.rb
638
+ echo -e "\n end\nend\n" >> /tmp/$$.rb
639
+ unset rvm_code
640
+ rvm_ruby_args="/tmp/$$.rb"
641
+ rvm_action="rubydo"
642
+ if [ ! -z "$rvm_debug_flag" ] ; then echo -e "/tmp/$$.rb:\n$(cat /tmp/$$.rb)" ; fi
643
+ __rvm_do
644
+ }
645
+
582
646
  function __rvm_ruby_string {
583
647
  if [ "$rvm_ruby_interpreter" = "system" ] ; then
584
648
  rvm_ruby_string="system"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.42
4
+ version: 0.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne E. Seguin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-17 00:00:00 -04:00
12
+ date: 2009-09-18 00:00:00 -04:00
13
13
  default_executable: rvm-install
14
14
  dependencies: []
15
15