hoe 3.25.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -4
- data/History.rdoc +11 -0
- data/Manifest.txt +1 -2
- data/Rakefile +1 -0
- data/lib/hoe/clean.rb +1 -1
- data/lib/hoe/cov.rb +34 -0
- data/lib/hoe/test.rb +6 -127
- data/lib/hoe.rb +2 -5
- data/test/test_hoe.rb +3 -7
- data/test/test_hoe_debug.rb +2 -3
- data/test/test_hoe_gemcutter.rb +2 -2
- data/test/test_hoe_package.rb +1 -1
- data/test/test_hoe_publish.rb +0 -1
- data/test/test_hoe_test.rb +2 -53
- data.tar.gz.sig +0 -0
- metadata +17 -18
- metadata.gz.sig +0 -0
- data/lib/hoe/rcov.rb +0 -68
- data/lib/minitest/test_task.rb +0 -305
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59df54d9f8fe0c2c52e71f8fb63f492924a5f10e2a5fd6cb9246adbe14a49ebe
|
4
|
+
data.tar.gz: 8c0800c24176f4b2285b2f2d4283014dcb3c06a5951cc881b98d8c802070e81b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04f3f8733c99aa5aa427a7c74e8afe126b5bcad496f0b9acd3bd8793fcf167c3e78aad2b0acc789a92eca77f97f12526029a37afa2a8fe3a246b2a3c79a28bfb
|
7
|
+
data.tar.gz: 1a475a4a4288b64d8816ba8d093af3da57195165606462752060b65daf93567640992ed1517da756d52bc836703195137e67d8478d37b9a671367e0092ad60a1
|
checksums.yaml.gz.sig
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
|
-
�
|
3
|
-
|
4
|
-
�c%G�ݪ�~
|
1
|
+
��D.���k�;���'���Pf����E)��X���w'�;�[���i@���=��0����N'�[(�����пf�Y�� �>�r?��BE*�\�h;t�Ͼ��T�T�' JظG
|
2
|
+
�n"Z��w��S�h�\�&��u��h�8��2^nJ���hc�6L�$S[*.u��N�)�٥XTY��%��T�7�BWF���^/�����H��r_
|
3
|
+
I�+6<�X��w�){S"�PT ���YV��^azk�x
|
data/History.rdoc
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 3.26.0 / 2022-10-20
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Added warning to bundled minitest/test_task.
|
6
|
+
* Removed dead rcov plugin and added (simple)cov plugin.
|
7
|
+
|
8
|
+
* 1 bug fix:
|
9
|
+
|
10
|
+
* Fixed test task load path issue, prepend Hoe.include_dirs to ensure they come first.
|
11
|
+
|
1
12
|
=== 3.25.0 / 2022-08-18
|
2
13
|
|
3
14
|
* 1 minor enhancement:
|
data/Manifest.txt
CHANGED
@@ -8,6 +8,7 @@ bin/sow
|
|
8
8
|
lib/hoe.rb
|
9
9
|
lib/hoe/clean.rb
|
10
10
|
lib/hoe/compiler.rb
|
11
|
+
lib/hoe/cov.rb
|
11
12
|
lib/hoe/debug.rb
|
12
13
|
lib/hoe/deps.rb
|
13
14
|
lib/hoe/flay.rb
|
@@ -20,11 +21,9 @@ lib/hoe/package.rb
|
|
20
21
|
lib/hoe/publish.rb
|
21
22
|
lib/hoe/racc.rb
|
22
23
|
lib/hoe/rake.rb
|
23
|
-
lib/hoe/rcov.rb
|
24
24
|
lib/hoe/rdoc.rb
|
25
25
|
lib/hoe/signing.rb
|
26
26
|
lib/hoe/test.rb
|
27
|
-
lib/minitest/test_task.rb
|
28
27
|
template/.autotest.erb
|
29
28
|
template/History.txt.erb
|
30
29
|
template/Manifest.txt.erb
|
data/Rakefile
CHANGED
data/lib/hoe/clean.rb
CHANGED
data/lib/hoe/cov.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
##
|
2
|
+
# Coverage plugin for hoe. Uses simplecov.
|
3
|
+
#
|
4
|
+
# === Tasks Provided:
|
5
|
+
#
|
6
|
+
# cov:: Analyze code coverage with tests using simplecov.
|
7
|
+
|
8
|
+
module Hoe::Cov
|
9
|
+
|
10
|
+
##
|
11
|
+
# Activate the cov dependencies.
|
12
|
+
|
13
|
+
def activate_cov_deps
|
14
|
+
dependency "simplecov", "~> 0.21", :development
|
15
|
+
end
|
16
|
+
|
17
|
+
##
|
18
|
+
# Define tasks for plugin.
|
19
|
+
|
20
|
+
def define_cov_tasks
|
21
|
+
task :isolate # ensure it exists
|
22
|
+
|
23
|
+
self.clean_globs << "coverage"
|
24
|
+
|
25
|
+
desc "Run tests and analyze code coverage"
|
26
|
+
task :cov => :isolate do
|
27
|
+
test_task.test_prelude = "require \"simplecov\"; SimpleCov.start"
|
28
|
+
|
29
|
+
Rake::Task[:test].invoke
|
30
|
+
end
|
31
|
+
rescue LoadError
|
32
|
+
warn "simplecov not found"
|
33
|
+
end
|
34
|
+
end
|
data/lib/hoe/test.rb
CHANGED
@@ -10,17 +10,10 @@
|
|
10
10
|
# test_deps:: Show which test files fail when run alone.
|
11
11
|
|
12
12
|
module Hoe::Test
|
13
|
-
def deprecate msg # :nodoc:
|
14
|
-
where = caller_locations[1]
|
15
|
-
|
16
|
-
warn "DEPRECATED: %s from %s" % [msg, where]
|
17
|
-
end
|
18
|
-
|
19
13
|
##
|
20
14
|
# Configuration for the supported test frameworks for test task.
|
21
15
|
|
22
16
|
SUPPORTED_TEST_FRAMEWORKS = {
|
23
|
-
:testunit => "test/unit",
|
24
17
|
:minitest => "minitest/autorun",
|
25
18
|
:none => nil,
|
26
19
|
}
|
@@ -47,14 +40,9 @@ module Hoe::Test
|
|
47
40
|
attr_accessor :test_prelude
|
48
41
|
|
49
42
|
##
|
50
|
-
#
|
51
|
-
|
52
|
-
attr_accessor :rspec_dirs
|
53
|
-
|
54
|
-
##
|
55
|
-
# Optional: RSpec options. [default: []]
|
43
|
+
# The test task created for this plugin.
|
56
44
|
|
57
|
-
attr_accessor :
|
45
|
+
attr_accessor :test_task
|
58
46
|
|
59
47
|
##
|
60
48
|
# Initialize variables for plugin.
|
@@ -63,8 +51,7 @@ module Hoe::Test
|
|
63
51
|
self.multiruby_skip ||= []
|
64
52
|
self.testlib ||= :minitest
|
65
53
|
self.test_prelude ||= nil
|
66
|
-
self.
|
67
|
-
self.rspec_options ||= []
|
54
|
+
self.test_task = nil
|
68
55
|
end
|
69
56
|
|
70
57
|
##
|
@@ -78,43 +65,12 @@ module Hoe::Test
|
|
78
65
|
if File.directory? "test" then
|
79
66
|
case testlib
|
80
67
|
when :minitest then
|
81
|
-
require "minitest/test_task" #
|
68
|
+
require "minitest/test_task" # in minitest 5.16+
|
82
69
|
|
83
70
|
test_prelude = self.test_prelude
|
84
|
-
Minitest::TestTask.create :test do |t|
|
71
|
+
self.test_task = Minitest::TestTask.create :test do |t|
|
85
72
|
t.test_prelude = test_prelude
|
86
|
-
t.libs
|
87
|
-
end
|
88
|
-
when :testunit then
|
89
|
-
desc "Run the test suite. Use FILTER or TESTOPTS to add flags/args."
|
90
|
-
task :test do
|
91
|
-
ruby make_test_cmd
|
92
|
-
end
|
93
|
-
|
94
|
-
desc "Print out the test command. Good for profiling and other tools."
|
95
|
-
task :test_cmd do
|
96
|
-
puts make_test_cmd
|
97
|
-
end
|
98
|
-
|
99
|
-
desc "Show which test files fail when run alone."
|
100
|
-
task :test_deps do
|
101
|
-
tests = Dir[*self.test_globs].uniq
|
102
|
-
|
103
|
-
paths = %w[bin lib test].join(File::PATH_SEPARATOR)
|
104
|
-
null_dev = Hoe::WINDOZE ? "> NUL 2>&1" : "> /dev/null 2>&1"
|
105
|
-
|
106
|
-
tests.each do |test|
|
107
|
-
unless system "ruby -I#{paths} #{test} #{null_dev}" then
|
108
|
-
puts "Dependency Issues: #{test}"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
if testlib == :minitest then
|
114
|
-
desc "Show bottom 25 tests wrt time."
|
115
|
-
task "test:slow" do
|
116
|
-
sh "rake TESTOPTS=-v | sort -n -k2 -t= | tail -25"
|
117
|
-
end
|
73
|
+
t.libs.prepend Hoe.include_dirs.uniq
|
118
74
|
end
|
119
75
|
when :none then
|
120
76
|
# do nothing
|
@@ -135,16 +91,6 @@ module Hoe::Test
|
|
135
91
|
default_tasks << :test
|
136
92
|
end
|
137
93
|
|
138
|
-
if File.directory? "spec" then
|
139
|
-
found = try_loading_rspec2 || try_loading_rspec1
|
140
|
-
|
141
|
-
if found then
|
142
|
-
default_tasks << :spec
|
143
|
-
else
|
144
|
-
warn "Found spec dir, but couldn't load rspec (1 or 2) task. skipping."
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
94
|
desc "Run the default task(s)."
|
149
95
|
task :default => default_tasks
|
150
96
|
|
@@ -154,71 +100,4 @@ module Hoe::Test
|
|
154
100
|
sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(" ")}"
|
155
101
|
end
|
156
102
|
end
|
157
|
-
|
158
|
-
##
|
159
|
-
# Generate the test command-line.
|
160
|
-
|
161
|
-
def make_test_cmd
|
162
|
-
unless SUPPORTED_TEST_FRAMEWORKS.key?(testlib)
|
163
|
-
raise "unsupported test framework #{testlib}"
|
164
|
-
end
|
165
|
-
|
166
|
-
deprecate "Moving to Minitest::TestTask. Let me know if you use this!"
|
167
|
-
|
168
|
-
framework = SUPPORTED_TEST_FRAMEWORKS[testlib]
|
169
|
-
|
170
|
-
tests = ["rubygems"]
|
171
|
-
tests << framework if framework
|
172
|
-
tests << test_globs.sort.map { |g| Dir.glob(g) }
|
173
|
-
tests.flatten!
|
174
|
-
tests.map! { |f| %(require "#{f}") }
|
175
|
-
|
176
|
-
tests.insert 1, test_prelude if test_prelude
|
177
|
-
|
178
|
-
filter = (ENV["FILTER"] || ENV["TESTOPTS"] || "").dup
|
179
|
-
filter << " -n #{ENV["N"]}" if ENV["N"]
|
180
|
-
filter << " -e #{ENV["X"]}" if ENV["X"]
|
181
|
-
|
182
|
-
"#{Hoe::RUBY_FLAGS} -e '#{tests.join("; ")}' -- #{filter}"
|
183
|
-
end
|
184
|
-
|
185
|
-
##
|
186
|
-
# Attempt to load RSpec 2, returning true if successful
|
187
|
-
|
188
|
-
def try_loading_rspec2
|
189
|
-
deprecate "I want to drop this entirely. Let me know if you use this!"
|
190
|
-
|
191
|
-
require "rspec/core/rake_task"
|
192
|
-
|
193
|
-
desc "Run all specifications"
|
194
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
195
|
-
t.rspec_opts = self.rspec_options
|
196
|
-
t.rspec_opts << "-I#{self.rspec_dirs.join(":")}" unless
|
197
|
-
rspec_dirs.empty?
|
198
|
-
end
|
199
|
-
|
200
|
-
true
|
201
|
-
rescue LoadError => err
|
202
|
-
warn "%p while trying to load RSpec 2: %s" % [ err.class, err.message ]
|
203
|
-
false
|
204
|
-
end
|
205
|
-
|
206
|
-
##
|
207
|
-
# Attempt to load RSpec 1, returning true if successful
|
208
|
-
|
209
|
-
def try_loading_rspec1
|
210
|
-
deprecate "I want to drop this entirely. Let me know if you use this!"
|
211
|
-
|
212
|
-
require "spec/rake/spectask"
|
213
|
-
|
214
|
-
desc "Run all specifications"
|
215
|
-
Spec::Rake::SpecTask.new(:spec) do |t|
|
216
|
-
t.libs = self.rspec_dirs
|
217
|
-
t.spec_opts = self.rspec_options
|
218
|
-
end
|
219
|
-
true
|
220
|
-
rescue LoadError => err
|
221
|
-
warn "%p while trying to load RSpec 1: %s" % [ err.class, err.message ]
|
222
|
-
false
|
223
|
-
end
|
224
103
|
end
|
data/lib/hoe.rb
CHANGED
@@ -87,7 +87,7 @@ class Hoe
|
|
87
87
|
include Rake::DSL if defined?(Rake::DSL)
|
88
88
|
|
89
89
|
# duh
|
90
|
-
VERSION = "
|
90
|
+
VERSION = "4.0.0"
|
91
91
|
|
92
92
|
@@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package,
|
93
93
|
:publish, :gemcutter, :signing, :test]
|
@@ -726,10 +726,7 @@ class Hoe
|
|
726
726
|
if lines.first =~ /::/ then
|
727
727
|
Hash[lines.map { |line| line.split(/\s*::\s*/) }]
|
728
728
|
else
|
729
|
-
|
730
|
-
warn " Only defining 'home' url."
|
731
|
-
warn " This will be removed on or after 2020-10-28."
|
732
|
-
{ "home" => lines.first }
|
729
|
+
raise "Please switch readme to hash format for urls."
|
733
730
|
end
|
734
731
|
end
|
735
732
|
|
data/test/test_hoe.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
require "minitest/autorun"
|
3
2
|
require "hoe"
|
4
3
|
require "tempfile"
|
@@ -192,11 +191,8 @@ class TestHoe < Minitest::Test
|
|
192
191
|
"* http://docs.seattlerb.org/hoe/Hoe.pdf",
|
193
192
|
"* http://github.com/jbarnette/hoe-plugin-examples"].join "\n"
|
194
193
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
assert_output "", err do
|
199
|
-
assert_equal exp, hoe.parse_urls(ary)
|
194
|
+
assert_raises RuntimeError do
|
195
|
+
hoe.parse_urls ary
|
200
196
|
end
|
201
197
|
end
|
202
198
|
|
@@ -265,7 +261,7 @@ class TestHoe < Minitest::Test
|
|
265
261
|
h = nil
|
266
262
|
nokogiri_readme = <<~EOM
|
267
263
|
## Links
|
268
|
-
|
264
|
+
|
269
265
|
* https://nokogiri.org
|
270
266
|
* [Installation Help](https://nokogiri.org/tutorials/installing_nokogiri.html)
|
271
267
|
* [Tutorials](https://nokogiri.org/tutorials/toc.html)
|
data/test/test_hoe_debug.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
+
require "minitest/autorun"
|
1
2
|
require "hoe"
|
2
|
-
|
3
|
+
require_relative "../lib/hoe/debug"
|
3
4
|
require "tmpdir"
|
4
|
-
require "tempfile"
|
5
|
-
require "minitest/autorun"
|
6
5
|
|
7
6
|
class TestHoeDebug < Minitest::Test
|
8
7
|
|
data/test/test_hoe_gemcutter.rb
CHANGED
data/test/test_hoe_package.rb
CHANGED
data/test/test_hoe_publish.rb
CHANGED
data/test/test_hoe_test.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "minitest/autorun"
|
2
2
|
require "hoe"
|
3
|
+
require "minitest/test_task" # currently in hoe, but will move
|
3
4
|
|
4
5
|
Hoe.load_plugins # make sure Hoe::Test is loaded
|
5
6
|
|
@@ -18,14 +19,6 @@ class TestHoeTest < Minitest::Test
|
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
|
-
def assert_deprecated
|
22
|
-
err_re = /DEPRECATED:/
|
23
|
-
|
24
|
-
assert_output "", err_re do
|
25
|
-
yield
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
22
|
path = %w[lib bin test .].join File::PATH_SEPARATOR
|
30
23
|
mt_path = %w[lib test .].join File::PATH_SEPARATOR
|
31
24
|
|
@@ -37,34 +30,12 @@ class TestHoeTest < Minitest::Test
|
|
37
30
|
-e '%srequire "test/test_hoe_test.rb"'
|
38
31
|
--].join(" ") + " "
|
39
32
|
|
40
|
-
def test_make_test_cmd_defaults_to_minitest
|
41
|
-
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
42
|
-
|
43
|
-
# default
|
44
|
-
assert_deprecated do
|
45
|
-
autorun = %(require "minitest/autorun"; )
|
46
|
-
assert_equal EXPECTED % autorun, @tester.make_test_cmd
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_make_test_cmd_for_testunit
|
51
|
-
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
52
|
-
|
53
|
-
assert_deprecated do
|
54
|
-
@tester.testlib = :testunit
|
55
|
-
testunit = %(require "test/unit"; )
|
56
|
-
assert_equal EXPECTED % testunit, @tester.make_test_cmd
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
33
|
def test_make_test_cmd_for_minitest
|
61
34
|
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
62
35
|
|
63
|
-
require "minitest/test_task" # currently in hoe, but will move
|
64
|
-
|
65
36
|
framework = %(require "minitest/autorun"; )
|
66
37
|
|
67
|
-
@tester = Minitest::TestTask.create :
|
38
|
+
@tester = Minitest::TestTask.create :testtest do |t|
|
68
39
|
t.libs += Hoe.include_dirs.uniq
|
69
40
|
t.test_globs = ["test/test_hoe_test.rb"]
|
70
41
|
end
|
@@ -75,8 +46,6 @@ class TestHoeTest < Minitest::Test
|
|
75
46
|
def test_make_test_cmd_for_minitest_prelude
|
76
47
|
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
77
48
|
|
78
|
-
require "minitest/test_task" # currently in hoe, but will move
|
79
|
-
|
80
49
|
prelude = %(require "other/file")
|
81
50
|
framework = %(require "minitest/autorun"; )
|
82
51
|
|
@@ -88,24 +57,4 @@ class TestHoeTest < Minitest::Test
|
|
88
57
|
|
89
58
|
assert_equal MT_EXPECTED % [prelude, framework].join("; "), @tester.make_test_cmd
|
90
59
|
end
|
91
|
-
|
92
|
-
def test_make_test_cmd_for_no_framework
|
93
|
-
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
94
|
-
|
95
|
-
assert_deprecated do
|
96
|
-
@tester.testlib = :none
|
97
|
-
assert_equal EXPECTED % "", @tester.make_test_cmd
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_make_test_cmd_for_faketestlib
|
102
|
-
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
103
|
-
|
104
|
-
@tester.testlib = :faketestlib
|
105
|
-
e = assert_raises(RuntimeError) do
|
106
|
-
@tester.make_test_cmd
|
107
|
-
end
|
108
|
-
|
109
|
-
assert_equal "unsupported test framework faketestlib", e.to_s
|
110
|
-
end
|
111
60
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
JFmxn4h9YO/pVdB962BdBNNDia0kgIjI3ENnkLq0dKpYU3+F3KhEuTksLO0L6X/V
|
30
30
|
YsuyUzsMz6GQA4khyaMgKNSD
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2022-
|
32
|
+
date: 2022-12-15 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rake
|
@@ -51,20 +51,6 @@ dependencies:
|
|
51
51
|
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '15.0'
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: minitest
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '5.16'
|
61
|
-
type: :development
|
62
|
-
prerelease: false
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - "~>"
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '5.16'
|
68
54
|
- !ruby/object:Gem::Dependency
|
69
55
|
name: rdoc
|
70
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,6 +71,20 @@ dependencies:
|
|
85
71
|
- - "<"
|
86
72
|
- !ruby/object:Gem::Version
|
87
73
|
version: '7'
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: simplecov
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0.21'
|
81
|
+
type: :development
|
82
|
+
prerelease: false
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0.21'
|
88
88
|
description: |-
|
89
89
|
Hoe is a rake/rubygems helper for project Rakefiles. It helps you
|
90
90
|
manage, maintain, and release your project and includes a dynamic
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/hoe.rb
|
117
117
|
- lib/hoe/clean.rb
|
118
118
|
- lib/hoe/compiler.rb
|
119
|
+
- lib/hoe/cov.rb
|
119
120
|
- lib/hoe/debug.rb
|
120
121
|
- lib/hoe/deps.rb
|
121
122
|
- lib/hoe/flay.rb
|
@@ -128,11 +129,9 @@ files:
|
|
128
129
|
- lib/hoe/publish.rb
|
129
130
|
- lib/hoe/racc.rb
|
130
131
|
- lib/hoe/rake.rb
|
131
|
-
- lib/hoe/rcov.rb
|
132
132
|
- lib/hoe/rdoc.rb
|
133
133
|
- lib/hoe/signing.rb
|
134
134
|
- lib/hoe/test.rb
|
135
|
-
- lib/minitest/test_task.rb
|
136
135
|
- template/.autotest.erb
|
137
136
|
- template/History.txt.erb
|
138
137
|
- template/Manifest.txt.erb
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/hoe/rcov.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# RCov plugin for hoe.
|
3
|
-
#
|
4
|
-
# === Tasks Provided:
|
5
|
-
#
|
6
|
-
# rcov:: Analyze code coverage with tests
|
7
|
-
|
8
|
-
module Hoe::RCov
|
9
|
-
|
10
|
-
##
|
11
|
-
# Activate the rcov dependencies.
|
12
|
-
|
13
|
-
def activate_rcov_deps
|
14
|
-
dependency "rcov", "~> 0.9", :development
|
15
|
-
end
|
16
|
-
|
17
|
-
##
|
18
|
-
# Define tasks for plugin.
|
19
|
-
|
20
|
-
def define_rcov_tasks
|
21
|
-
task :isolate # ensure it exists
|
22
|
-
|
23
|
-
task :rcov => :isolate do
|
24
|
-
sh(*make_rcov_cmd)
|
25
|
-
end
|
26
|
-
|
27
|
-
task :clobber_rcov do
|
28
|
-
rm_rf "coverage"
|
29
|
-
end
|
30
|
-
|
31
|
-
task :clobber => :clobber_rcov
|
32
|
-
|
33
|
-
# this is for my emacs rcov overlay stuff on emacswiki.
|
34
|
-
task :rcov_overlay do
|
35
|
-
path = ENV["FILE"]
|
36
|
-
rcov, eol = Marshal.load(File.read("coverage.info")).last[path], 1
|
37
|
-
puts rcov[:lines].zip(rcov[:coverage]).map { |line, coverage|
|
38
|
-
bol, eol = eol, eol + line.length
|
39
|
-
[bol, eol, "#ffcccc"] unless coverage
|
40
|
-
}.compact.inspect
|
41
|
-
end
|
42
|
-
rescue LoadError
|
43
|
-
# skip
|
44
|
-
task :clobber_rcov # in case rcov didn't load
|
45
|
-
# TODO: didn't load? this must be terribly historical
|
46
|
-
end
|
47
|
-
|
48
|
-
def make_rcov_cmd # :nodoc:
|
49
|
-
rcov = Gem.bin_wrapper "rcov"
|
50
|
-
tests = test_globs.sort.map { |g| Dir.glob(g) }.flatten.map(&:inspect)
|
51
|
-
|
52
|
-
cmd = %W[#{rcov}
|
53
|
-
#{Hoe::RUBY_FLAGS}
|
54
|
-
--text-report
|
55
|
-
--no-color
|
56
|
-
--save coverage.info
|
57
|
-
-x ^/
|
58
|
-
-x tmp/isolate
|
59
|
-
--sort coverage
|
60
|
-
--sort-reverse
|
61
|
-
-o coverage
|
62
|
-
] + tests
|
63
|
-
|
64
|
-
cmd
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
task :clean => :clobber_rcov
|
data/lib/minitest/test_task.rb
DELETED
@@ -1,305 +0,0 @@
|
|
1
|
-
require "shellwords"
|
2
|
-
require "rbconfig"
|
3
|
-
require "rake/tasklib"
|
4
|
-
|
5
|
-
module Minitest # :nodoc:
|
6
|
-
|
7
|
-
##
|
8
|
-
# Minitest::TestTask is a rake helper that generates several rake
|
9
|
-
# tasks under the main test task's name-space.
|
10
|
-
#
|
11
|
-
# task <name> :: the main test task
|
12
|
-
# task <name>:cmd :: prints the command to use
|
13
|
-
# task <name>:deps :: runs each test file by itself to find dependency errors
|
14
|
-
# task <name>:slow :: runs the tests and reports the slowest 25 tests.
|
15
|
-
#
|
16
|
-
# Examples:
|
17
|
-
#
|
18
|
-
# Minitest::TestTask.create
|
19
|
-
#
|
20
|
-
# The most basic and default setup.
|
21
|
-
#
|
22
|
-
# Minitest::TestTask.create :my_tests
|
23
|
-
#
|
24
|
-
# The most basic/default setup, but with a custom name
|
25
|
-
#
|
26
|
-
# Minitest::TestTask.create :unit do |t|
|
27
|
-
# t.test_globs = ["test/unit/**/*_test.rb"]
|
28
|
-
# t.warning = false
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# Customize the name and only run unit tests.
|
32
|
-
|
33
|
-
class TestTask < Rake::TaskLib
|
34
|
-
WINDOWS = RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ # :nodoc:
|
35
|
-
|
36
|
-
##
|
37
|
-
# Create several test-oriented tasks under +name+. Takes an
|
38
|
-
# optional block to customize variables.
|
39
|
-
|
40
|
-
def self.create name = :test, &block
|
41
|
-
task = new name
|
42
|
-
task.instance_eval(&block) if block
|
43
|
-
task.process_env
|
44
|
-
task.define
|
45
|
-
task
|
46
|
-
end
|
47
|
-
|
48
|
-
##
|
49
|
-
# Extra arguments to pass to the tests. Defaults empty but gets
|
50
|
-
# populated by a number of enviroment variables:
|
51
|
-
#
|
52
|
-
# N (-n flag) :: a string or regexp of tests to run.
|
53
|
-
# X (-e flag) :: a string or regexp of tests to exclude.
|
54
|
-
# A (arg) :: quick way to inject an arbitrary argument (eg A=--help).
|
55
|
-
#
|
56
|
-
# See #process_env
|
57
|
-
|
58
|
-
attr_accessor :extra_args
|
59
|
-
|
60
|
-
##
|
61
|
-
# The code to load the framework. Defaults to requiring
|
62
|
-
# minitest/autorun...
|
63
|
-
#
|
64
|
-
# Why do I have this as an option?
|
65
|
-
|
66
|
-
attr_accessor :framework
|
67
|
-
|
68
|
-
##
|
69
|
-
# Extra library directories to include. Defaults to %w[lib test
|
70
|
-
# .]. Also uses $MT_LIB_EXTRAS allowing you to dynamically
|
71
|
-
# override/inject directories for custom runs.
|
72
|
-
|
73
|
-
attr_accessor :libs
|
74
|
-
|
75
|
-
##
|
76
|
-
# The name of the task and base name for the other tasks generated.
|
77
|
-
|
78
|
-
attr_accessor :name
|
79
|
-
|
80
|
-
##
|
81
|
-
# File globs to find test files. Defaults to something sensible to
|
82
|
-
# find test files under the test directory.
|
83
|
-
|
84
|
-
attr_accessor :test_globs
|
85
|
-
|
86
|
-
##
|
87
|
-
# Turn on ruby warnings (-w flag). Defaults to true.
|
88
|
-
|
89
|
-
attr_accessor :warning
|
90
|
-
|
91
|
-
##
|
92
|
-
# Optional: Additional ruby to run before the test framework is loaded.
|
93
|
-
|
94
|
-
attr_accessor :test_prelude
|
95
|
-
|
96
|
-
##
|
97
|
-
# Print out commands as they run. Defaults to Rake's +trace+ (-t
|
98
|
-
# flag) option.
|
99
|
-
|
100
|
-
attr_accessor :verbose
|
101
|
-
|
102
|
-
##
|
103
|
-
# Use TestTask.create instead.
|
104
|
-
|
105
|
-
def initialize name = :test # :nodoc:
|
106
|
-
self.extra_args = []
|
107
|
-
self.framework = %(require "minitest/autorun")
|
108
|
-
self.libs = %w[lib test .]
|
109
|
-
self.name = name
|
110
|
-
self.test_globs = ["test/**/{test,spec}_*.rb",
|
111
|
-
"test/**/*_{test,spec}.rb"]
|
112
|
-
self.test_prelude = nil
|
113
|
-
self.verbose = Rake.application.options.trace
|
114
|
-
self.warning = true
|
115
|
-
end
|
116
|
-
|
117
|
-
##
|
118
|
-
# Extract variables from the environment and convert them to
|
119
|
-
# command line arguments. See #extra_args.
|
120
|
-
#
|
121
|
-
# Environment Variables:
|
122
|
-
#
|
123
|
-
# MT_LIB_EXTRAS :: Extra libs to dynamically override/inject for custom runs.
|
124
|
-
# N :: Tests to run (string or /regexp/).
|
125
|
-
# X :: Tests to exclude (string or /regexp/).
|
126
|
-
# A :: Any extra arguments. Honors shell quoting.
|
127
|
-
#
|
128
|
-
# Deprecated:
|
129
|
-
#
|
130
|
-
# TESTOPTS :: For argument passing, use +A+.
|
131
|
-
# N :: For parallel testing, use +MT_CPU+.
|
132
|
-
# FILTER :: Same as +TESTOPTS+.
|
133
|
-
|
134
|
-
def process_env
|
135
|
-
warn "TESTOPTS is deprecated in Minitest::TestTask. Use A instead" if
|
136
|
-
ENV["TESTOPTS"]
|
137
|
-
warn "FILTER is deprecated in Minitest::TestTask. Use A instead" if
|
138
|
-
ENV["FILTER"]
|
139
|
-
warn "N is deprecated in Minitest::TestTask. Use MT_CPU instead" if
|
140
|
-
ENV["N"] && ENV["N"].to_i > 0
|
141
|
-
|
142
|
-
lib_extras = (ENV["MT_LIB_EXTRAS"] || "").split File::PATH_SEPARATOR
|
143
|
-
self.libs[0,0] = lib_extras
|
144
|
-
|
145
|
-
extra_args << "-n" << ENV["N"] if ENV["N"]
|
146
|
-
extra_args << "-e" << ENV["X"] if ENV["X"]
|
147
|
-
extra_args.concat Shellwords.split(ENV["TESTOPTS"]) if ENV["TESTOPTS"]
|
148
|
-
extra_args.concat Shellwords.split(ENV["FILTER"]) if ENV["FILTER"]
|
149
|
-
extra_args.concat Shellwords.split(ENV["A"]) if ENV["A"]
|
150
|
-
|
151
|
-
ENV.delete "N" if ENV["N"]
|
152
|
-
|
153
|
-
# TODO? RUBY_DEBUG = ENV["RUBY_DEBUG"]
|
154
|
-
# TODO? ENV["RUBY_FLAGS"]
|
155
|
-
|
156
|
-
extra_args.compact!
|
157
|
-
end
|
158
|
-
|
159
|
-
def define # :nodoc:
|
160
|
-
default_tasks = []
|
161
|
-
|
162
|
-
desc "Run the test suite. Use N, X, A, and TESTOPTS to add flags/args."
|
163
|
-
task name do
|
164
|
-
ruby make_test_cmd, verbose:verbose
|
165
|
-
end
|
166
|
-
|
167
|
-
desc "Print out the test command. Good for profiling and other tools."
|
168
|
-
task "#{name}:cmd" do
|
169
|
-
puts "ruby #{make_test_cmd}"
|
170
|
-
end
|
171
|
-
|
172
|
-
desc "Show which test files fail when run in isolation."
|
173
|
-
task "#{name}:isolated" do
|
174
|
-
tests = Dir[*self.test_globs].uniq
|
175
|
-
|
176
|
-
# 3 seems to be the magic number... (tho not by that much)
|
177
|
-
bad, good, n = {}, [], (ENV.delete("K") || 3).to_i
|
178
|
-
file = ENV.delete("F")
|
179
|
-
times = {}
|
180
|
-
|
181
|
-
tt0 = Time.now
|
182
|
-
|
183
|
-
n.threads_do tests.sort do |path|
|
184
|
-
t0 = Time.now
|
185
|
-
output = `#{Gem.ruby} #{make_test_cmd path} 2>&1`
|
186
|
-
t1 = Time.now - t0
|
187
|
-
|
188
|
-
times[path] = t1
|
189
|
-
|
190
|
-
if $?.success?
|
191
|
-
$stderr.print "."
|
192
|
-
good << path
|
193
|
-
else
|
194
|
-
$stderr.print "x"
|
195
|
-
bad[path] = output
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
puts "done"
|
200
|
-
puts "Ran in %.2f seconds" % [ Time.now - tt0 ]
|
201
|
-
|
202
|
-
if file then
|
203
|
-
require "json"
|
204
|
-
File.open file, "w" do |io|
|
205
|
-
io.puts JSON.pretty_generate times
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
unless good.empty?
|
210
|
-
puts
|
211
|
-
puts "# Good tests:"
|
212
|
-
puts
|
213
|
-
good.sort.each do |path|
|
214
|
-
puts "%.2fs: %s" % [times[path], path]
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
unless bad.empty?
|
219
|
-
puts
|
220
|
-
puts "# Bad tests:"
|
221
|
-
puts
|
222
|
-
bad.keys.sort.each do |path|
|
223
|
-
puts "%.2fs: %s" % [times[path], path]
|
224
|
-
end
|
225
|
-
puts
|
226
|
-
puts "# Bad Test Output:"
|
227
|
-
puts
|
228
|
-
bad.sort.each do |path, output|
|
229
|
-
puts
|
230
|
-
puts "# #{path}:"
|
231
|
-
puts output
|
232
|
-
end
|
233
|
-
exit 1
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
task "#{name}:deps" => "#{name}:isolated" # now just an alias
|
238
|
-
|
239
|
-
desc "Show bottom 25 tests wrt time."
|
240
|
-
task "#{name}:slow" do
|
241
|
-
sh ["rake #{name} TESTOPTS=-v",
|
242
|
-
"egrep '#test_.* s = .'",
|
243
|
-
"sort -n -k2 -t=",
|
244
|
-
"tail -25"].join " | "
|
245
|
-
end
|
246
|
-
|
247
|
-
default_tasks << name
|
248
|
-
|
249
|
-
desc "Run the default task(s)."
|
250
|
-
task :default => default_tasks
|
251
|
-
end
|
252
|
-
|
253
|
-
##
|
254
|
-
# Generate the test command-line.
|
255
|
-
|
256
|
-
def make_test_cmd globs = test_globs
|
257
|
-
tests = []
|
258
|
-
tests.concat Dir[*globs].sort.shuffle # TODO: SEED -> srand first?
|
259
|
-
tests.map! { |f| %(require "#{f}") }
|
260
|
-
|
261
|
-
runner = []
|
262
|
-
runner << test_prelude if test_prelude
|
263
|
-
runner << framework
|
264
|
-
runner.concat tests
|
265
|
-
runner = runner.join "; "
|
266
|
-
|
267
|
-
args = []
|
268
|
-
args << "-I#{libs.join(File::PATH_SEPARATOR)}" unless libs.empty?
|
269
|
-
args << "-w" if warning
|
270
|
-
args << '-e'
|
271
|
-
args << "'#{runner}'"
|
272
|
-
args << '--'
|
273
|
-
args << extra_args.map(&:shellescape)
|
274
|
-
|
275
|
-
args.join " "
|
276
|
-
end
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
class Work < Queue
|
281
|
-
def initialize jobs = []
|
282
|
-
super()
|
283
|
-
|
284
|
-
jobs.each do |job|
|
285
|
-
self << job
|
286
|
-
end
|
287
|
-
|
288
|
-
close
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
class Integer
|
293
|
-
def threads_do(jobs) # :nodoc:
|
294
|
-
require "thread"
|
295
|
-
q = Work.new jobs
|
296
|
-
|
297
|
-
self.times.map {
|
298
|
-
Thread.new do
|
299
|
-
while job = q.pop # go until quit value
|
300
|
-
yield job
|
301
|
-
end
|
302
|
-
end
|
303
|
-
}.each(&:join)
|
304
|
-
end
|
305
|
-
end
|