rubygems-test 0.2.5 → 0.2.6

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,7 @@
1
+ === 0.2.6 / 2011-01-15
2
+
3
+ * Big refactor of rake locating to get running on mswin32
4
+
1
5
  === 0.2.5 / 1/15/2011
2
6
 
3
7
  * use the input record separator instead of straight newlines - windows!
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.5'
15
+ self.version = '0.2.6'
16
16
 
17
17
  self.rubyforge_name = nil
18
18
 
@@ -95,11 +95,20 @@ class Gem::Commands::TestCommand < Gem::Command
95
95
  # Locate rake itself, prefer gems version.
96
96
  #
97
97
  def find_rake
98
- rake_path = Gem.bin_path('rake') rescue File.join(RbConfig::CONFIG["bindir"], 'rake')
98
+
99
+ rake_finder = proc do |rake_name|
100
+ Gem.bin_path('rake') rescue File.join(RbConfig::CONFIG["bindir"], rake_name || 'rake')
101
+ end
102
+
103
+ rake_path = rake_finder.call(nil)
99
104
 
100
105
  unless File.exist?(rake_path)
101
- alert_error "Couldn't find rake; rubygems-test will not work without it. Aborting."
102
- raise Gem::RakeNotFoundError, "Couldn't find rake; rubygems-test will not work without it."
106
+ rake_path = rake_finder.call('rake.bat')
107
+
108
+ unless File.exist?(rake_path)
109
+ alert_error "Couldn't find rake; rubygems-test will not work without it. Aborting."
110
+ raise Gem::RakeNotFoundError, "Couldn't find rake; rubygems-test will not work without it."
111
+ end
103
112
  end
104
113
 
105
114
  return rake_path
@@ -262,6 +271,23 @@ class Gem::Commands::TestCommand < Gem::Command
262
271
 
263
272
  rake_args = [rake_path, 'test', '--trace']
264
273
 
274
+ rake_args_concatenator = proc do |ra|
275
+ ra.unshift(File.join(RbConfig::CONFIG["bindir"], 'ruby'))
276
+ end
277
+
278
+ case RUBY_PLATFORM
279
+ when /mingw/
280
+ rake_args_concatenator.call(rake_args)
281
+ rake_args = rake_args.join(' ')
282
+ when /mswin/
283
+ # if we don't run rake.bat (system rake for 1.9 as opposed to gems),
284
+ # run it with ruby.
285
+ if rake_args[0] =~ /rake$/
286
+ rake_args_concatenator.call(rake_args)
287
+ end
288
+ rake_args = rake_args.join(' ')
289
+ end
290
+
265
291
  # jruby stuffs it under IO, so we'll use that if it's available
266
292
  # if we're on 1.9, use open3 regardless of platform.
267
293
  # If we're not:
@@ -279,10 +305,10 @@ class Gem::Commands::TestCommand < Gem::Command
279
305
  outer_reader_proc.call(stdout, stderr)
280
306
  thr.value
281
307
  end
282
- elsif RUBY_PLATFORM =~ /mingw/
308
+ elsif RUBY_PLATFORM =~ /mingw|mswin/
283
309
  begin
284
310
  require 'win32/open3'
285
- Open3.popen3([File.join(RbConfig::CONFIG["bindir"], 'ruby'), *rake_args].join(' ')) do |stdin, stdout, stderr|
311
+ Open3.popen3(*rake_args) do |stdin, stdout, stderr|
286
312
  outer_reader_proc.call(stdout, stderr)
287
313
  end
288
314
  exit_status = $?
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 5
9
- version: 0.2.5
8
+ - 6
9
+ version: 0.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Erik Hollensbe