rvm 0.0.47 → 0.0.48

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 47
4
+ :patch: 48
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rvm}
8
- s.version = "0.0.47"
8
+ s.version = "0.0.48"
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-22}
12
+ s.date = %q{2009-09-23}
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}
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "scripts/rvm",
31
31
  "scripts/rvm-aliases",
32
32
  "scripts/rvm-cli",
33
+ "scripts/rvm-completion",
33
34
  "scripts/rvm-functions",
34
35
  "scripts/rvm-install",
35
36
  "scripts/rvm-prompt",
@@ -1,4 +1,4 @@
1
- alias rubydo="rvm rubydo"
2
- alias multiruby="rvm rubydo"
3
- alias gemdo="rvm gemdo"
4
- alias rakedo="rvm rakedo"
1
+ alias rubydo="rvm ruby"
2
+ alias gemdo="rvm gem"
3
+ alias rakedo="rvm rake"
4
+ alias multiruby="rvm ruby"
@@ -14,99 +14,100 @@ function __rvm_usage {
14
14
 
15
15
  __rvm_meta
16
16
 
17
- cat <<-Usage
18
-
17
+ echo -e "
19
18
  rvm ${rvm_meta_version} ${rvm_meta_website} by ${rvm_meta_author} (${rvm_meta_author_email})
20
19
 
21
- Usage:
22
-
23
- rvm Action [Implementation] [Options] [Flags]
24
-
25
- Action:
26
-
27
- * usage - Show this usage information
28
- use - Switch to using a specific ruby version (new login shell)
29
- info - Show information for current ruby
30
- list - Show currently installed versions
31
- gemdir - Switch to gem directory for installation (new login shell)
32
- srcdir - Switch to src directory for the current ruby installation
33
- gemdup - Clone source version gems to current version
34
- (highly expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
35
- install - Install a ruby version, default is from source
36
- uninstall - Uninstall a ruby version
37
- reset - Remove default and current settings, exit the shell.
38
- (If you experience odd behavior try this first)
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
- debug - Emit environment & configuration information for *current* ruby
42
-
43
- reload - Reload rvm source itself (useful after changing rvm source)
44
- implode - Removes all ruby installations it manages, everything in ~/.rvm
45
- update - Upgrades rvm to the latest version.
46
- tests - run 'rake test' across selected ruby versions
47
- specs - run 'rake spec' across selected ruby versions
48
-
49
- Implementation:
50
-
51
- * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6
52
- jruby - jRuby
53
- rubinius - Rubinius
54
- ree - Ruby Enterprise Edition
55
- system - Use the system ruby (eg. pre-rvm state)
56
- default - Use rvm set default ruby and system if it hasn't been set.
57
-
58
- Options:
59
-
60
- -v|--version - Emit rvm version loaded for current shell
61
- -h|--help - Emit this output and exit
62
- -l|--level - patch level to use with rvm use / install
63
- --tag - subersion tag to use
64
- --rev - repository revision # to use or 'head' for
65
-
66
- --prefix - path for all rvm files (~/.rvm/), with trailing slash!
67
- --bin - path for binaries to be placed (~/.rvm/bin/)
68
- --source - src directory to use (~/.rvm/src/)
69
- --archives - directory for downladed files (~/.rvm/archives/)
70
- -S|--script - Specify a script file to attempt to load and run (rubydo)
71
- -G|--gems - root gem path to use
72
- -C|--configure - custom configure options, comma separated
73
- default: --enable-shared=true
74
- --reconfigure - Force installer to re-run configure if already run
75
- --make - custom make command
76
- --make-install - custom make install command
77
- --nice - process niceness (for slow computers, default 0)
78
- -m|--gem-set - use a named gem set, instead of the default set.
79
- --rm-gem-set - Remove a named gem set
80
-
81
- Flags
82
-
83
- --self - with update, updates rvm itself
84
- --rubygems - with update, updates rubygems for selected ruby
85
- --default - with ruby select, sets a default ruby for new shells.
86
- --debug - Toggle debug mode on for very verbose output.
87
- --force - Force install, removes old install & source before install.
88
- --all - Used with 'rvm list' to display "most" available versions.
89
- --dump - Used with gemset to dump the current ruby's gemset.
90
- --load - Used with gemset to load a specified gemset file
91
- --summary - Used with rubydo to print out a summary of the commands run.
92
- --jit - Used with rubinius install to build with JIT
93
- --latest - with gemset --dump skips version strings for latest gem.
94
- --reconfigure - Force ./configure on install even if Makefile already exists.
95
-
96
- Resources:
97
-
98
- http://rvm.beginrescueend.com/
99
- https://www.pivotaltracker.com/projects/26822
100
-
101
20
  Usage
102
21
 
22
+ rvm Action [Implementation] [Flags] [Options]
23
+
24
+ Action
25
+
26
+ * usage - show this usage information
27
+ use - setup current shell to use a specific ruby version
28
+ info - show information for current ruby
29
+ list - show currently installed versions
30
+ reload - reload rvm source itself (useful after changing rvm source)
31
+ implode - removes all ruby installations it manages, everything in ~/.rvm
32
+ update - upgrades rvm to the latest version.
33
+ reset - remove default and current settings, exit the shell.
34
+ (If you experience odd behavior try this first)
35
+ debug - emit environment & configuration information for *current* ruby
36
+
37
+ install - install one or many ruby versions
38
+ uninstall - uninstall one or many ruby versions, leaves their sources
39
+ remove - uninstall one or many ruby versions and remove their sources
40
+
41
+ ruby - runs a named ruby file against specified and/or all rubies
42
+ gem - runs a gem command using selected ruby's 'gem'
43
+ rake - runs a rake task against specified and/or all rubies
44
+ tests - runs 'rake test' across selected ruby versions
45
+ specs - runs 'rake spec' across selected ruby versions
46
+
47
+ gemsync - sync gems from a specified version to current version
48
+ gemdir - switch to gem directory for installation (new login shell)
49
+ srcdir - switch to src directory for the current ruby installation
50
+
51
+ Implementation
52
+
53
+ * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6
54
+ jruby - jRuby
55
+ rbx - rubinius
56
+ ree - ruby Enterprise Edition
57
+ system - use the system ruby (eg. pre-rvm state)
58
+ default - use rvm set default ruby and system if it hasn't been set.
59
+
60
+ Flags
61
+
62
+ --self - with update, updates rvm itself
63
+ --rubygems - with update, updates rubygems for selected ruby
64
+ --default - with ruby select, sets a default ruby for new shells.
65
+ --debug - Toggle debug mode on for very verbose output.
66
+ --force - Force install, removes old install & source before install.
67
+ --all - Used with 'rvm list' to display 'most' available versions.
68
+ --dump - Used with gemset to dump the current ruby's gemset.
69
+ --load - Used with gemset to load a specified gemset file
70
+ --summary - Used with rubydo to print out a summary of the commands run.
71
+ --jit - Used with rubinius install to build with JIT
72
+ --latest - with gemset --dump skips version strings for latest gem.
73
+ --reconfigure - Force ./configure on install even if Makefile already exists.
74
+
75
+ Options
76
+
77
+ -v|--version - Emit rvm version loaded for current shell
78
+ -h|--help - Emit this output and exit
79
+ -l|--level - patch level to use with rvm use / install
80
+ --tag - subersion tag to use
81
+ --rev - repository revision # to use or 'head' for
82
+
83
+ --prefix - path for all rvm files (~/.rvm/), with trailing slash!
84
+ --bin - path for binaries to be placed (~/.rvm/bin/)
85
+ --source - src directory to use (~/.rvm/src/)
86
+ --archives - directory for downladed files (~/.rvm/archives/)
87
+ -S|--script - Specify a script file to attempt to load and run (rubydo)
88
+ -G|--gems - root gem path to use
89
+ -C|--configure - custom configure options, comma separated
90
+ default: --enable-shared=true
91
+ --reconfigure - Force installer to re-run configure if already run
92
+ --make - custom make command
93
+ --make-install - custom make install command
94
+ --nice - process niceness (for slow computers, default 0)
95
+ -m|--gem-set - use a named gem set, instead of the default set.
96
+ --rm-gem-set - Remove a named gem set
97
+
98
+ Resources:
99
+
100
+ http://rvm.beginrescueend.com/
101
+ https://www.pivotaltracker.com/projects/26822
102
+
103
+ " | ${PAGER:-/usr/bin/less}
103
104
  }
104
105
 
105
106
  function __rvm_parse-args {
106
107
  while [ $# -gt 0 ] ; do
107
108
  rvm_token="$1" ; shift
108
109
  case "$rvm_token" in
109
- install|uninstall|path|info|setup|version|srcdir|list|reset|debug|reload|usage|help|implode|update|readline|iconv|benchmark|bench|use|gemsync)
110
+ install|uninstall|path|info|setup|version|srcdir|list|reset|debug|reload|implode|update|readline|iconv|use|gemsync)
110
111
  rvm_action=$rvm_token
111
112
  ;;
112
113
 
@@ -149,26 +150,42 @@ function __rvm_parse-args {
149
150
  fi
150
151
  ;;
151
152
 
152
- do|rubydo|rakedo|gemdo)
153
- rvm_action=$rvm_token
154
- if [ "$rvm_action" = "do" ] ; then rvm_action="rubydo" ; fi
155
- temp=$(echo $1 | awk '{print substr($1, 0, 1)}')
156
- if [ "$temp" = "-" ] ; then
157
- unset rvm_ruby_version
153
+ do|ruby|rake|gem|rubydo|rakedo|gemdo)
154
+ if [ "$rvm_action" = "do" ] ; then rvm_action="ruby" ; fi
155
+ rvm_action=$(echo $rvm_token | sed 's/do//g')
156
+
157
+ if [ "$rvm_action" = "rake" -o "$rvm_action" = "gem" ] ; then
158
+ rvm_action="ruby"
159
+ rvm_ruby_args="$rvm_token $@"
160
+ rvm_parse_break=1
158
161
  else
159
- if [ ! -z "$(echo $temp | grep '[0-9]')" ] ; then
160
- rvm_ruby_version=$(echo "$1" | tr ',' ' ') ; shift
161
- unset rvm_ruby_interpreter
162
+ if [ ! -z "$(echo $1 | awk '/^-/')" ] ; then
163
+ unset rvm_ruby_version
162
164
  else
163
- if [ "$1" = "jruby" -o "$1" = "rbx" -o "$1" = "rubinius" -o "$1" = "macruby" ] ; then
164
- rvm_ruby_interpreter=$1 ; shift
165
+ if [ ! -z "$(echo $1 | awk '/^[0-9]/')" ] ; then
166
+ rvm_ruby_version=$(echo "$1" | tr ',' ' ') ; shift
167
+ unset rvm_ruby_interpreter
165
168
  else
166
- unset rvm_ruby_interpreter rvm_ruby_version
169
+ if [ "$1" = "jruby" -o "$1" = "rbx" -o "$1" = "rubinius" -o "$1" = "macruby" -o "$1" = "ree" -o "$1" = "ruby-enterprise" ] ; then
170
+ rvm_ruby_interpreter=$1 ; shift
171
+ else
172
+ unset rvm_ruby_interpreter rvm_ruby_version
173
+ fi
167
174
  fi
168
175
  fi
169
176
  fi
170
177
  ;;
171
178
 
179
+ benchmark|bench)
180
+ rvm_action="benchmark"
181
+ ;;
182
+
183
+ specs|tests)
184
+ rvm_action="do"
185
+ rvm_ruby_args="rake $rvm_token"
186
+ ;;
187
+
188
+
172
189
  1.8|1.8.0|1.8.1|1.8.2|1.8.3|1.8.4|1.8.5|1.8.6|1.8.7|1.9|1.9.1|1.9.2)
173
190
  rvm_ruby_interpreter="ruby"
174
191
  rvm_ruby_version="$rvm_token"
@@ -263,24 +280,13 @@ function __rvm_parse-args {
263
280
  ;;
264
281
 
265
282
  -f|--file)
266
- rvm_action="rubydo"
283
+ rvm_action="ruby"
267
284
  rvm_ruby_file="$1"
268
285
  shift
269
286
  ;;
270
287
 
271
- specs|tests)
272
- rvm_action="rubydo"
273
- rvm_ruby_args="rake $rvm_token"
274
- ;;
275
-
276
- rake|gem)
277
- rvm_action="rubydo"
278
- rvm_ruby_args="$rvm_token $@"
279
- rvm_parse_break=1
280
- ;;
281
-
282
288
  -S|--script|-e|--execute)
283
- rvm_action="rubydo"
289
+ rvm_action="ruby"
284
290
  rvm_ruby_args="$@"
285
291
  rvm_parse_break=1
286
292
  ;;
@@ -302,19 +308,19 @@ function __rvm_parse-args {
302
308
  rvm_ruby_interpreter="system"
303
309
  ;;
304
310
 
305
- --install) rvm_install_on_use_flag=1 ;;
306
- --prefix) rvm_prefix_path="$1" ; shift ;;
307
- -G|--gems) rvm_gem_path="$1" ; shift ;;
308
- --source) rvm_source_path="$1" ; shift ;;
309
- --archives) rvm_archives_path="$1" ; shift ;;
310
- --make) rvm_ruby_make="$1" ; shift ;;
311
- --make-install) rvm_ruby_make_install="$1"; shift ;;
312
- --nice) rvm_niceness="$1" ; shift ;;
313
- -l|--level) rvm_ruby_patch_level="$1" ; shift ;;
314
- -h|--help) rvm_action=help ; shift ;;
315
- -m|--gem-set) rvm_gem_set_name="$1" ; shift ;;
316
- --rm-gem-set) rvm_gem_set_name_rm="$1" ; shift ;;
317
- tests|specs) rvm_action="tests" ;;
311
+ --install) rvm_install_on_use_flag=1 ;;
312
+ --prefix) rvm_prefix_path="$1" ; shift ;;
313
+ -G|--gems) rvm_gem_path="$1" ; shift ;;
314
+ --source) rvm_source_path="$1" ; shift ;;
315
+ --archives) rvm_archives_path="$1" ; shift ;;
316
+ --make) rvm_ruby_make="$1" ; shift ;;
317
+ --make-install) rvm_ruby_make_install="$1"; shift ;;
318
+ --nice) rvm_niceness="$1" ; shift ;;
319
+ -l|--level) rvm_ruby_patch_level="$1" ; shift ;;
320
+ -h|--help|usage|help) rvm_action=help ; shift ;;
321
+ -m|--gem-set) rvm_gem_set_name="$1" ; shift ;;
322
+ --rm-gem-set) rvm_gem_set_name_rm="$1" ; shift ;;
323
+ tests|specs) rvm_action="tests" ;;
318
324
 
319
325
  --self|--gem|--rubygems|--reconfigure|--default|--debug|debug|--force|--all|--dump|--summary|--jit|--latest|--yaml|yaml|--json|json)
320
326
  eval "rvm_$(echo $rvm_token | sed 's/-//g')_flag=1"
@@ -326,11 +332,10 @@ function __rvm_parse-args {
326
332
 
327
333
  *)
328
334
  if [ ! -z "$rvm_token" ] ; then
329
- echo "$rvm_token" | grep ',' > /dev/null
330
- if [ $? -eq 0 ] ; then
335
+ if [ ! -z "`echo $rvm_token | awk '/,/'`" ] ; then
331
336
  rvm_ruby_version="$rvm_token"
332
337
  if [ -z "$rvm_action" ] ; then
333
- rvm_action="rubydo" # Not sure if we really want to do this but we'll try it out.
338
+ rvm_action="ruby" # Not sure if we really want to do this but we'll try it out.
334
339
  fi
335
340
  else
336
341
 
@@ -338,7 +343,7 @@ function __rvm_parse-args {
338
343
  rvm_ruby_args=$rvm_token
339
344
  rvm_ruby_file=$rvm_token
340
345
  if [ -z "$rvm_action" ] ; then
341
- rvm_action="rubydo" # Not sure if we really want to do this but we'll try it out.
346
+ rvm_action="ruby" # Not sure if we really want to do this but we'll try it out.
342
347
  fi
343
348
  else
344
349
  rvm_action="error"
@@ -371,13 +376,10 @@ function rvm {
371
376
  if [ -z "$rvm_debug_flag" ] ; then set +x ; else set -x ; fi
372
377
  result=0
373
378
  case "$rvm_action" in
374
- install) __rvm_install ; result=$? ;;
375
- uninstall) __rvm_uninstall ; result=$? ;;
376
- remove) __rvm_remove ; result=$? ;;
377
379
  use) __rvm_use ; result=$? ;;
378
380
  gemdir) __rvm_gem-dir ; result=$? ;;
379
- srcdir) __rvm_src-dir ; result=$? ;;
380
381
  gemdup) __rvm_gem-dup ; result=$? ;;
382
+ srcdir) __rvm_src-dir ; result=$? ;;
381
383
  list) __rvm_list ; result=$? ;;
382
384
  version) __rvm_version ; result=$? ;;
383
385
  reset) __rvm_reset ; result=$? ;;
@@ -389,8 +391,13 @@ function rvm {
389
391
  iconv) __rvm_iconv_install ; result=$? ;;
390
392
  reboot) __rvm_reboot ; result=$? ;;
391
393
  usage|help) __rvm_usage ; result=$? ;;
392
- bench|benchmark) __rvm_benchmark ; result=$? ;;
393
- rubydo|rakedo|gemdo) __rvm_do ; result=$? ;;
394
+ benchmark) __rvm_benchmark ; result=$? ;;
395
+ ruby) __rvm_do ; result=$? ;;
396
+
397
+ install|uninstall|remove)
398
+ __rvm_manage_rubies
399
+ result=$?
400
+ ;;
394
401
 
395
402
  gemsync)
396
403
  result=0
@@ -0,0 +1,213 @@
1
+ #!/bin/bash
2
+
3
+ complete -o default -o nospace -F _rvm rvm
4
+
5
+ _rvm ()
6
+ {
7
+ local i c=1 command __git_dir
8
+
9
+ while [ $c -lt $COMP_CWORD ]; do
10
+ i="${COMP_WORDS[c]}"
11
+ case "$i" in
12
+ --git-dir=*) __git_dir="${i#--git-dir=}" ;;
13
+ --bare) __git_dir="." ;;
14
+ --version|-p|--paginate) ;;
15
+ --help) command="help"; break ;;
16
+ *) command="$i"; break ;;
17
+ esac
18
+ c=$((++c))
19
+ done
20
+
21
+ if [ -z "$command" ]; then
22
+ case "${COMP_WORDS[COMP_CWORD]}" in
23
+ --*) __gitcomp "
24
+ --paginate
25
+ --no-pager
26
+ --git-dir=
27
+ --bare
28
+ --version
29
+ --exec-path
30
+ --html-path
31
+ --work-tree=
32
+ --help
33
+ "
34
+ ;;
35
+ *) __gitcomp "$(__git_porcelain_commands) $(__git_aliases)" ;;
36
+ esac
37
+ return
38
+ fi
39
+
40
+ local expansion=$(__git_aliased_command "$command")
41
+ [ "$expansion" ] && command="$expansion"
42
+
43
+ case "$command" in
44
+ install|uninstall|path|info|setup|version|srcdir|list|reset|debug|reload|usage|help|implode|update|readline|iconv|benchmark|bench|use|gemsync)
45
+ ;;
46
+
47
+ rm|remove)
48
+ ;;
49
+
50
+ system|default)
51
+ ;;
52
+
53
+ ruby|jruby|ree|macruby|rbx|rubinius|default|all)
54
+ ;;
55
+
56
+ gemdir)
57
+ ;;
58
+
59
+ gemdup)
60
+ "system"
61
+ "user"
62
+ "default"
63
+ ;;
64
+
65
+
66
+ 1.8|1.8.0|1.8.1|1.8.2|1.8.3|1.8.4|1.8.5|1.8.6|1.8.7|1.9|1.9.1|1.9.2)
67
+ ;;
68
+
69
+ 1.2.0|1.3.1)
70
+ ;;
71
+
72
+ do|rubydo|rakedo|gemdo)
73
+ ;;
74
+ specs|tests)
75
+ ;;
76
+ rake|gem)
77
+ ;;
78
+ -S|--script|-e|--execute)
79
+ ;;
80
+ default|system)
81
+ ;;
82
+
83
+ --install) rvm_install_on_use_flag=1 ;;
84
+ --prefix) rvm_prefix_path="$1" ; shift ;;
85
+ -G|--gems) rvm_gem_path="$1" ; shift ;;
86
+ --source) rvm_source_path="$1" ; shift ;;
87
+ --archives) rvm_archives_path="$1" ; shift ;;
88
+ --make) rvm_ruby_make="$1" ; shift ;;
89
+ --make-install) rvm_ruby_make_install="$1"; shift ;;
90
+ --nice) rvm_niceness="$1" ; shift ;;
91
+ -l|--level) rvm_ruby_patch_level="$1" ; shift ;;
92
+ -h|--help) rvm_action=help ; shift ;;
93
+ -m|--gem-set) rvm_gem_set_name="$1" ; shift ;;
94
+ --rm-gem-set) rvm_gem_set_name_rm="$1" ; shift ;;
95
+ tests|specs) rvm_action="tests" ;;
96
+
97
+ --self|--gem|--rubygems|--reconfigure|--default|--debug|debug|--force|--all|--dump|--summary|--jit|--latest|--yaml|yaml|--json|json)
98
+ eval "rvm_$(echo $rvm_token | sed 's/-//g')_flag=1"
99
+ ;;
100
+
101
+ reboot|flush|asdf|damnit|wtf|argh|work|workdamnit|BOOM|boom|wth)
102
+
103
+ push) _git_push ;;
104
+ rebase) _git_rebase ;;
105
+ remote) _git_remote ;;
106
+ reset) _git_reset ;;
107
+ revert) _git_revert ;;
108
+ rm) _git_rm ;;
109
+ send-email) _git_send_email ;;
110
+ shortlog) _git_shortlog ;;
111
+ show) _git_show ;;
112
+ show-branch) _git_show_branch ;;
113
+ stash) _git_stash ;;
114
+ stage) _git_add ;;
115
+ submodule) _git_submodule ;;
116
+ svn) _git_svn ;;
117
+ tag) _git_tag ;;
118
+ whatchanged) _git_log ;;
119
+ *) COMPREPLY=() ;;
120
+ esac
121
+ }
122
+
123
+
124
+ # __gitcomp accepts 1, 2, 3, or 4 arguments
125
+ # generates completion reply with compgen
126
+ function __rvm_completion_reply
127
+ {
128
+ local cur="${COMP_WORDS[COMP_CWORD]}"
129
+ if [ $# -gt 2 ]; then
130
+ cur="$3"
131
+ fi
132
+ case "$cur" in
133
+ --*=)
134
+ COMPREPLY=()
135
+ ;;
136
+ *)
137
+ local IFS=$'\n'
138
+ COMPREPLY=($(compgen -P "${2-}" \
139
+ -W "$(__gitcomp_1 "${1-}" "${4-}")" \
140
+ -- "$cur"))
141
+ ;;
142
+ esac
143
+ }
144
+
145
+ function rvm {
146
+
147
+ __rvm_cleanup_variables
148
+ __rvm_load-rvmrc
149
+ __rvm_initialize
150
+ __rvm_load_defaults
151
+ __rvm_parse-args $@
152
+
153
+ if [ -z "$rvm_debug_flag" ] ; then set +x ; else set -x ; fi
154
+ result=0
155
+ case "$rvm_action" in
156
+ install) __rvm_install ; result=$? ;;
157
+ uninstall) __rvm_uninstall ; result=$? ;;
158
+ remove) __rvm_remove ; result=$? ;;
159
+ use) __rvm_use ; result=$? ;;
160
+ gemdir) __rvm_gem-dir ; result=$? ;;
161
+ srcdir) __rvm_src-dir ; result=$? ;;
162
+ gemdup) __rvm_gem-dup ; result=$? ;;
163
+ list) __rvm_list ; result=$? ;;
164
+ version) __rvm_version ; result=$? ;;
165
+ reset) __rvm_reset ; result=$? ;;
166
+ # TODO: how can we use bin_path here for reload, default file?
167
+ reload) __rvm_reload ; result=$? ;;
168
+ implode) __rvm_implode ; result=$? ;;
169
+ update) __rvm_update ; result=$? ;;
170
+ readline) __rvm_readline_install ; result=$? ;;
171
+ iconv) __rvm_iconv_install ; result=$? ;;
172
+ reboot) __rvm_reboot ; result=$? ;;
173
+ usage|help) __rvm_usage ; result=$? ;;
174
+ bench|benchmark) __rvm_benchmark ; result=$? ;;
175
+ rubydo|rakedo|gemdo) __rvm_do ; result=$? ;;
176
+
177
+ gemsync)
178
+ result=0
179
+ rvm_source_gem_path=`__rvm_select ; echo $rvm_gem_home`
180
+ __rvm_gem_sync
181
+ ;;
182
+
183
+ tests|specs)
184
+ rvm_summary_flag=1
185
+ rvm_action="rake"
186
+ __rvm_do
187
+ ;;
188
+
189
+ info|debug)
190
+ __rvm_version
191
+ __rvm_info
192
+ if [ "$rvm_action" = "debug" ] ; then __rvm_debug ; fi
193
+ result=0
194
+ ;;
195
+
196
+ error)
197
+ __rvm_log "fail" "$rvm_error_message ( see: 'rvm usage' )"
198
+ __rvm_pushpop
199
+ result=1;
200
+ ;;
201
+ *)
202
+ if [ ! -z "$rvm_action" ] ; then
203
+ __rvm_log "fail" "unknown action '$rvm_action'"
204
+ else
205
+ __rvm_usage
206
+ fi
207
+ result=1
208
+ esac
209
+ if [ "$rvm_debug_flag" = "1" ] ; then set +x ; unset rvm_debug_flag ; fi
210
+ return $result
211
+ }
212
+
213
+
@@ -1,7 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
3
  function __rvm_install_source {
4
-
5
4
  if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
6
5
 
7
6
  result=0
@@ -126,31 +125,6 @@ function __rvm_install_source {
126
125
  __rvm_pushpop
127
126
  }
128
127
 
129
- function __rvm_install {
130
- # TODO: Extract the outer looping mechanism with ruby_do's
131
- rubies=() ; successes=() ; errors=() ; statuses=()
132
- # TODO: Extract the common functionality out of the if below
133
- if [ ! -z "$(echo "$rvm_ruby_version" | awk '/,/')" ] ; then
134
- rvm_ruby_versions=`echo $rvm_ruby_version | tr ',' ' '`
135
- for rvm_ruby_string in $rvm_ruby_versions ; do
136
- unset rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install rvm_ruby_rev rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gem_set_name rvm_gem_home rvm_ruby_binary rvm_ruby_package_name rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_selected
137
- if [ ! -z "$(echo $rvm_ruby_selector | awk '/^[0-9]/')" ] ; then
138
- rvm_ruby_interpreter="ruby"
139
- rvm_ruby_version="$rvm_ruby_selector"
140
- else
141
- rvm_ruby_interpreter="$rvm_ruby_selector"
142
- unset rvm_ruby_version
143
- fi
144
- __rvm_log "debug" $rvm_ruby_string
145
- __rvm_select
146
- __rvm_install_ruby
147
- done
148
- else
149
- __rvm_select
150
- __rvm_install_ruby
151
- fi
152
- }
153
-
154
128
  function __rvm_install_ruby {
155
129
 
156
130
  if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
@@ -301,8 +275,7 @@ RubyWrapper
301
275
  if [ ! -z "$rvm_ruby_rev" ] ; then
302
276
  if [ ! -d $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version -o ! -d $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version/.git ] ; then
303
277
  git clone --depth 1 $rvm_jruby_repo_url $rvm_ruby_src_path
304
- # TODO: Test if 'ant' is installed, if not throw error.
305
- cd $rvm_ruby_src_path && ant
278
+ cd $rvm_ruby_src_path && ant # TODO: Test if 'ant' is installed, if not throw error.
306
279
  fi
307
280
  else
308
281
  if [ -d $rvm_ruby_src_path ] ; then
@@ -325,33 +298,32 @@ RubyWrapper
325
298
  fi
326
299
  fi
327
300
 
301
+ for binary in jirb jruby jgem ; do
302
+ cp -f $rvm_ruby_src_path/bin/$binary $rvm_ruby_src_path/bin/${binary#j}
303
+ done ; unset binary
304
+
328
305
  __rvm_log "info" "Installing $rvm_ruby_package_name..."
329
306
  mkdir -p $rvm_ruby_home/bin/
330
- __rvm_run "sync" rsync -ag $rvm_ruby_src_path/ $rvm_ruby_home/
331
307
  __rvm_run "nailgun" "cd $rvm_ruby_src_path/tool/nailgun && make $rvm_make_flags"
332
308
  __rvm_pushpop
333
309
  chmod +x $rvm_ruby_home/bin/*
334
310
 
335
-
336
- for binary in jirb jruby jgem ; do
337
- ln -fs $rvm_ruby_home/bin/$binary $rvm_ruby_home/bin/${binary#j}
338
- done ; unset binary
311
+ if [ -z "$rvm_ruby_home" -o "$rvm_ruby_home" = "/" ] ; then echo "WTH?!?! rvm_ruby_home == / ??? not removing." ; return 1000000 ; fi
312
+ rm -rf $rvm_ruby_home
313
+ __rvm_run "sync" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home"
339
314
 
340
315
  for binary in rake rdoc ri spec autospec ; do
341
316
  __rvm_inject_ruby_shebang $rvm_ruby_home/bin/$binary
342
317
  __rvm_inject_gem_env $rvm_ruby_home/bin/$binary
343
318
  chmod +x $rvm_ruby_home/bin/$binary
344
319
  done ; unset binary
345
-
320
+ __rvm_rubygems_setup
346
321
  __rvm_irbrc
347
322
  __rvm_bin_script
348
323
 
349
- ln -fs $rvm_ruby_home/bin/ruby $rvm_path/bin/$rvm_ruby_package_name # Is this necessary?
350
-
351
- __rvm_use
352
324
  for rvm_gem_name in jruby-openssl ; do
353
325
  __rvm_log "info" "Installing $rvm_gem_name"
354
- __rvm_run "gems" gem install $rvm_gem_name --no-rdoc --no-ri -q
326
+ __rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
355
327
  done ; unset rvm_gem_name
356
328
 
357
329
  ;;
@@ -374,17 +346,49 @@ RubyWrapper
374
346
  if [ ! -z "$ruby_options" ] ; then RUBYOPT=$ruby_options ; export RUBYOPT ; fi
375
347
  }
376
348
 
377
- # TODO: DRY up __rvm_remove and __rvm_uninstall
378
- function __rvm_remove {
349
+ function __rvm_manage_rubies {
350
+ rubies=() ; successes=() ; errors=() ; statuses=()
351
+ # TODO: Extract the common functionality out of the if below
352
+ if [ ! -z "$rvm_ruby_string" ] ; then
353
+ unset rvm_ruby_interpreter rvm_ruby_version
354
+ __rvm_${rvm_action}_ruby
355
+ elif [ ! -z "$rvm_ruby_version" ] ;then
356
+ for rvm_ruby_selector in `echo $rvm_ruby_version | tr ',' ' '` ; do
357
+ unset rvm_ruby_string
358
+ __rvm_${rvm_action}_ruby
359
+ __rvm_unset_ruby_variables
360
+ done
361
+ elif [ ! -z "$rvm_ruby_interpreter" ] ; then
362
+ unset rvm_ruby_string rvm_ruby_version
363
+ __rvm_${rvm_action}_ruby
364
+ else # all
365
+ if [ "$rvm_action" != "install" ] ; then
366
+ while read bin_line # Question: Should we prompt here? ;)
367
+ do # Keep this on second line damnit!
368
+ if [ -x $bin_line ] ; then
369
+ rvm_ruby_string="`dirname $bin_line | xargs dirname | xargs basename`"
370
+ __rvm_${rvm_action}_ruby
371
+ __rvm_unset_ruby_variables
372
+ fi
373
+ done < <(/bin/ls $rvm_path/*/bin/ruby 2> /dev/null)
374
+ fi
375
+ fi
376
+
377
+ if [ ! -z "$rvm_summary_flag" ] ; then __rvm_summary ; fi
378
+ if [ ! -z "$rvm_yaml_flag" ] ; then __rvm_yaml ; fi
379
+ if [ ! -z "$rvm_json_flag" ] ; then __rvm_json ; fi
380
+ }
381
+
382
+ function __rvm_uninstall_ruby {
379
383
  if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
380
384
 
381
385
  if [ ! -z "$rvm_ruby_package_name" ] ; then
382
- for dir in $rvm_source_path $rvm_path ; do
386
+ for dir in $rvm_path ; do
383
387
  if [ -d $dir/$rvm_ruby_package_name ] ; then
384
388
  __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
385
389
  rm -rf $dir/$rvm_ruby_package_name
386
390
  else
387
- __rvm_log "info" "it seems that $dir/$rvm_ruby_package_name is already non existent."
391
+ __rvm_log "info" "$dir/$rvm_ruby_package_name has already been removed."
388
392
  fi
389
393
  if [ -e $rvm_bin_path/$rvm_ruby_package_name ] ; then
390
394
  rm -f $rvm_bin_path/$rvm_ruby_package_name
@@ -396,11 +400,11 @@ function __rvm_remove {
396
400
  fi
397
401
  }
398
402
 
399
- function __rvm_uninstall {
403
+ function __rvm_remove_ruby {
400
404
  if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
401
405
 
402
406
  if [ ! -z "$rvm_ruby_package_name" ] ; then
403
- for dir in $rvm_path ; do
407
+ for dir in $rvm_source_path $rvm_path ; do
404
408
  if [ -d $dir/$rvm_ruby_package_name ] ; then
405
409
  __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
406
410
  rm -rf $dir/$rvm_ruby_package_name
@@ -467,7 +471,6 @@ function __rvm_rubygems_setup {
467
471
  if [ $result -eq 0 ] ; then
468
472
  __rvm_log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
469
473
  fi
470
-
471
474
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
472
475
  else
473
476
  # 1.9 has it's own built-in gem command
@@ -489,16 +492,17 @@ function __rvm_inject_ruby_shebang {
489
492
  function __rvm_inject_gem_env {
490
493
  __rvm_actual_file $1
491
494
  if [ -f $actual_file ] ; then
492
- set -x
493
495
  if [ ! -z "`head -n 1 $actual_file | awk '/[j]*ruby/'`" ] ; then
494
496
  string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin:' + ENV['PATH']"
495
497
  elif [ ! -z "`head -n 1 $actual_file | awk '/bash/'`" ] ; then
496
498
  string="GEM_HOME=\${GEM_HOME:-'$rvm_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_gem_home'}\nPATH=$rvm_ruby_home/bin:$rvm_gem_home/bin:\$PATH"
497
499
  fi
498
- set +x
499
- awk "NR==2 {print \"$string\"} {print}" $actual_file > $actual_file.new
500
- mv $actual_file.new $actual_file ; chmod +x $actual_file
501
- fi ; unset string actual_file
500
+ if [ ! -z "$string" ] ; then
501
+ awk "NR==2 {print \"$string\"} {print}" $actual_file > $actual_file.new
502
+ mv $actual_file.new $actual_file ; chmod +x $actual_file
503
+ unset string
504
+ fi
505
+ fi ; unset actual_file
502
506
  }
503
507
 
504
508
  function __rvm_actual_file {
@@ -159,6 +159,7 @@ function __rvm_use {
159
159
  if [ -s $rvm_path/default ] ; then
160
160
  source $rvm_path/default
161
161
  else
162
+ rvm_ruby_interpreter="system"
162
163
  __rvm_log "error" "no default rvm specified, defaulting to pre-rvm sytem."
163
164
  unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
164
165
  if [ -s $rvm_path/system ] ; then source $rvm_path/system ; fi
@@ -201,7 +202,13 @@ function __rvm_use {
201
202
  PATH=$rvm_bin_path:$PATH ; export PATH
202
203
  PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$rvm_path/bin:$PATH ; export PATH
203
204
 
204
- if [ ! -z "$rvm_default_flag" ] ; then
205
+ fi
206
+
207
+ if [ ! -z "$rvm_default_flag" -a "$rvm_ruby_interpreter" != "default" ] ; then
208
+ if [ "$rvm_ruby_interpreter" = "system" ] ; then
209
+ rm -f $rvm_path/default
210
+ rm -f $rvm_path/bin/default*
211
+ else
205
212
  RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
206
213
  export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION
207
214
 
@@ -210,12 +217,12 @@ function __rvm_use {
210
217
  for variable in RUBY_VERSION GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC ; do
211
218
  eval "export $variable"
212
219
  eval value=\$${variable}
213
- if [ ! -z "$variable" ] ; then
220
+ if [ ! -z "$value" ] ; then
214
221
  echo "${variable}='$value' ; export ${variable}" >> $rvm_path/default
215
222
  else
216
223
  echo "unset ${variable}" >> $rvm_path/default
217
224
  fi
218
- done
225
+ done ; unset variable value
219
226
 
220
227
  if [ -s $rvm_path/bin/$rvm_ruby_package_name ] ; then
221
228
  ln -fs $rvm_path/bin/$rvm_ruby_package_name $rvm_path/bin/default-ruby # So that people know what it's for :)
@@ -224,8 +231,8 @@ function __rvm_use {
224
231
  else
225
232
  rm -f $rvm_path/bin/default*
226
233
  fi
227
- unset rvm_default_flag
228
234
  fi
235
+ unset rvm_default_flag
229
236
  fi
230
237
 
231
238
  if [ ! -z "$rvm_load_flag" ] ; then __rvm_gemset_load ; fi
@@ -96,6 +96,10 @@ function __rvm_cleanup_variables {
96
96
  unset rvm_selected rvm_action rvm_ruby_interpreter rvm_ruby_patch_level rvm_ruby_version rvm_irbrc_file rvm_ruby_irbrc rvm_source_path rvm_path rvm_prefix_path rvm_ruby_package_name rvm_gem_path rvm_command rvm_error_message rvm_ruby_home rvm_ruby_binary rvm_gem_set_name rvm_ruby_tag rvm_ruby_rev rvm_url rvm_ruby_make rvm_ruby_configure rvm_ruby_make_install rvm_config_path rvm_ruby_string rvm_bin_path rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_load_flag rvm_dump_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
97
97
  }
98
98
 
99
+ function __rvm_unset_ruby_variables {
100
+ unset rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_make rvm_ruby_make_install rvm_ruby_rev rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gem_set_name rvm_gem_home rvm_ruby_binary rvm_ruby_package_name rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_selected rvm_ruby_selector
101
+ }
102
+
99
103
  # TODO: root user loadng of /etc/rvmrc
100
104
  function __rvm_load-rvmrc {
101
105
  if [ -s ~/.rvmrc ] ; then source ~/.rvmrc ; fi
@@ -447,7 +451,6 @@ function __rvm_update {
447
451
  __rvm_version
448
452
  fi
449
453
  __rvm_reload
450
- __rvm_select
451
454
  # if [ "$rvm_gem_flag" ] ; then __rvm_gem_scripts ; fi
452
455
  if [ "$rvm_bin_flag" ] ; then __rvm_bin_scripts ; fi
453
456
  if [ "$rvm_rubygems_flag" ] ; then __rvm_rubygems_setup ; fi
@@ -633,7 +636,7 @@ RubyCode
633
636
  echo -e "\n end\nend\n" >> /tmp/$$.rb
634
637
  unset rvm_code
635
638
  rvm_ruby_args="/tmp/$$.rb"
636
- rvm_action="rubydo"
639
+ rvm_action="ruby"
637
640
  if [ ! -z "$rvm_debug_flag" ] ; then echo -e "/tmp/$$.rb:\n$(cat /tmp/$$.rb)" ; fi
638
641
  __rvm_do
639
642
  }
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.47
4
+ version: 0.0.48
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-22 00:00:00 -04:00
12
+ date: 2009-09-23 00:00:00 -04:00
13
13
  default_executable: rvm-install
14
14
  dependencies: []
15
15
 
@@ -34,6 +34,7 @@ files:
34
34
  - scripts/rvm
35
35
  - scripts/rvm-aliases
36
36
  - scripts/rvm-cli
37
+ - scripts/rvm-completion
37
38
  - scripts/rvm-functions
38
39
  - scripts/rvm-install
39
40
  - scripts/rvm-prompt