hoe 2.9.1 → 2.9.2

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,21 @@
1
+ === 2.9.2 / 2011-03-31
2
+
3
+ * 7 minor enhancements:
4
+
5
+ * Added :none as a testlib option to let you do whatever you want. (phiggins)
6
+ * Added Hoe#dependency(name, version, type = :runtime) for cleaner hoe specs.
7
+ * Added NOSUDO option to `rake gem_install`. (nihildeb)
8
+ * Include Rake::DSL to support future versions of rake
9
+ * Multiruby now skips mri_trunk if multiruby_skip includes 1.9
10
+ * Test#make_test_cmd now sorts test files (mostly for testing)
11
+ * Try using psych before syck.
12
+
13
+ * 3 bug fixes:
14
+
15
+ * Clean generated extension library too
16
+ * Fixed a bug with sow -d or -t
17
+ * Fixed plugin activation via ~/.hoerc. (ged)
18
+
1
19
  === 2.9.1 / 2011-02-05
2
20
 
3
21
  * 1 minor enhancement:
@@ -34,3 +34,4 @@ template/lib/file_name.rb.erb
34
34
  template/test/test_file_name.rb.erb
35
35
  test/test_hoe.rb
36
36
  test/test_hoe_gemcutter.rb
37
+ test/test_hoe_test.rb
data/README.txt CHANGED
@@ -175,7 +175,7 @@ Again, this must be done before the Hoe spec, or it won't be useful.
175
175
  * hoe-gemcutter - Adds gemcutter release automation to Hoe.
176
176
  * hoe-gemspec - Generate a prerelease gemspec based on a Hoe spec.
177
177
  * hoe-git - A set of Hoe plugins for tighter Git integration.
178
- * hoe-hg - A Hoe plugin for Mercurial integration.
178
+ * hoe-mercurial - A Hoe plugin for Mercurial integration.
179
179
  * hoe-rubygems - A Hoe plugin with additional RubyGems tasks.
180
180
  * hoe-seattlerb - Minitest, email announcements, release branching.
181
181
  * hoe-yard - A Hoe plugin for generating YARD documentation.
data/bin/sow CHANGED
@@ -13,7 +13,7 @@ option = {
13
13
  :subdir => nil,
14
14
  }
15
15
 
16
- def check_subdir
16
+ def check_subdir option
17
17
  if option[:subdir] then
18
18
  warn "ERROR: you can't specify multiple subdirs"
19
19
  abort opts.to_s
@@ -26,12 +26,12 @@ opts = OptionParser.new do |opts|
26
26
  opts.separator "Standard options:"
27
27
 
28
28
  opts.on("-t", "--trunk", "Add project to subdir under 'trunk'.") do
29
- check_subdir
29
+ check_subdir option
30
30
  option[:subdir] = "trunk"
31
31
  end
32
32
 
33
33
  opts.on("-d", "--dev", "Add project to subdir under 'dev'.") do
34
- check_subdir
34
+ check_subdir option
35
35
  option[:subdir] = "dev"
36
36
  end
37
37
 
@@ -47,8 +47,6 @@ end
47
47
 
48
48
  opts.parse!
49
49
 
50
- # TODO: fail if both dev and trunk
51
-
52
50
  include FileUtils::Verbose
53
51
 
54
52
  # variables for erb:
@@ -108,11 +106,11 @@ Dir.chdir project do
108
106
  end
109
107
  end
110
108
 
111
- if option[:dev] || option[:trunk] then
109
+ if option[:subdir] then
112
110
  temp_dir = "#{project}.#{$$}"
113
111
  FileUtils.mv project, temp_dir
114
112
  FileUtils.mkdir project
115
- FileUtils.mv temp_dir, "#{project}/#{option[:dev] ? 'dev' : 'trunk'}"
113
+ FileUtils.mv temp_dir, "#{project}/#{option[:subdir]}"
116
114
  end
117
115
 
118
116
  puts
data/lib/hoe.rb CHANGED
@@ -3,6 +3,12 @@
3
3
  require 'rubygems'
4
4
  require 'rake'
5
5
  require 'rake/testtask'
6
+
7
+ begin
8
+ require 'psych'
9
+ rescue LoadError
10
+ # do nothing
11
+ end
6
12
  require 'yaml'
7
13
 
8
14
  require 'hoe/rake'
@@ -57,8 +63,11 @@ require 'hoe/rake'
57
63
  # end
58
64
 
59
65
  class Hoe
66
+
67
+ include Rake::DSL if defined?(Rake::DSL)
68
+
60
69
  # duh
61
- VERSION = '2.9.1'
70
+ VERSION = '2.9.2'
62
71
 
63
72
  @@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package,
64
73
  :publish, :rcov, :gemcutter, :signing, :test]
@@ -231,8 +240,9 @@ class Hoe
231
240
  def self.load_plugins plugins = Hoe.plugins
232
241
  @found ||= {}
233
242
  @loaded ||= {}
243
+ @files ||= Gem.find_files "hoe/*.rb"
234
244
 
235
- Gem.find_files("hoe/*.rb").reverse.each do |path|
245
+ @files.reverse.each do |path|
236
246
  @found[File.basename(path, ".rb").intern] = path
237
247
  end
238
248
 
@@ -306,21 +316,19 @@ class Hoe
306
316
  # Activate plugin modules and add them to the current instance.
307
317
 
308
318
  def activate_plugins
309
- plugins = Hoe.plugins
310
-
311
319
  with_config do |config, _|
312
320
  config_plugins = config['plugins']
313
321
  break unless config_plugins
314
- plugins += config_plugins.map { |plugin| plugin.intern }
322
+ Hoe.plugins.concat config_plugins.map { |plugin| plugin.intern }
315
323
  end
316
324
 
317
- Hoe.load_plugins plugins
325
+ Hoe.load_plugins Hoe.plugins
318
326
 
319
327
  names = Hoe.constants.map { |s| s.to_s }
320
328
  names.reject! { |n| n =~ /^[A-Z_]+$/ }
321
329
 
322
330
  names.each do |name|
323
- next unless plugins.include? name.downcase.intern
331
+ next unless Hoe.plugins.include? name.downcase.intern
324
332
  warn "extend #{name}" if $DEBUG
325
333
  self.extend Hoe.const_get(name)
326
334
  end
@@ -332,6 +340,22 @@ class Hoe
332
340
  end
333
341
  end
334
342
 
343
+ ##
344
+ # Add a dependency declaration to your spec. Pass :dev to
345
+ # +type+ for developer dependencies.
346
+
347
+ def dependency name, version, type = :runtime
348
+ ary = case type
349
+ when :runtime then
350
+ extra_deps
351
+ when :dev, :development, :developer then
352
+ extra_dev_deps
353
+ else
354
+ raise "Unknown dependency type: #{type}"
355
+ end
356
+ ary << [name, version]
357
+ end
358
+
335
359
  ##
336
360
  # Add standard and user defined dependencies to the spec.
337
361
 
@@ -24,6 +24,8 @@ module Hoe::Compiler
24
24
  self.compile_tasks = [:multi, :test]
25
25
  self.spec_extras = { :extensions => ["ext/#{self.name}/extconf.rb"] }
26
26
 
27
+ clean_globs << "lib/#{self.name}/*.{so,bundle,dll}"
28
+
27
29
  extra_dev_deps << ["rake-compiler", "~> 0.7"]
28
30
  end
29
31
 
@@ -23,7 +23,6 @@ module Hoe::Flay
23
23
 
24
24
  def define_flay_tasks
25
25
  begin
26
- require 'flay'
27
26
  require 'flay_task'
28
27
  FlayTask.new :flay, self.flay_threshold
29
28
  rescue Exception
@@ -23,7 +23,6 @@ module Hoe::Flog
23
23
 
24
24
  def define_flog_tasks
25
25
  begin
26
- require 'flog'
27
26
  require 'flog_task'
28
27
  FlogTask.new :flog, self.flog_threshold
29
28
  rescue Exception
@@ -44,7 +44,7 @@ module Hoe::Package
44
44
  pkg.need_zip = @need_zip
45
45
  end
46
46
 
47
- desc 'Install the package as a gem.'
47
+ desc 'Install the package as a gem. (opt. NOSUDO=1)'
48
48
  task :install_gem => [:clean, :package, :check_extra_deps] do
49
49
  install_gem Dir['pkg/*.gem'].first
50
50
  end
@@ -87,7 +87,7 @@ module Hoe::Package
87
87
 
88
88
  def install_gem name, version = nil
89
89
  gem_cmd = Gem.default_exec_format % 'gem'
90
- sudo = 'sudo ' unless Hoe::WINDOZE
90
+ sudo = 'sudo ' unless Hoe::WINDOZE || ENV["NOSUDO"]
91
91
  local = '--local' unless version
92
92
  version = "--version '#{version}'" if version
93
93
  sh "#{sudo}#{gem_cmd} install #{local} #{name} #{version}"
@@ -16,6 +16,7 @@ module Hoe::Test
16
16
  SUPPORTED_TEST_FRAMEWORKS = {
17
17
  :testunit => "test/unit",
18
18
  :minitest => "minitest/autorun",
19
+ :none => nil,
19
20
  }
20
21
 
21
22
  ##
@@ -159,11 +160,16 @@ module Hoe::Test
159
160
  # Generate the test command-line.
160
161
 
161
162
  def make_test_cmd multi = false # :nodoc:
163
+ unless SUPPORTED_TEST_FRAMEWORKS.has_key?(testlib)
164
+ raise "unsupported test framework #{testlib}"
165
+ end
166
+
162
167
  framework = SUPPORTED_TEST_FRAMEWORKS[testlib]
163
- raise "unsupported test framework #{testlib}" unless framework
164
168
 
165
- tests = ["rubygems", framework] +
166
- test_globs.map { |g| Dir.glob(g) }.flatten
169
+ tests = ["rubygems"]
170
+ tests << framework if framework
171
+ tests << test_globs.sort.map { |g| Dir.glob(g) }
172
+ tests.flatten!
167
173
  tests.map! {|f| %(require "#{f}")}
168
174
 
169
175
  tests.insert 1, test_prelude if test_prelude
@@ -171,6 +177,7 @@ module Hoe::Test
171
177
  cmd = "#{Hoe::RUBY_FLAGS} -e '#{tests.join("; ")}' -- #{FILTER}"
172
178
 
173
179
  if multi then
180
+ multiruby_skip << "mri_trunk" if multiruby_skip.include? "1.9"
174
181
  ENV['EXCLUDED_VERSIONS'] = multiruby_skip.join ":"
175
182
  cmd = "-S multiruby #{cmd}"
176
183
  end
@@ -2,6 +2,12 @@ require 'minitest/autorun'
2
2
  require 'hoe'
3
3
  require 'tempfile'
4
4
 
5
+ class Hoe
6
+ def self.files= x
7
+ @files = x
8
+ end
9
+ end
10
+
5
11
  $rakefile = nil # shuts up a warning in rdoctask.rb
6
12
 
7
13
  class TestHoe < MiniTest::Unit::TestCase
@@ -35,6 +41,7 @@ class TestHoe < MiniTest::Unit::TestCase
35
41
  def test_activate_plugins_hoerc
36
42
  home = ENV['HOME']
37
43
  load_path = $LOAD_PATH.dup
44
+ Hoe.files = nil
38
45
 
39
46
  Dir.mktmpdir do |path|
40
47
  ENV['HOME'] = path
@@ -46,7 +53,7 @@ class TestHoe < MiniTest::Unit::TestCase
46
53
  end
47
54
 
48
55
  open File.join(path, '.hoerc'), 'w' do |io|
49
- io.write YAML.dump 'plugins' => %w[hoerc]
56
+ io.write YAML.dump('plugins' => %w[hoerc])
50
57
  end
51
58
 
52
59
  spec = Hoe.spec 'blah' do
@@ -60,6 +67,40 @@ class TestHoe < MiniTest::Unit::TestCase
60
67
  ensure
61
68
  Hoe.instance_variable_get(:@loaded).delete :hoerc
62
69
  Hoe.plugins.delete :hoerc
70
+ Hoe.send :remove_const, :Hoerc
71
+ $LOAD_PATH.replace load_path
72
+ ENV['HOME'] = home
73
+ end
74
+
75
+ def test_initialize_plugins_hoerc
76
+ home = ENV['HOME']
77
+ load_path = $LOAD_PATH.dup
78
+ Hoe.files = nil
79
+
80
+ Dir.mktmpdir do |path|
81
+ ENV['HOME'] = path
82
+ $LOAD_PATH << path
83
+
84
+ Dir.mkdir File.join(path, 'hoe')
85
+ open File.join(path, 'hoe', 'hoerc.rb'), 'w' do |io|
86
+ io.write 'module Hoe::Hoerc; def initialize_hoerc; @hoerc_plugin_initialized = true; end; end'
87
+ end
88
+
89
+ open File.join(path, '.hoerc'), 'w' do |io|
90
+ io.write YAML.dump('plugins' => %w[hoerc])
91
+ end
92
+
93
+ spec = Hoe.spec 'blah' do
94
+ developer 'author', 'email'
95
+ end
96
+
97
+ assert_includes spec.instance_variables.map(&:to_s), '@hoerc_plugin_initialized',
98
+ "Hoerc plugin wasn't initialized"
99
+ end
100
+ ensure
101
+ Hoe.instance_variable_get(:@loaded).delete :hoerc
102
+ Hoe.plugins.delete :hoerc
103
+ Hoe.send :remove_const, :Hoerc
63
104
  $LOAD_PATH.replace load_path
64
105
  ENV['HOME'] = home
65
106
  end
@@ -104,7 +145,7 @@ class TestHoe < MiniTest::Unit::TestCase
104
145
  assert_equal 'blah', spec.rubyforge_project
105
146
  assert_equal Gem::RubyGemsVersion, spec.rubygems_version
106
147
  assert_match(/^Hoe.*Rakefiles$/, spec.summary)
107
- assert_equal files.grep(/^test/), spec.test_files
148
+ assert_equal files.grep(/^test/).sort, spec.test_files.sort
108
149
 
109
150
  deps = spec.dependencies.sort_by { |dep| dep.name }
110
151
 
@@ -138,4 +179,21 @@ class TestHoe < MiniTest::Unit::TestCase
138
179
  assert_equal %w(two_words two_words TwoWords), Hoe.normalize_names('two-words')
139
180
  assert_equal %w(two_words two_words TwoWords), Hoe.normalize_names('two_words')
140
181
  end
182
+
183
+ def test_nosudo
184
+ hoe = Hoe.spec("blah") do
185
+ self.version = '1.2.3'
186
+ developer 'author', 'email'
187
+
188
+ def sh cmd
189
+ cmd
190
+ end
191
+ end
192
+
193
+ assert_match(/^sudo gem.*/, hoe.install_gem('foo'))
194
+ ENV['NOSUDO'] = '1'
195
+ assert_match(/^gem.*/, hoe.install_gem('foo'))
196
+ ensure
197
+ ENV.delete "NOSUDO"
198
+ end
141
199
  end
@@ -0,0 +1,46 @@
1
+ require "minitest/autorun"
2
+ require "hoe"
3
+
4
+ Hoe.load_plugins # make sure Hoe::Test is loaded
5
+
6
+ class TestHoeTest < MiniTest::Unit::TestCase
7
+ def setup
8
+ @tester = Module.new do
9
+ include Hoe::Test
10
+
11
+ extend self
12
+
13
+ initialize_test
14
+
15
+ def test_globs
16
+ ['test/**/test_*.rb']
17
+ end
18
+ end
19
+ end
20
+
21
+ def test_make_test_cmd_with_different_testlibs
22
+ expected = ['-w -Ilib:bin:test:. -e \'require "rubygems"; %s',
23
+ 'require "test/test_hoe.rb"; ',
24
+ 'require "test/test_hoe_gemcutter.rb"; ',
25
+ 'require "test/test_hoe_test.rb"',
26
+ "' -- ",
27
+ ].join
28
+
29
+ testunit = %(require "test/unit"; )
30
+ assert_equal expected % testunit, @tester.make_test_cmd
31
+
32
+ @tester.testlib = :minitest
33
+ autorun = %(require "minitest/autorun"; )
34
+ assert_equal expected % autorun, @tester.make_test_cmd
35
+
36
+ @tester.testlib = :none
37
+ assert_equal expected % "", @tester.make_test_cmd
38
+
39
+ @tester.testlib = :faketestlib
40
+ e = assert_raises(RuntimeError) do
41
+ @tester.make_test_cmd
42
+ end
43
+
44
+ assert_equal "unsupported test framework faketestlib", e.to_s
45
+ end
46
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 9
9
- - 1
10
- version: 2.9.1
9
+ - 2
10
+ version: 2.9.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-02-05 00:00:00 -08:00
39
+ date: 2011-03-31 00:00:00 -07:00
40
40
  default_executable:
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
@@ -129,6 +129,7 @@ files:
129
129
  - template/test/test_file_name.rb.erb
130
130
  - test/test_hoe.rb
131
131
  - test/test_hoe_gemcutter.rb
132
+ - test/test_hoe_test.rb
132
133
  - .gemtest
133
134
  has_rdoc: true
134
135
  homepage: http://rubyforge.org/projects/seattlerb/
@@ -162,10 +163,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
163
  requirements: []
163
164
 
164
165
  rubyforge_project: seattlerb
165
- rubygems_version: 1.4.2
166
+ rubygems_version: 1.6.2
166
167
  signing_key:
167
168
  specification_version: 3
168
169
  summary: Hoe is a rake/rubygems helper for project Rakefiles
169
170
  test_files:
170
171
  - test/test_hoe.rb
171
172
  - test/test_hoe_gemcutter.rb
173
+ - test/test_hoe_test.rb
metadata.gz.sig CHANGED
Binary file