hoe 3.17.2 → 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d643abe62254c9b7e7aeec57098bd6d9eda8489201fb9a20e7d757c0a2cab699
4
- data.tar.gz: 04b5b24927f2130264b78b92d4be8d9a402005d430e6f96695aafc3c3e519e9f
3
+ metadata.gz: 6de30da4ab3f81bb05f71c363bcb5abc4e17135adf2a0aa0eb24d4b10952eee3
4
+ data.tar.gz: 52ac3b48a9624a5be58e573b13857556355e7021aff97ded7543080e4dcf6ca6
5
5
  SHA512:
6
- metadata.gz: d60591f0c0b9e1cdcf7e8ae96ab9df7361ed91dbd571be49290b8e2d1662570643a4a2314ee8aaa0f52aeb9f85b80489756519593d93fadbecebed61c23410cc
7
- data.tar.gz: 89b3f5dfd0fe5ee805aceb8bb85af930100f8b5323d97aa7cfa8aa4083c40908e4521c5321af2c1aa7b6fe40a5975b56472c033df96d398b55a356015cbe0559
6
+ metadata.gz: 7388568d21b94b2810df22b5f4aba3b4566fc2fbcb3623bf58d814d3f180a0b3aed5a279f3be16081290e71994eb07a307dd83ec81f15d87e59bc227af888c9d
7
+ data.tar.gz: 7dbe503b0ba399504992d404e4d4591f8266fd881ce02571b37ea655a97b5456ffdb5aca7bd3a9a076d2b7d60781c030f5ba2471424f104071a7710cac0d5fd8
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,24 @@
1
+ === 3.18.0 / 2019-05-25
2
+
3
+ * 1 major enhancement:
4
+
5
+ * Added Minitest::TestTask (will move to minitest proper soon)
6
+
7
+ * 8 minor enhancements:
8
+
9
+ * Added 'multiruby_skip' config so it can be in global ~/.hoerc.
10
+ * Added Hoe.include_dirs to allow tasks to probe directly.
11
+ * Added X=exclude_pattern to the test plugin. Can be used in conjunction with N=select_pattern.
12
+ * Deprecated Hoe::Test.make_test_cmd (argue with me!)
13
+ * Deprecated Hoe::Test.try_loading_rspec (argue with me!)
14
+ * Deprecated Hoe::Test.try_loading_rspec2 (argue with me!)
15
+ * Deprecated testunit support (argue with me!)
16
+ * Switched normally hoe-generated test tasks over to use Minitest::TestTask.
17
+
18
+ * 1 bug fix:
19
+
20
+ * Fixed incompatibility with rubygems 3.x. (drbrain)
21
+
1
22
  === 3.17.2 / 2019-03-13
2
23
 
3
24
  * 1 bug fix:
@@ -24,6 +24,7 @@ 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
27
28
  template/.autotest.erb
28
29
  template/History.txt.erb
29
30
  template/Manifest.txt.erb
@@ -83,7 +83,7 @@ your announcements.
83
83
 
84
84
  === Manifest.txt
85
85
 
86
- <em><strong>manifest [noun]</strong> a document giving comprehensive
86
+ <em><b>manifest [noun]</b> a document giving comprehensive
87
87
  details of a ship and its cargo and other contents, passengers, and
88
88
  crew for the use of customs officers.</em>
89
89
 
@@ -100,7 +100,7 @@ There is no way in the world that a professionally run ship would ever
100
100
  run this way and there is no way that you should either.
101
101
 
102
102
  Professional software releases know _exactly_ what is in them, amateur
103
- releases _do not_. "Write better globs" is the response I often hear.
103
+ releases <em>do not</em>. "Write better globs" is the response I often hear.
104
104
  I consider myself and the people I work with to be rather smart people
105
105
  and if we get them wrong, chances are you will too. How many times
106
106
  have you peered under the covers and seen .DS_Store, emacs backup~
data/Rakefile CHANGED
@@ -7,8 +7,6 @@ Hoe.plugin :seattlerb
7
7
  Hoe.plugin :isolate
8
8
  Hoe.plugin :rdoc
9
9
 
10
- Hoe.add_include_dirs "../../minitest/dev/lib"
11
-
12
10
  Hoe.spec "hoe" do
13
11
  developer "Ryan Davis", "ryand-ruby@zenspider.com"
14
12
 
data/lib/hoe.rb CHANGED
@@ -91,7 +91,7 @@ class Hoe
91
91
  include Rake::DSL if defined?(Rake::DSL)
92
92
 
93
93
  # duh
94
- VERSION = "3.17.2"
94
+ VERSION = "3.18.0"
95
95
 
96
96
  @@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package,
97
97
  :publish, :gemcutter, :signing, :test]
@@ -275,11 +275,22 @@ class Hoe
275
275
 
276
276
  attr_accessor :version
277
277
 
278
+ @include_dirs = []
279
+
280
+ mc = (class << self; self; end)
281
+
282
+ ##
283
+ # Optional: Extra directories to use (eg for test runs). See
284
+ # +Hoe.add_include_dirs+.
285
+
286
+ mc.send :attr_accessor, :include_dirs
287
+
278
288
  ##
279
289
  # Add extra dirs to both $: and RUBY_FLAGS (for test runs and rakefile deps)
280
290
 
281
291
  def self.add_include_dirs(*dirs)
282
292
  dirs = dirs.flatten
293
+ include_dirs.concat dirs
283
294
  $:.unshift(*dirs)
284
295
  s = File::PATH_SEPARATOR
285
296
  RUBY_FLAGS.sub!(/-I/, "-I#{dirs.join(s)}#{s}")
@@ -97,7 +97,7 @@ module Hoe::Package
97
97
  version = "--version '#{version}'" if version
98
98
 
99
99
  cmd = "#{sudo}#{gem_cmd} install #{local} #{name} #{version}"
100
- cmd += " --no-rdoc --no-ri" unless rdoc
100
+ cmd += " --no-document" unless rdoc
101
101
  cmd += " #{null_dev}" unless Rake.application.options.trace
102
102
 
103
103
  puts cmd if Rake.application.options.trace
@@ -10,6 +10,12 @@
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
+
13
19
  ##
14
20
  # Configuration for the supported test frameworks for test task.
15
21
 
@@ -26,15 +32,21 @@ module Hoe::Test
26
32
 
27
33
  FILTER = (ENV["FILTER"] || ENV["TESTOPTS"] || "").dup
28
34
  FILTER << " -n #{ENV["N"]}" if ENV["N"]
35
+ FILTER << " -e #{ENV["X"]}" if ENV["X"]
29
36
 
30
37
  # this is an unfortunate naming collision. I don't use the CPU (N)
31
38
  # specifier so it is shifting to "C" inside of Hoe.
32
39
  ENV.delete "N" if ENV["N"]
33
40
  ENV["N"] = ENV["C"] if ENV["C"]
34
41
 
42
+ Hoe::DEFAULT_CONFIG["multiruby_skip"] = []
43
+
35
44
  ##
36
45
  # Optional: Array of incompatible versions for multiruby filtering.
37
46
  # Used as a regex.
47
+ #
48
+ # Can be defined both in .hoerc and in your hoe spec. Both will be
49
+ # used.
38
50
 
39
51
  attr_accessor :multiruby_skip
40
52
 
@@ -78,41 +90,59 @@ module Hoe::Test
78
90
  task :test
79
91
 
80
92
  if File.directory? "test" then
81
- desc "Run the test suite. Use FILTER or TESTOPTS to add flags/args."
82
- task :test do
83
- ruby make_test_cmd
84
- end
93
+ case testlib
94
+ when :minitest then
95
+ require "minitest/test_task" # currently in hoe, but will move
85
96
 
86
- desc "Print out the test command. Good for profiling and other tools."
87
- task :test_cmd do
88
- puts make_test_cmd
89
- end
97
+ Minitest::TestTask.create :test do |t|
98
+ t.test_prelude = self.test_prelude
99
+ t.libs += Hoe.include_dirs.uniq
100
+ end
101
+ when :testunit then
102
+ desc "Run the test suite. Use FILTER or TESTOPTS to add flags/args."
103
+ task :test do
104
+ ruby make_test_cmd
105
+ end
90
106
 
91
- desc "Run the test suite using multiruby."
92
- task :multi do
93
- ENV["EXCLUDED_VERSIONS"] = multiruby_skip.join(":")
94
- system "multiruby -S rake"
95
- end
107
+ desc "Print out the test command. Good for profiling and other tools."
108
+ task :test_cmd do
109
+ puts make_test_cmd
110
+ end
111
+
112
+ desc "Show which test files fail when run alone."
113
+ task :test_deps do
114
+ tests = Dir[*self.test_globs].uniq
96
115
 
97
- desc "Show which test files fail when run alone."
98
- task :test_deps do
99
- tests = Dir[*self.test_globs].uniq
116
+ paths = %w[bin lib test].join(File::PATH_SEPARATOR)
117
+ null_dev = Hoe::WINDOZE ? "> NUL 2>&1" : "> /dev/null 2>&1"
100
118
 
101
- paths = %w[bin lib test].join(File::PATH_SEPARATOR)
102
- null_dev = Hoe::WINDOZE ? "> NUL 2>&1" : "> /dev/null 2>&1"
119
+ tests.each do |test|
120
+ unless system "ruby -I#{paths} #{test} #{null_dev}" then
121
+ puts "Dependency Issues: #{test}"
122
+ end
123
+ end
124
+ end
103
125
 
104
- tests.each do |test|
105
- unless system "ruby -I#{paths} #{test} #{null_dev}" then
106
- puts "Dependency Issues: #{test}"
126
+ if testlib == :minitest then
127
+ desc "Show bottom 25 tests wrt time."
128
+ task "test:slow" do
129
+ sh "rake TESTOPTS=-v | sort -n -k2 -t= | tail -25"
107
130
  end
108
131
  end
132
+ when :none then
133
+ # do nothing
134
+ else
135
+ warn "Unsupported? Moving to Minitest::TestTask. Let me know if you use this!"
109
136
  end
110
137
 
111
- if testlib == :minitest then
112
- desc "Show bottom 25 tests wrt time."
113
- task "test:slow" do
114
- sh "rake TESTOPTS=-v | sort -n -k2 -t= | tail -25"
138
+ desc "Run the test suite using multiruby."
139
+ task :multi do
140
+ skip = with_config do |config, _|
141
+ config["multiruby_skip"] + self.multiruby_skip
115
142
  end
143
+
144
+ ENV["EXCLUDED_VERSIONS"] = skip.join(":")
145
+ system "multiruby -S rake"
116
146
  end
117
147
 
118
148
  default_tasks << :test
@@ -146,6 +176,8 @@ module Hoe::Test
146
176
  raise "unsupported test framework #{testlib}"
147
177
  end
148
178
 
179
+ deprecate "Moving to Minitest::TestTask. Let me know if you use this!"
180
+
149
181
  framework = SUPPORTED_TEST_FRAMEWORKS[testlib]
150
182
 
151
183
  tests = ["rubygems"]
@@ -163,6 +195,8 @@ module Hoe::Test
163
195
  # Attempt to load RSpec 2, returning true if successful
164
196
 
165
197
  def try_loading_rspec2
198
+ deprecate "I want to drop this entirely. Let me know if you use this!"
199
+
166
200
  require "rspec/core/rake_task"
167
201
 
168
202
  desc "Run all specifications"
@@ -182,6 +216,8 @@ module Hoe::Test
182
216
  # Attempt to load RSpec 1, returning true if successful
183
217
 
184
218
  def try_loading_rspec1
219
+ deprecate "I want to drop this entirely. Let me know if you use this!"
220
+
185
221
  require "spec/rake/spectask"
186
222
 
187
223
  desc "Run all specifications"
@@ -194,5 +230,4 @@ module Hoe::Test
194
230
  warn "%p while trying to load RSpec 1: %s" % [ err.class, err.message ]
195
231
  false
196
232
  end
197
-
198
233
  end
@@ -0,0 +1,217 @@
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 :do_the_thing
23
+ #
24
+ # The most basic/default setup, but with a custom name
25
+ #
26
+ # Minitest::TestTask.create :spec do |t|
27
+ # t.test_globs = ["spec/**/*_spec.rb"]
28
+ # t.libs << "../dependency/lib"
29
+ # end
30
+ #
31
+ # Customize the name, dependencies, and use a spec directory instead
32
+ # of test.
33
+
34
+ class TestTask < Rake::TaskLib
35
+ WINDOWS = RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ # :nodoc: # TODO: verify
36
+
37
+ ##
38
+ # Create several test-oriented tasks under +name+. Takes an
39
+ # optional block to customize variables.
40
+
41
+ def self.create name = :test, &block
42
+ task = new name
43
+ task.instance_eval(&block) if block
44
+ task.process_env
45
+ task.define
46
+ task
47
+ end
48
+
49
+ ##
50
+ # Extra arguments to pass to the tests. Defaults empty but gets
51
+ # populated by a number of enviroment variables:
52
+ #
53
+ # + N (-n flag) a string or regexp of tests to run.
54
+ # + X (-e flag) a string or regexp of tests to exclude.
55
+ # + TESTOPTS - extra stuff. For compatibility? I guess?
56
+ # + A (arg) - quick way to inject an arbitrary argument (eg A=--help)
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
+ def initialize name = :test # :nodoc:
103
+ self.extra_args = []
104
+ self.framework = %(require "minitest/autorun")
105
+ self.libs = %w[lib test .]
106
+ self.name = name
107
+ self.test_globs = ["test/**/{test,spec}_*.rb",
108
+ "test/**/*_{test,spec}.rb"]
109
+ self.test_prelude = nil
110
+ self.verbose = Rake.application.options.trace
111
+ self.warning = true
112
+ end
113
+
114
+ ##
115
+ # Extract variables from the environment and convert them to
116
+ # command line arguments. See +extra_args+.
117
+ #
118
+ # Environment Variables:
119
+ #
120
+ # + MT_LIB_EXTRAS - Extra libs to dynamically override/inject for custom runs.
121
+ # + N - Tests to run (string or regexp)
122
+ # + X - Tests to exclude (string or regexp)
123
+ # + TESTOPTS - deprecated, use A
124
+ # + A - Any extra arguments. Honors shell quoting.
125
+
126
+ def process_env
127
+ warn "TESTOPTS is deprecated in Minitest::TestTask. Use A instead" if
128
+ ENV["TESTOPTS"]
129
+
130
+ lib_extras = (ENV["MT_LIB_EXTRAS"] || "").split File::PATH_SEPARATOR
131
+ self.libs.prepend lib_extras
132
+
133
+ extra_args << "-n" << ENV["N"] if ENV["N"]
134
+ extra_args << "-e" << ENV["X"] if ENV["X"]
135
+ extra_args.concat Shellwords.split(ENV["TESTOPTS"]) if ENV["TESTOPTS"]
136
+ extra_args.concat Shellwords.split(ENV["A"]) if ENV["A"]
137
+
138
+ # TODO? RUBY_DEBUG = ENV["RUBY_DEBUG"]
139
+ # TODO? ENV["RUBY_FLAGS"]
140
+
141
+ extra_args.compact!
142
+ end
143
+
144
+ ##
145
+ # Create the tasks.
146
+
147
+ def define
148
+ default_tasks = []
149
+
150
+ desc "Run the test suite. Use N, X, A, and TESTOPTS to add flags/args."
151
+ task name do
152
+ ruby make_test_cmd, verbose:verbose
153
+ end
154
+
155
+ desc "Print out the test command. Good for profiling and other tools."
156
+ task "#{name}:cmd" do
157
+ puts "ruby #{make_test_cmd}"
158
+ end
159
+
160
+ desc "Show which test files fail when run alone."
161
+ task "#{name}:deps" do
162
+ tests = Dir[*self.test_globs].uniq
163
+
164
+ null_dev = WINDOWS ? "> NUL 2>&1" : "> /dev/null 2>&1"
165
+
166
+ tests.each do |test|
167
+ cmd = make_test_cmd test
168
+
169
+ if system "ruby #{cmd} #{null_dev}" then
170
+ puts "# good: #{test}"
171
+ else
172
+ puts "# bad: #{test}"
173
+ puts " ruby #{cmd}"
174
+ end
175
+ end
176
+ end
177
+
178
+ desc "Show bottom 25 tests wrt time."
179
+ task "#{name}:slow" do
180
+ sh ["rake #{name} TESTOPTS=-v",
181
+ "egrep '#test_.* s = .'",
182
+ "sort -n -k2 -t=",
183
+ "tail -25"].join " | "
184
+ end
185
+
186
+ default_tasks << name
187
+
188
+ desc "Run the default task(s)."
189
+ task :default => default_tasks
190
+ end
191
+
192
+ ##
193
+ # Generate the test command-line.
194
+
195
+ def make_test_cmd globs = test_globs
196
+ tests = []
197
+ tests.concat Dir[*globs].shuffle
198
+ tests.map! { |f| %(require "#{f}") }
199
+
200
+ runner = []
201
+ runner << framework
202
+ runner << test_prelude if test_prelude
203
+ runner.concat tests
204
+ runner = runner.join "; "
205
+
206
+ args = []
207
+ args << "-I#{libs.join(File::PATH_SEPARATOR)}" unless libs.empty?
208
+ args << "-w" if warning
209
+ args << '-e'
210
+ args << "'#{runner}'"
211
+ args << '--'
212
+ args << extra_args.map(&:shellescape)
213
+
214
+ args.join " "
215
+ end
216
+ end
217
+ end
@@ -1,3 +1,5 @@
1
+ require "hoe"
2
+
1
3
  Hoe.load_plugins
2
4
 
3
5
  class TestHoePackage < Minitest::Test
@@ -18,6 +18,14 @@ class TestHoeTest < Minitest::Test
18
18
  end
19
19
  end
20
20
 
21
+ def assert_deprecated
22
+ err_re = /DEPRECATED:/
23
+
24
+ assert_output "", err_re do
25
+ yield
26
+ end
27
+ end
28
+
21
29
  def test_make_test_cmd_with_different_testlibs
22
30
  skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
23
31
 
@@ -27,19 +35,27 @@ class TestHoeTest < Minitest::Test
27
35
  ].join
28
36
 
29
37
  # default
30
- autorun = %(require "minitest/autorun"; )
31
- assert_equal expected % autorun, @tester.make_test_cmd
38
+ assert_deprecated do
39
+ autorun = %(require "minitest/autorun"; )
40
+ assert_equal expected % autorun, @tester.make_test_cmd
41
+ end
32
42
 
33
- @tester.testlib = :testunit
34
- testunit = %(require "test/unit"; )
35
- assert_equal expected % testunit, @tester.make_test_cmd
43
+ assert_deprecated do
44
+ @tester.testlib = :testunit
45
+ testunit = %(require "test/unit"; )
46
+ assert_equal expected % testunit, @tester.make_test_cmd
47
+ end
36
48
 
37
- @tester.testlib = :minitest
38
- autorun = %(require "minitest/autorun"; )
39
- assert_equal expected % autorun, @tester.make_test_cmd
49
+ assert_deprecated do
50
+ @tester.testlib = :minitest
51
+ autorun = %(require "minitest/autorun"; )
52
+ assert_equal expected % autorun, @tester.make_test_cmd
53
+ end
40
54
 
41
- @tester.testlib = :none
42
- assert_equal expected % "", @tester.make_test_cmd
55
+ assert_deprecated do
56
+ @tester.testlib = :none
57
+ assert_equal expected % "", @tester.make_test_cmd
58
+ end
43
59
 
44
60
  @tester.testlib = :faketestlib
45
61
  e = assert_raises(RuntimeError) do
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: 3.17.2
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  Em82dBUFsipwMLCYj39kcyHWAxyl6Ae1Cn9r/ItVBCxoeFdrHjfavnrIEoXUt4bU
30
30
  UfBugfLD19bu3nvL+zTAGx/U
31
31
  -----END CERTIFICATE-----
32
- date: 2019-03-13 00:00:00.000000000 Z
32
+ date: 2019-05-26 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rake
@@ -118,6 +118,7 @@ files:
118
118
  - lib/hoe/rdoc.rb
119
119
  - lib/hoe/signing.rb
120
120
  - lib/hoe/test.rb
121
+ - lib/minitest/test_task.rb
121
122
  - template/.autotest.erb
122
123
  - template/History.txt.erb
123
124
  - template/Manifest.txt.erb
@@ -153,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  - !ruby/object:Gem::Version
154
155
  version: '1.4'
155
156
  requirements: []
156
- rubygems_version: 3.0.3
157
+ rubygems_version: 3.0.2
157
158
  signing_key:
158
159
  specification_version: 4
159
160
  summary: Hoe is a rake/rubygems helper for project Rakefiles
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- ��v"z���I�#p'��l�\v9�䤈 ��r��Mn���7*$��l?������5M�`��2h�̊�`ܝ��0�����}�. 66D��<2f ���b�$���,if�-\+r%Y��{���?��_I i��V �<�.jƵ9R�/��(��'���g�����U?�Z���̞�98�\��y�L�g�x�l!�7㈂GsP��Ǐ+���
1
+ ��gS~�ay�鑁ܒQJ�� ��>�h���?Bg��Գ����44mGb�Ւis