hoe 2.2.0 → 2.3.0

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,25 @@
1
+ === 2.3.0 / 2009-06-23
2
+
3
+ * 1 major enhancement:
4
+
5
+ * Plugins can no longer be self-activating.
6
+
7
+ * 8 minor enhancements:
8
+
9
+ * All hoe plugins are pre-activated.
10
+ * Allow RDoc title to be set via spec_extras['rdoc_options'].
11
+ * Cleaned up plugin activation.
12
+ * History intuition extended for markdown. drnic/jbarnette
13
+ * Move RDoc task requires to hoe/publish.rb.
14
+ * Only activated plugins are loaded, extended, and activated.
15
+ * Plugin loading deferred until hoe-spec creation, allowing proper meta-plugins.
16
+ * inline plugin adds RubyInline dependency and hooks clean task.
17
+
18
+ * 2 bug fixes:
19
+
20
+ * Fixed developer load order error in load_plugins.
21
+ * rcov should use test_globs. apatterson
22
+
1
23
  === 2.2.0 / 2009-06-17
2
24
 
3
25
  * 8 minor enhancements:
data/lib/hoe.rb CHANGED
@@ -3,20 +3,11 @@
3
3
  require 'rubygems'
4
4
  require 'rake'
5
5
  require 'rake/gempackagetask'
6
- begin
7
- require 'rdoc/task'
8
- rescue LoadError
9
- require 'rake/rdoctask'
10
- end
11
6
  require 'rake/testtask'
12
- require 'rbconfig'
13
7
  require 'rubyforge'
14
8
  require 'yaml'
15
9
 
16
- begin
17
- gem 'rdoc'
18
- rescue Gem::LoadError
19
- end
10
+ require 'hoe/rake'
20
11
 
21
12
  ##
22
13
  # Hoe is a simple rake/rubygems helper for project Rakefiles. It helps
@@ -69,7 +60,10 @@ end
69
60
 
70
61
  class Hoe
71
62
  # duh
72
- VERSION = '2.2.0'
63
+ VERSION = '2.3.0'
64
+
65
+ @@plugins = [:clean, :debug, :deps, :flay, :flog, :package, :publish,
66
+ :rcov, :signing, :test]
73
67
 
74
68
  ##
75
69
  # Used to add extra flags to RUBY_FLAGS.
@@ -216,19 +210,22 @@ class Hoe
216
210
  # It is called at the end of hoe.rb
217
211
 
218
212
  def self.load_plugins
219
- loaded = {}
213
+ loaded, found = {}, {}
220
214
 
221
- Gem.find_files("hoe/*.rb").each do |plugin|
222
- warn plugin if $DEBUG
223
- name = File.basename plugin
215
+ Gem.find_files("hoe/*.rb").reverse.each do |path|
216
+ found[File.basename(path, ".rb").intern] = path
217
+ end
218
+
219
+ :keep_doing_this while found.map { |name, plugin|
220
+ next unless Hoe.plugins.include? name
224
221
  next if loaded[name]
225
222
  begin
226
- load plugin
227
- loaded[name] = true
223
+ warn "loading #{plugin}" if $DEBUG
224
+ loaded[name] = load plugin
228
225
  rescue LoadError => e
229
226
  warn "error loading #{plugin.inspect}: #{e.message}. skipping..."
230
227
  end
231
- end
228
+ }.any?
232
229
  end
233
230
 
234
231
  ##
@@ -255,13 +252,15 @@ class Hoe
255
252
  # Return the list of activated plugins.
256
253
 
257
254
  def self.plugins
258
- @@plugins ||= []
255
+ @@plugins
259
256
  end
260
257
 
261
258
  ##
262
259
  # Create a new hoe-specification executing the supplied block
263
260
 
264
261
  def self.spec name, &block
262
+ Hoe.load_plugins
263
+
265
264
  spec = self.new name
266
265
  spec.activate_plugins
267
266
  spec.instance_eval(&block)
@@ -273,12 +272,19 @@ class Hoe
273
272
  # Activate plugin modules and add them to the current instance.
274
273
 
275
274
  def activate_plugins
276
- self.class.constants.reject { |n| n =~ /^[A-Z_]+$/ }.each do |name|
275
+ names = self.class.constants.map { |s| s.to_s }
276
+ names.reject! { |n| n =~ /^[A-Z_]+$/ }
277
+
278
+ names.each do |name|
279
+ next unless Hoe.plugins.include? name.downcase.intern
280
+ warn "extend #{name}" if $DEBUG
277
281
  self.extend Hoe.const_get(name)
278
282
  end
279
283
 
280
- self.class.plugins.each do |plugin|
281
- send "initialize_#{plugin}" rescue nil
284
+ Hoe.plugins.each do |plugin|
285
+ msg = "initialize_#{plugin}"
286
+ warn msg if $DEBUG
287
+ send msg if self.respond_to? msg
282
288
  end
283
289
  end
284
290
 
@@ -345,15 +351,6 @@ class Hoe
345
351
  s.extra_rdoc_files.reject! { |f| f =~ %r%^(test|spec|vendor|template|data|tmp)/% }
346
352
  s.extra_rdoc_files += @extra_rdoc_files
347
353
 
348
- # Do any extra stuff the user wants
349
- spec_extras.each do |msg, val|
350
- case val
351
- when Proc
352
- val.call(s.send(msg))
353
- else
354
- s.send "#{msg}=", val
355
- end
356
- end
357
354
  end
358
355
 
359
356
  unless self.version then
@@ -372,6 +369,16 @@ class Hoe
372
369
  warn "Add 'VERSION = \"x.y.z\"' to your code or fix your hoe spec"
373
370
  end
374
371
  end
372
+
373
+ # Do any extra stuff the user wants
374
+ spec_extras.each do |msg, val|
375
+ case val
376
+ when Proc
377
+ val.call spec.send(msg)
378
+ else
379
+ spec.send "#{msg}=", val
380
+ end
381
+ end
375
382
  end
376
383
 
377
384
  ##
@@ -412,6 +419,7 @@ class Hoe
412
419
 
413
420
  if block_given? then
414
421
  warn "Hoe.new {...} deprecated. Switch to Hoe.spec."
422
+ Hoe.load_plugins
415
423
  self.activate_plugins
416
424
  yield self
417
425
  post_initialize
@@ -422,12 +430,13 @@ class Hoe
422
430
  # Intuit values from the readme and history files.
423
431
 
424
432
  def intuit_values
425
- readme = File.read_utf(readme_file).split(/^(=+ .*)$/)[1..-1] rescue ''
433
+ header_re = /^((?:=+|#+) .*)$/
434
+ readme = File.read_utf(readme_file).split(header_re)[1..-1] rescue ''
435
+
426
436
  unless readme.empty? then
427
- sections = readme.map { |s|
428
- s =~ /^=/ ? s.strip.downcase.chomp(':').split.last : s.strip
429
- }
430
- sections = Hash[*sections]
437
+ sections = Hash[*readme.map { |s|
438
+ s =~ /^[=#]/ ? s.strip.downcase.chomp(':').split.last : s.strip
439
+ }]
431
440
  desc = sections.values_at(*description_sections).join("\n\n")
432
441
  summ = desc.split(/\.\s+/).first(summary_sentences).join(". ")
433
442
 
@@ -440,7 +449,7 @@ class Hoe
440
449
 
441
450
  self.changes ||= begin
442
451
  h = File.read_utf(history_file)
443
- h.split(/^(===.*)/)[1..2].join.strip
452
+ h.split(/^(={2,}|\#{2,})/)[1..2].join.strip
444
453
  rescue
445
454
  missing history_file
446
455
  ''
@@ -469,7 +478,7 @@ class Hoe
469
478
  end
470
479
 
471
480
  (Rake::Task.tasks - old_tasks).each do |task|
472
- task.plugin = plugin # "%-#{max}s" % plugin
481
+ task.plugin = plugin
473
482
  end
474
483
  end
475
484
  @@plugins -= bad
@@ -550,8 +559,6 @@ class Hoe
550
559
  config = exists ? YAML.load_file(rc) : {}
551
560
  yield(config, rc)
552
561
  end
553
-
554
- Hoe.load_plugins
555
562
  end
556
563
 
557
564
  class File
@@ -560,13 +567,3 @@ class File
560
567
  File.read(path).sub(/\A\xEF\xBB\xBF/, '')
561
568
  end
562
569
  end
563
-
564
- module Rake
565
- class Task
566
- attr_accessor :plugin
567
- alias :old_comment :comment
568
- def comment
569
- "%-#{$plugin_max}s # %s" % [plugin, old_comment] if old_comment
570
- end
571
- end
572
- end
@@ -6,8 +6,6 @@
6
6
  # clean:: Clean up all the extras.
7
7
 
8
8
  module Hoe::Clean
9
- Hoe.plugin :clean # activate globally, fine for general purpose tasks
10
-
11
9
  ##
12
10
  # Optional: An array of file patterns to delete on clean.
13
11
 
@@ -8,8 +8,6 @@
8
8
  # debug_gem:: Show information about the gem.
9
9
 
10
10
  module Hoe::Debug
11
- Hoe.plugin :debug
12
-
13
11
  Hoe::DEFAULT_CONFIG["exclude"] = /tmp$|CVS|TAGS|\.(svn|git|DS_Store)/
14
12
 
15
13
  # :stopdoc:
@@ -11,8 +11,6 @@ require 'rubygems/remote_fetcher'
11
11
  # deps:list:: List all the dependent gems of this gem
12
12
 
13
13
  module Hoe::Deps
14
- Hoe.plugin :deps
15
-
16
14
  ##
17
15
  # The main rubygems repository.
18
16
 
@@ -6,8 +6,6 @@
6
6
  # flay:: Analyze for code duplication.
7
7
 
8
8
  module Hoe::Flay
9
- Hoe.plugin :flay
10
-
11
9
  ##
12
10
  # Optional: flay threshold to determine threshold failure. [default: 1200-100]
13
11
 
@@ -6,8 +6,6 @@
6
6
  # flog:: Analyze code complexity.
7
7
 
8
8
  module Hoe::Flog
9
- Hoe.plugin :flog
10
-
11
9
  ##
12
10
  # Optional: flog threshold to determine threshold failure. [default: 1500-200]
13
11
 
@@ -1,3 +1,5 @@
1
+ require 'rbconfig'
2
+
1
3
  ##
2
4
  # Hoe allows bundling of pre-compiled extensions in the +package+ task.
3
5
  #
@@ -16,11 +18,14 @@
16
18
  # +FORCE_PLATFORM+ (instead of default Gem::Platform::CURRENT)
17
19
 
18
20
  module Hoe::Inline
19
-
20
21
  ##
21
22
  # Define tasks for plugin.
22
23
 
23
24
  def define_inline_tasks
25
+ extra_deps << 'RubyInline'
26
+ clean_globs << File.expand_path("~/.ruby_inline")
27
+ task :test => :clean
28
+
24
29
  if ENV['INLINE'] then
25
30
  s.platform = ENV['FORCE_PLATFORM'] || Gem::Platform::CURRENT
26
31
 
@@ -7,8 +7,6 @@
7
7
  # release:: Package and upload the release to rubyforge.
8
8
 
9
9
  module Hoe::Package
10
- Hoe.plugin :package
11
-
12
10
  ##
13
11
  # Optional: Should package create a tarball? [default: true]
14
12
 
@@ -1,3 +1,14 @@
1
+ begin
2
+ gem 'rdoc'
3
+ rescue Gem::LoadError
4
+ end
5
+
6
+ begin
7
+ require 'rdoc/task'
8
+ rescue LoadError
9
+ require 'rake/rdoctask'
10
+ end
11
+
1
12
  ##
2
13
  # Publish plugin for hoe.
3
14
  #
@@ -16,8 +27,6 @@
16
27
  # blogs:: An array of hashes of blog settings.
17
28
 
18
29
  module Hoe::Publish
19
- Hoe.plugin :publish
20
-
21
30
  ##
22
31
  # Optional: An array of the project's blog categories. Defaults to project
23
32
  # name.
@@ -26,7 +35,7 @@ module Hoe::Publish
26
35
 
27
36
  ##
28
37
  # Optional: Name of destination directory for RDoc generated files.
29
- # [default: rdoc]
38
+ # [default: doc]
30
39
 
31
40
  attr_accessor :local_rdoc_dir
32
41
 
@@ -86,10 +95,20 @@ module Hoe::Publish
86
95
  rd.rdoc_files += spec.require_paths
87
96
  rd.rdoc_files += spec.extra_rdoc_files
88
97
 
89
- title = "#{name}-#{version} Documentation"
90
- title = "#{rubyforge_name}'s " + title if rubyforge_name != name
98
+ title = spec.rdoc_options.grep(/^(-t|--title)=?$/).first
99
+
100
+ if title then
101
+ rd.options << title
91
102
 
92
- rd.options << "-t" << title
103
+ unless title =~ /=/ then # for ['-t', 'title here']
104
+ title_index = spec.rdoc_options.index(title)
105
+ rd.options << spec.rdoc_options[title_index + 1]
106
+ end
107
+ else
108
+ title = "#{name}-#{version} Documentation"
109
+ title = "#{rubyforge_name}'s " + title if rubyforge_name != name
110
+ rd.options << '--title' << title
111
+ end
93
112
  end
94
113
 
95
114
  desc 'Generate ri locally for testing.'
@@ -1,4 +1,12 @@
1
1
  module Rake
2
+ class Task
3
+ attr_accessor :plugin
4
+ alias :old_comment :comment
5
+ def comment
6
+ "%-#{$plugin_max}s # %s" % [plugin, old_comment] if old_comment
7
+ end
8
+ end
9
+
2
10
  module TaskManager
3
11
  ##
4
12
  # This gives us access to the tasks already defined in rake.
@@ -41,4 +49,4 @@ module Rake
41
49
  all_tasks[name].actions.delete_at(-1)
42
50
  end
43
51
  end
44
- end unless Rake.respond_to? :all_tasks
52
+ end
@@ -6,8 +6,6 @@
6
6
  # rcov:: Analyze code coverage with tests
7
7
 
8
8
  module Hoe::RCov
9
- Hoe.plugin :rcov
10
-
11
9
  ##
12
10
  # Define tasks for plugin.
13
11
 
@@ -16,7 +14,7 @@ module Hoe::RCov
16
14
  require 'rcov/rcovtask'
17
15
 
18
16
  Rcov::RcovTask.new do |t|
19
- pattern = ENV['PATTERN'] || 'test/test_*.rb'
17
+ pattern = ENV['PATTERN'] || test_globs
20
18
 
21
19
  t.test_files = FileList[pattern]
22
20
  t.verbose = true
@@ -37,8 +37,6 @@
37
37
  # metadata.gz.sig
38
38
 
39
39
  module Hoe::Signing
40
- Hoe.plugin :signing
41
-
42
40
  Hoe::DEFAULT_CONFIG["signing_key_file"] = "~/.gem/gem-private_key.pem"
43
41
  Hoe::DEFAULT_CONFIG["signing_cert_file"] = "~/.gem/gem-public_cert.pem"
44
42
 
@@ -10,8 +10,6 @@
10
10
  # test_deps:: Show which test files fail when run alone.
11
11
 
12
12
  module Hoe::Test
13
- Hoe.plugin :test # activate globally, fine for general purpose tasks
14
-
15
13
  ##
16
14
  # Configuration for the supported test frameworks for test task.
17
15
 
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: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -30,7 +30,7 @@ cert_chain:
30
30
  FBHgymkyj/AOSqKRIpXPhjC6
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-06-17 00:00:00 -07:00
33
+ date: 2009-06-23 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file