rvm 0.1.41 → 0.1.42

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.
Files changed (58) hide show
  1. data/binscripts/rvm +1 -1
  2. data/binscripts/rvm-shell +32 -0
  3. data/binscripts/rvmsudo +1 -6
  4. data/config/db +2 -2
  5. data/config/known +2 -2
  6. data/config/md5 +6 -5
  7. data/contrib/install-system-wide +81 -0
  8. data/install +23 -24
  9. data/lib/VERSION.yml +1 -1
  10. data/lib/rvm.rb +156 -1
  11. data/lib/rvm/capistrano.rb +45 -0
  12. data/lib/rvm/environment.rb +62 -0
  13. data/lib/rvm/environment/alias.rb +69 -0
  14. data/lib/rvm/environment/cleanup.rb +54 -0
  15. data/lib/rvm/environment/configuration.rb +60 -0
  16. data/lib/rvm/environment/env.rb +52 -0
  17. data/lib/rvm/environment/gemset.rb +222 -0
  18. data/lib/rvm/environment/info.rb +13 -0
  19. data/lib/rvm/environment/list.rb +124 -0
  20. data/lib/rvm/environment/rubies.rb +50 -0
  21. data/lib/rvm/environment/sets.rb +123 -0
  22. data/lib/rvm/environment/tools.rb +41 -0
  23. data/lib/rvm/environment/utility.rb +167 -0
  24. data/lib/rvm/environment/wrapper.rb +23 -0
  25. data/lib/rvm/errors.rb +28 -0
  26. data/lib/rvm/shell.rb +21 -10
  27. data/lib/rvm/shell/abstract_wrapper.rb +145 -0
  28. data/lib/rvm/shell/result.rb +42 -0
  29. data/lib/rvm/shell/shell_wrapper.sh +10 -0
  30. data/lib/rvm/shell/single_shot_wrapper.rb +56 -0
  31. data/lib/rvm/shell/utility.rb +37 -0
  32. data/lib/rvm/version.rb +12 -8
  33. data/rvm.gemspec +27 -4
  34. data/scripts/cd +17 -32
  35. data/scripts/cli +46 -16
  36. data/scripts/completion +1 -1
  37. data/scripts/disk-usage +52 -0
  38. data/scripts/fetch +8 -2
  39. data/scripts/gemsets +15 -4
  40. data/scripts/initialize +3 -3
  41. data/scripts/install +23 -24
  42. data/scripts/list +16 -8
  43. data/scripts/log +4 -1
  44. data/scripts/man +0 -0
  45. data/scripts/manage +51 -34
  46. data/scripts/md5 +4 -5
  47. data/scripts/package +28 -6
  48. data/scripts/rubygems +2 -2
  49. data/scripts/rvm +2 -2
  50. data/scripts/rvm-install +23 -24
  51. data/scripts/selector +2 -2
  52. data/scripts/tools +34 -0
  53. data/scripts/update +23 -24
  54. data/scripts/utility +54 -12
  55. data/scripts/wrapper +21 -18
  56. metadata +29 -6
  57. data/lib/rvm/open4.rb +0 -395
  58. data/lib/rvm/rvm.rb +0 -14
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: 73
4
+ hash: 79
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 41
10
- version: 0.1.41
9
+ - 42
10
+ version: 0.1.42
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-07-08 00:00:00 -04:00
18
+ date: 2010-07-20 00:00:00 -04:00
19
19
  default_executable: rvm-install
20
20
  dependencies: []
21
21
 
@@ -32,6 +32,7 @@ files:
32
32
  - README
33
33
  - binscripts/rvm
34
34
  - binscripts/rvm-prompt
35
+ - binscripts/rvm-shell
35
36
  - binscripts/rvm-update-head
36
37
  - binscripts/rvm-update-latest
37
38
  - binscripts/rvmsudo
@@ -39,6 +40,7 @@ files:
39
40
  - config/known
40
41
  - config/md5
41
42
  - contrib/gemset_snapshot
43
+ - contrib/install-system-wide
42
44
  - examples/rvmrc
43
45
  - gemsets/default.gems
44
46
  - gemsets/global.gems
@@ -71,9 +73,27 @@ files:
71
73
  - install
72
74
  - lib/VERSION.yml
73
75
  - lib/rvm.rb
74
- - lib/rvm/open4.rb
75
- - lib/rvm/rvm.rb
76
+ - lib/rvm/capistrano.rb
77
+ - lib/rvm/environment.rb
78
+ - lib/rvm/environment/alias.rb
79
+ - lib/rvm/environment/cleanup.rb
80
+ - lib/rvm/environment/configuration.rb
81
+ - lib/rvm/environment/env.rb
82
+ - lib/rvm/environment/gemset.rb
83
+ - lib/rvm/environment/info.rb
84
+ - lib/rvm/environment/list.rb
85
+ - lib/rvm/environment/rubies.rb
86
+ - lib/rvm/environment/sets.rb
87
+ - lib/rvm/environment/tools.rb
88
+ - lib/rvm/environment/utility.rb
89
+ - lib/rvm/environment/wrapper.rb
90
+ - lib/rvm/errors.rb
76
91
  - lib/rvm/shell.rb
92
+ - lib/rvm/shell/abstract_wrapper.rb
93
+ - lib/rvm/shell/result.rb
94
+ - lib/rvm/shell/shell_wrapper.sh
95
+ - lib/rvm/shell/single_shot_wrapper.rb
96
+ - lib/rvm/shell/utility.rb
77
97
  - lib/rvm/version.rb
78
98
  - rvm.gemspec
79
99
  - scripts/alias
@@ -86,6 +106,7 @@ files:
86
106
  - scripts/color
87
107
  - scripts/completion
88
108
  - scripts/db
109
+ - scripts/disk-usage
89
110
  - scripts/docs
90
111
  - scripts/env
91
112
  - scripts/fetch
@@ -101,6 +122,7 @@ files:
101
122
  - scripts/list
102
123
  - scripts/log
103
124
  - scripts/maglev
125
+ - scripts/man
104
126
  - scripts/manage
105
127
  - scripts/manpages
106
128
  - scripts/match
@@ -115,6 +137,7 @@ files:
115
137
  - scripts/rvm-install
116
138
  - scripts/selector
117
139
  - scripts/set
140
+ - scripts/tools
118
141
  - scripts/update
119
142
  - scripts/utility
120
143
  - scripts/version
@@ -1,395 +0,0 @@
1
- # vim: ts=2:sw=2:sts=2:et:fdm=marker
2
- # Author: Ara T. Howard
3
- # Gem: open4
4
- require 'fcntl'
5
- require 'timeout'
6
- require 'thread'
7
-
8
- module Open4
9
- #--{{{
10
- VERSION = '0.9.6'
11
- def self.version() VERSION end
12
-
13
- class Error < ::StandardError; end
14
-
15
- def popen4(*cmd, &b)
16
- #--{{{
17
- pw, pr, pe, ps = IO.pipe, IO.pipe, IO.pipe, IO.pipe
18
-
19
- verbose = $VERBOSE
20
- begin
21
- $VERBOSE = nil
22
- ps.last.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
23
-
24
- cid = fork {
25
- pw.last.close
26
- STDIN.reopen pw.first
27
- pw.first.close
28
-
29
- pr.first.close
30
- STDOUT.reopen pr.last
31
- pr.last.close
32
-
33
- pe.first.close
34
- STDERR.reopen pe.last
35
- pe.last.close
36
-
37
- STDOUT.sync = STDERR.sync = true
38
-
39
- begin
40
- exec(*cmd)
41
- raise 'forty-two'
42
- rescue Exception => e
43
- Marshal.dump(e, ps.last)
44
- ps.last.flush
45
- end
46
- ps.last.close unless (ps.last.closed?)
47
- exit!
48
- }
49
- ensure
50
- $VERBOSE = verbose
51
- end
52
-
53
- [pw.first, pr.last, pe.last, ps.last].each{|fd| fd.close}
54
-
55
- begin
56
- e = Marshal.load ps.first
57
- raise(Exception === e ? e : "unknown failure!")
58
- rescue EOFError # If we get an EOF error, then the exec was successful
59
- 42
60
- ensure
61
- ps.first.close
62
- end
63
-
64
- pw.last.sync = true
65
-
66
- pi = [pw.last, pr.first, pe.first]
67
-
68
- if b
69
- begin
70
- b[cid, *pi]
71
- Process.waitpid2(cid).last
72
- ensure
73
- pi.each{|fd| fd.close unless fd.closed?}
74
- end
75
- else
76
- [cid, pw.last, pr.first, pe.first]
77
- end
78
- #--}}}
79
- end
80
- alias open4 popen4
81
- module_function :popen4
82
- module_function :open4
83
-
84
- class SpawnError < Error
85
- #--{{{
86
- attr 'cmd'
87
- attr 'status'
88
- attr 'signals'
89
- def exitstatus
90
- @status.exitstatus
91
- end
92
- def initialize cmd, status
93
- @cmd, @status = cmd, status
94
- @signals = {}
95
- if status.signaled?
96
- @signals['termsig'] = status.termsig
97
- @signals['stopsig'] = status.stopsig
98
- end
99
- sigs = @signals.map{|k,v| "#{ k }:#{ v.inspect }"}.join(' ')
100
- super "cmd <#{ cmd }> failed with status <#{ exitstatus.inspect }> signals <#{ sigs }>"
101
- end
102
- #--}}}
103
- end
104
-
105
- class ThreadEnsemble
106
- #--{{{
107
- attr 'threads'
108
-
109
- def initialize cid
110
- @cid, @threads, @argv, @done, @running = cid, [], [], Queue.new, false
111
- @killed = false
112
- end
113
-
114
- def add_thread *a, &b
115
- @running ? raise : (@argv << [a, b])
116
- end
117
-
118
- #
119
- # take down process more nicely
120
- #
121
- def killall
122
- c = Thread.critical
123
- return nil if @killed
124
- Thread.critical = true
125
- (@threads - [Thread.current]).each{|t| t.kill rescue nil}
126
- @killed = true
127
- ensure
128
- Thread.critical = c
129
- end
130
-
131
- def run
132
- @running = true
133
-
134
- begin
135
- @argv.each do |a, b|
136
- @threads << Thread.new(*a) do |*a|
137
- begin
138
- b[*a]
139
- ensure
140
- killall rescue nil if $!
141
- @done.push Thread.current
142
- end
143
- end
144
- end
145
- rescue
146
- killall
147
- raise
148
- ensure
149
- all_done
150
- end
151
-
152
- @threads.map{|t| t.value}
153
- end
154
-
155
- def all_done
156
- @threads.size.times{ @done.pop }
157
- end
158
- #--}}}
159
- end
160
-
161
- def to timeout = nil
162
- #--{{{
163
- Timeout.timeout(timeout){ yield }
164
- #--}}}
165
- end
166
- module_function :to
167
-
168
- def new_thread *a, &b
169
- #--{{{
170
- cur = Thread.current
171
- Thread.new(*a) do |*a|
172
- begin
173
- b[*a]
174
- rescue Exception => e
175
- cur.raise e
176
- end
177
- end
178
- #--}}}
179
- end
180
- module_function :new_thread
181
-
182
- def getopts opts = {}
183
- #--{{{
184
- lambda do |*args|
185
- keys, default, ignored = args
186
- catch('opt') do
187
- [keys].flatten.each do |key|
188
- [key, key.to_s, key.to_s.intern].each do |key|
189
- throw 'opt', opts[key] if opts.has_key?(key)
190
- end
191
- end
192
- default
193
- end
194
- end
195
- #--}}}
196
- end
197
- module_function :getopts
198
-
199
- def relay src, dst = nil, t = nil
200
- #--{{{
201
- unless src.nil?
202
- if src.respond_to? :gets
203
- while buf = to(t){ src.gets }
204
- dst << buf if dst
205
- end
206
-
207
- elsif src.respond_to? :each
208
- q = Queue.new
209
- th = nil
210
-
211
- timer_set = lambda do |t|
212
- th = new_thread{ to(t){ q.pop } }
213
- end
214
-
215
- timer_cancel = lambda do |t|
216
- th.kill if th rescue nil
217
- end
218
-
219
- timer_set[t]
220
- begin
221
- src.each do |buf|
222
- timer_cancel[t]
223
- dst << buf if dst
224
- timer_set[t]
225
- end
226
- ensure
227
- timer_cancel[t]
228
- end
229
-
230
- elsif src.respond_to? :read
231
- buf = to(t){ src.read }
232
- dst << buf if dst
233
-
234
- else
235
- buf = to(t){ src.to_s }
236
- dst << buf if dst
237
- end
238
- end
239
- #--}}}
240
- end
241
- module_function :relay
242
-
243
- def spawn arg, *argv
244
- #--{{{
245
- argv.unshift(arg)
246
- opts = ((argv.size > 1 and Hash === argv.last) ? argv.pop : {})
247
- argv.flatten!
248
- cmd = argv.join(' ')
249
-
250
-
251
- getopt = getopts opts
252
-
253
- ignore_exit_failure = getopt[ 'ignore_exit_failure', getopt['quiet', false] ]
254
- ignore_exec_failure = getopt[ 'ignore_exec_failure', !getopt['raise', true] ]
255
- exitstatus = getopt[ %w( exitstatus exit_status status ) ]
256
- stdin = getopt[ %w( stdin in i 0 ) << 0 ]
257
- stdout = getopt[ %w( stdout out o 1 ) << 1 ]
258
- stderr = getopt[ %w( stderr err e 2 ) << 2 ]
259
- pid = getopt[ 'pid' ]
260
- timeout = getopt[ %w( timeout spawn_timeout ) ]
261
- stdin_timeout = getopt[ %w( stdin_timeout ) ]
262
- stdout_timeout = getopt[ %w( stdout_timeout io_timeout ) ]
263
- stderr_timeout = getopt[ %w( stderr_timeout ) ]
264
- status = getopt[ %w( status ) ]
265
- cwd = getopt[ %w( cwd dir ) ]
266
-
267
- exitstatus =
268
- case exitstatus
269
- when TrueClass, FalseClass
270
- ignore_exit_failure = true if exitstatus
271
- [0]
272
- else
273
- [*(exitstatus || 0)].map{|i| Integer i}
274
- end
275
-
276
- stdin ||= '' if stdin_timeout
277
- stdout ||= '' if stdout_timeout
278
- stderr ||= '' if stderr_timeout
279
-
280
- started = false
281
-
282
- status =
283
- begin
284
- chdir(cwd) do
285
- Timeout::timeout(timeout) do
286
- popen4(*argv) do |c, i, o, e|
287
- started = true
288
-
289
- %w( replace pid= << push update ).each do |msg|
290
- break(pid.send(msg, c)) if pid.respond_to? msg
291
- end
292
-
293
- te = ThreadEnsemble.new c
294
-
295
- te.add_thread(i, stdin) do |i, stdin|
296
- relay stdin, i, stdin_timeout
297
- i.close rescue nil
298
- end
299
-
300
- te.add_thread(o, stdout) do |o, stdout|
301
- relay o, stdout, stdout_timeout
302
- end
303
-
304
- te.add_thread(e, stderr) do |o, stderr|
305
- relay e, stderr, stderr_timeout
306
- end
307
-
308
- te.run
309
- end
310
- end
311
- end
312
- rescue
313
- raise unless(not started and ignore_exec_failure)
314
- end
315
-
316
- raise SpawnError.new(cmd, status) unless
317
- (ignore_exit_failure or (status.nil? and ignore_exec_failure) or exitstatus.include?(status.exitstatus))
318
-
319
- status
320
- #--}}}
321
- end
322
- module_function :spawn
323
-
324
- def chdir cwd, &block
325
- return(block.call Dir.pwd) unless cwd
326
- Dir.chdir cwd, &block
327
- end
328
- module_function :chdir
329
-
330
- def background arg, *argv
331
- #--{{{
332
- require 'thread'
333
- q = Queue.new
334
- opts = { 'pid' => q, :pid => q }
335
- case argv.last
336
- when Hash
337
- argv.last.update opts
338
- else
339
- argv.push opts
340
- end
341
- thread = Thread.new(arg, argv){|arg, argv| spawn arg, *argv}
342
- sc = class << thread; self; end
343
- sc.module_eval {
344
- define_method(:pid){ @pid ||= q.pop }
345
- define_method(:spawn_status){ @spawn_status ||= value }
346
- define_method(:exitstatus){ @exitstatus ||= spawn_status.exitstatus }
347
- }
348
- thread
349
- #--}}}
350
- end
351
- alias bg background
352
- module_function :background
353
- module_function :bg
354
-
355
- def maim pid, opts = {}
356
- #--{{{
357
- getopt = getopts opts
358
- sigs = getopt[ 'signals', %w(SIGTERM SIGQUIT SIGKILL) ]
359
- suspend = getopt[ 'suspend', 4 ]
360
- pid = Integer pid
361
- existed = false
362
- sigs.each do |sig|
363
- begin
364
- Process.kill sig, pid
365
- existed = true
366
- rescue Errno::ESRCH
367
- return(existed ? nil : true)
368
- end
369
- return true unless alive? pid
370
- sleep suspend
371
- return true unless alive? pid
372
- end
373
- return(not alive?(pid))
374
- #--}}}
375
- end
376
- module_function :maim
377
-
378
- def alive pid
379
- #--{{{
380
- pid = Integer pid
381
- begin
382
- Process.kill 0, pid
383
- true
384
- rescue Errno::ESRCH
385
- false
386
- end
387
- #--}}}
388
- end
389
- alias alive? alive
390
- module_function :alive
391
- module_function :'alive?'
392
- #--}}}
393
- end
394
-
395
- def open4(*cmd, &b) cmd.size == 0 ? Open4 : Open4::popen4(*cmd, &b) end