rubygems-test 0.2.3 → 0.2.4

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,3 +1,10 @@
1
+ === 0.2.4 / 1/13/2011
2
+
3
+ * Better I/O loop and terminal handling; test/unit dots should appear as they
4
+ arrive again.
5
+
6
+ * Better help for those who provide no gem names.
7
+
1
8
  === 0.2.2 / 1/10/2011
2
9
 
3
10
  * Windows + 1.8 support. Requires the 'win32-open3' gem.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ Hoe.spec 'rubygems-test' do
12
12
 
13
13
  # doin' it wrong because we're a gem plugin
14
14
  # that means I can be "special"!
15
- self.version = '0.2.3'
15
+ self.version = '0.2.4'
16
16
 
17
17
  self.rubyforge_name = nil
18
18
 
@@ -209,33 +209,52 @@ class Gem::Commands::TestCommand < Gem::Command
209
209
  output = ""
210
210
  exit_status = nil
211
211
 
212
+ [STDOUT, STDERR, $stdout, $stderr].map { |x| x.sync = true }
213
+
212
214
  Dir.chdir(spec.full_gem_path) do
213
215
  reader_proc = proc do |orig_handles|
214
216
  current_handles = orig_handles.dup
215
217
 
216
218
  handles, _, _ = IO.select(current_handles, nil, nil, 0.1)
217
- buf = ""
219
+ bufs = Hash.new { |h, k| h[k] = "" }
218
220
 
219
221
  if handles
220
222
  handles.compact.each do |io|
221
223
  begin
222
- buf += io.readline
224
+ bufs[io] += io.readpartial(8)
223
225
  rescue EOFError
224
- buf += io.read rescue ""
226
+ bufs[io] += io.read rescue ""
225
227
  current_handles.reject! { |x| x == io }
226
228
  end
227
229
  end
228
230
  end
229
231
 
230
- [buf, current_handles]
232
+ [bufs, current_handles]
231
233
  end
232
234
 
233
235
  outer_reader_proc = proc do |stdout, stderr|
236
+ stderr_buf = ""
237
+
234
238
  loop do
239
+ output = ""
235
240
  handles = [stderr, stdout]
236
- buf, handles = reader_proc.call(handles)
237
- output += buf
238
- print buf
241
+ bufs, handles = reader_proc.call(handles)
242
+
243
+ # hello mom, I've rewritten unix i/o and it probably sucks.
244
+ # basically, we only "flush" stderr on newline and stdout
245
+ # "flushes" immediately. and by "flush" I mean "concatenates".
246
+ if bufs.has_key?(stderr)
247
+ stderr_buf += bufs[stderr]
248
+ buf_ary = stderr_buf.split(/\n/)
249
+ if buf_ary.length > 1
250
+ output += buf_ary[0..-2].join("\n") + "\n"
251
+ stderr_buf = buf_ary[-1]
252
+ end
253
+ end
254
+
255
+ output += bufs[stdout] if bufs.has_key?(stdout)
256
+
257
+ print output
239
258
  break if handles.empty?
240
259
  end
241
260
  end
@@ -243,6 +262,10 @@ class Gem::Commands::TestCommand < Gem::Command
243
262
  rake_args = [rake_path, 'test', '--trace']
244
263
 
245
264
  # jruby stuffs it under IO, so we'll use that if it's available
265
+ # if we're on 1.9, use open3 regardless of platform.
266
+ # If we're not:
267
+ # * on windows use win32/open3 from win32-open3 gem
268
+ # * on unix use open4-vendor
246
269
  klass =
247
270
  if IO.respond_to?(:popen4)
248
271
  IO.popen4(*rake_args) do |pid, stdin, stdout, stderr|
@@ -307,6 +330,13 @@ class Gem::Commands::TestCommand < Gem::Command
307
330
  version = options[:version] || Gem::Requirement.default
308
331
 
309
332
  (get_all_gem_names rescue [options[:name]]).each do |name|
333
+
334
+ unless name
335
+ alert_error "No gem specified."
336
+ show_help
337
+ terminate_interaction 1
338
+ end
339
+
310
340
  spec = find_gem(name, version)
311
341
 
312
342
  unless spec
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 4
9
+ version: 0.2.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Erik Hollensbe
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-11 00:00:00 -05:00
18
+ date: 2011-01-13 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency