rubygems-test 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/gems/template.gemspec +0 -6
- data/lib/rubygems/commands/test_command.rb +21 -21
- data/lib/rubygems/on_install_test.rb +3 -4
- data/lib/rubygems_plugin.rb +1 -3
- data/test/helper.rb +6 -19
- metadata +3 -3
data/Rakefile
CHANGED
data/gems/template.gemspec
CHANGED
@@ -22,11 +22,5 @@ Gem::Specification.new do |s|
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
24
|
s.specification_version = 3
|
25
|
-
|
26
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
-
else
|
28
|
-
end
|
29
|
-
else
|
30
25
|
end
|
31
26
|
end
|
32
|
-
|
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
Gem.autoload(:VersionOption, 'rubygems/version_option')
|
2
|
+
Gem.autoload(:Specification, 'rubygems/specification')
|
3
|
+
Gem.autoload(:DependencyInstaller, 'rubygems/dependency_installer')
|
4
|
+
Gem.autoload(:DefaultUserInteraction, 'rubygems/user_interaction')
|
5
5
|
require 'rbconfig'
|
6
|
-
|
6
|
+
autoload(:YAML, 'yaml')
|
7
7
|
require 'net/http'
|
8
8
|
require 'uri'
|
9
9
|
|
@@ -14,8 +14,6 @@ class Gem::Commands::TestCommand < Gem::Command
|
|
14
14
|
include Gem::VersionOption
|
15
15
|
include Gem::DefaultUserInteraction
|
16
16
|
|
17
|
-
VERSION = "0.1.9"
|
18
|
-
|
19
17
|
# taken straight out of rake
|
20
18
|
DEFAULT_RAKEFILES = ['rakefile', 'Rakefile', 'rakefile.rb', 'Rakefile.rb']
|
21
19
|
|
@@ -194,23 +192,23 @@ class Gem::Commands::TestCommand < Gem::Command
|
|
194
192
|
handles, _, _ = IO.select(current_handles, nil, nil, 0.1)
|
195
193
|
buf = ""
|
196
194
|
|
197
|
-
handles
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
end
|
206
|
-
end
|
195
|
+
if handles
|
196
|
+
handles.compact.each do |io|
|
197
|
+
begin
|
198
|
+
buf += io.readline
|
199
|
+
rescue EOFError
|
200
|
+
buf += io.read rescue ""
|
201
|
+
current_handles.reject! { |x| x == io }
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
207
205
|
|
208
206
|
[buf, current_handles]
|
209
207
|
end
|
210
208
|
|
211
209
|
outer_reader_proc = proc do |stdout, stderr|
|
212
210
|
loop do
|
213
|
-
handles = [
|
211
|
+
handles = [stderr, stdout]
|
214
212
|
buf, handles = reader_proc.call(handles)
|
215
213
|
output += buf
|
216
214
|
print buf
|
@@ -218,22 +216,24 @@ class Gem::Commands::TestCommand < Gem::Command
|
|
218
216
|
end
|
219
217
|
end
|
220
218
|
|
219
|
+
rake_args = [rake_path, 'test', '--trace']
|
220
|
+
|
221
221
|
# jruby stuffs it under IO, so we'll use that if it's available
|
222
222
|
klass =
|
223
223
|
if IO.respond_to?(:popen4)
|
224
|
-
IO.popen4(
|
224
|
+
IO.popen4(*rake_args) do |pid, stdin, stdout, stderr|
|
225
225
|
outer_reader_proc.call(stdout, stderr)
|
226
226
|
end
|
227
227
|
exit_status = $?
|
228
228
|
elsif RUBY_VERSION > '1.9'
|
229
229
|
require 'open3'
|
230
|
-
exit_status = Open3.popen3(
|
230
|
+
exit_status = Open3.popen3(*rake_args) do |stdin, stdout, stderr, thr|
|
231
231
|
outer_reader_proc.call(stdout, stderr)
|
232
232
|
thr.value
|
233
233
|
end
|
234
234
|
else
|
235
235
|
require 'open4-vendor'
|
236
|
-
exit_status = Open4.popen4(
|
236
|
+
exit_status = Open4.popen4(*rake_args) do |pid, stdin, stdout, stderr|
|
237
237
|
outer_reader_proc.call(stdout, stderr)
|
238
238
|
end
|
239
239
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Gem.autoload(:Uninstaller, 'rubygems/uninstaller')
|
2
|
+
Gem.autoload(:Commands, 'rubygems/commands/test_command')
|
3
3
|
|
4
4
|
Gem.post_install do |gem|
|
5
5
|
options = Gem.configuration["test_options"] || { }
|
@@ -9,7 +9,7 @@ Gem.post_install do |gem|
|
|
9
9
|
gem.ui.ask_yes_no("Test #{gem.spec.name} (#{gem.spec.version})?", true)
|
10
10
|
|
11
11
|
begin
|
12
|
-
Gem::
|
12
|
+
Gem::Command::TestCommand.new(gem.spec, true).execute
|
13
13
|
rescue Gem::RakeNotFoundError, Gem::TestError
|
14
14
|
if (options.has_key?("force_install") and !options["force_install"]) or
|
15
15
|
options["force_uninstall_on_failure"] or
|
@@ -19,7 +19,6 @@ Gem.post_install do |gem|
|
|
19
19
|
at_exit { Gem::Uninstaller.new(gem.spec.name, :version => gem.spec.version).uninstall }
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'rubygems/command_manager'
|
2
2
|
require 'rubygems/on_install_test'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.3.6')
|
4
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.3.1')
|
7
5
|
%w[test].each do |command|
|
8
6
|
Gem::CommandManager.instance.register_command command.to_sym
|
9
7
|
end
|
data/test/helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rubygems/builder'
|
3
|
-
require 'rubygems/installer'
|
4
|
-
require 'rubygems/uninstaller'
|
1
|
+
require 'rubygems' unless defined? Gem
|
2
|
+
require 'rubygems/builder' unless defined? Gem::Builder
|
3
|
+
require 'rubygems/installer' unless defined? Gem::Installer
|
4
|
+
require 'rubygems/uninstaller' unless defined? Gem::Uninstaller
|
5
5
|
require 'test/unit'
|
6
6
|
require 'erb'
|
7
7
|
require 'tempfile'
|
@@ -10,7 +10,7 @@ require 'fileutils'
|
|
10
10
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
11
11
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
12
12
|
|
13
|
-
require 'rubygems/commands/test_command'
|
13
|
+
require 'rubygems/commands/test_command' unless defined? Gem::Command::TestCommand
|
14
14
|
|
15
15
|
class Test::Unit::TestCase
|
16
16
|
def install_stub_gem(hash)
|
@@ -36,6 +36,7 @@ class Test::Unit::TestCase
|
|
36
36
|
erb = ERB.new(File.read(File.join('gems', 'template.gemspec')))
|
37
37
|
|
38
38
|
@development_dependencies = ""
|
39
|
+
|
39
40
|
(hash[:development_dependencies] || []).each do |dep|
|
40
41
|
@development_dependencies += "s.add_development_dependency '#{dep}'\n"
|
41
42
|
end
|
@@ -58,17 +59,3 @@ class Test::Unit::TestCase
|
|
58
59
|
set_configuration({ })
|
59
60
|
end
|
60
61
|
end
|
61
|
-
|
62
|
-
class Test::Unit::TestCase::Interactive < Test::Unit::TestCase
|
63
|
-
def setup
|
64
|
-
super
|
65
|
-
|
66
|
-
require 'rubygems/on_install_test'
|
67
|
-
puts
|
68
|
-
puts "----- This test is interactive -----"
|
69
|
-
puts
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_01_null
|
73
|
-
end
|
74
|
-
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
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-
|
18
|
+
date: 2011-01-08 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|