hoe 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +9 -0
  2. data/lib/hoe.rb +35 -15
  3. data/test/test_hoe.rb +42 -0
  4. metadata +5 -3
@@ -1,3 +1,12 @@
1
+ === 1.7.0 / 2008-06-30
2
+
3
+ * 3 minor enhancements:
4
+
5
+ * Use rdoc 2.x gem if available. Eric likes his backslashes.
6
+ * Added extra_dev_deps for new rubygems developer dependencies.
7
+ * Switched hoe to dev dep. Fork off, bitches.
8
+ * Finally got a sane test that does something. Hey... it's a start.
9
+
1
10
  === 1.6.0 / 2008-06-18
2
11
 
3
12
  * 1 minor enhancement
data/lib/hoe.rb CHANGED
@@ -9,6 +9,11 @@ require 'rbconfig'
9
9
  require 'rubyforge'
10
10
  require 'yaml'
11
11
 
12
+ begin
13
+ gem 'rdoc'
14
+ rescue Gem::LoadError
15
+ end
16
+
12
17
  ##
13
18
  # hoe - a tool to help rake
14
19
  #
@@ -115,7 +120,7 @@ require 'yaml'
115
120
  #
116
121
 
117
122
  class Hoe
118
- VERSION = '1.6.0'
123
+ VERSION = '1.7.0'
119
124
 
120
125
  ruby_prefix = Config::CONFIG['prefix']
121
126
  sitelibdir = Config::CONFIG['sitelibdir']
@@ -213,6 +218,11 @@ class Hoe
213
218
 
214
219
  attr_accessor :extra_deps
215
220
 
221
+ ##
222
+ # Optional: An array of rubygem developer dependencies.
223
+
224
+ attr_accessor :extra_dev_deps
225
+
216
226
  ##
217
227
  # Populated automatically from the manifest. List of library files.
218
228
 
@@ -303,6 +313,15 @@ class Hoe
303
313
 
304
314
  attr_accessor :version
305
315
 
316
+ def normalize_deps deps
317
+ Array(deps).map { |o| String === o ? [o] : o }
318
+ end
319
+
320
+ def missing name
321
+ warn "** #{name} is missing or in the wrong format for auto-intuiting."
322
+ warn " run `sow blah` and look at its text files"
323
+ end
324
+
306
325
  def initialize(name, version) # :nodoc:
307
326
  self.name = name
308
327
  self.version = version
@@ -315,6 +334,7 @@ class Hoe
315
334
  self.blog_categories = [name]
316
335
  self.email = []
317
336
  self.extra_deps = []
337
+ self.extra_dev_deps = []
318
338
  self.multiruby_skip = []
319
339
  self.need_tar = true
320
340
  self.need_zip = false
@@ -331,11 +351,6 @@ class Hoe
331
351
 
332
352
  # Intuit values:
333
353
 
334
- def missing name
335
- warn "** #{name} is missing or in the wrong format for auto-intuiting."
336
- warn " run `sow blah` and look at its text files"
337
- end
338
-
339
354
  readme = File.read("README.txt").split(/^(=+ .*)$/)[1..-1] rescue ''
340
355
  unless readme.empty? then
341
356
  sections = readme.map { |s|
@@ -377,14 +392,15 @@ class Hoe
377
392
  'rubyforge' => ">= #{::RubyForge::VERSION}",
378
393
  }
379
394
 
380
- self.extra_deps = Array(extra_deps).map { |o| String === o ? [o] : o }
395
+ self.extra_deps = normalize_deps extra_deps
396
+ self.extra_dev_deps = normalize_deps extra_dev_deps
381
397
 
382
398
  if name == 'hoe' then
383
399
  hoe_deps.each do |pkg, vers|
384
400
  extra_deps << [pkg, vers]
385
401
  end
386
402
  else
387
- extra_deps << ['hoe', ">= #{VERSION}"] unless hoe_deps.has_key? name
403
+ extra_dev_deps << ['hoe', ">= #{VERSION}"] unless hoe_deps.has_key? name
388
404
  end
389
405
 
390
406
  define_tasks
@@ -395,14 +411,14 @@ class Hoe
395
411
  self.email << email
396
412
  end
397
413
 
398
- def define_tasks # :nodoc:
399
- def with_config # :nodoc:
400
- rc = File.expand_path("~/.hoerc")
401
- exists = File.exist? rc
402
- config = exists ? YAML.load_file(rc) : {}
403
- yield(config, rc)
404
- end
414
+ def with_config # :nodoc:
415
+ rc = File.expand_path("~/.hoerc")
416
+ exists = File.exist? rc
417
+ config = exists ? YAML.load_file(rc) : {}
418
+ yield(config, rc)
419
+ end
405
420
 
421
+ def define_tasks # :nodoc:
406
422
  desc 'Run the default tasks.'
407
423
  task :default => :test
408
424
 
@@ -462,6 +478,10 @@ class Hoe
462
478
  s.add_dependency(*dep)
463
479
  end
464
480
 
481
+ extra_dev_deps.each do |dep|
482
+ s.add_development_dependency(*dep)
483
+ end
484
+
465
485
  s.files = File.read("Manifest.txt").delete("\r").split(/\n/)
466
486
  s.executables = s.files.grep(/^bin/) { |f| File.basename(f) }
467
487
 
@@ -49,4 +49,46 @@ class TestHoe < Test::Unit::TestCase
49
49
 
50
50
  assert_equal expected.sort, public_tasks
51
51
  end
52
+
53
+ def test_possibly_better
54
+ t = Gem::Specification::TODAY
55
+ hoe = Hoe.new("blah", '1.2.3') do |h|
56
+ h.developer 'author', 'email'
57
+ end
58
+
59
+ files = File.read("Manifest.txt").split(/\n/)
60
+
61
+ spec = hoe.spec
62
+
63
+ assert_equal 'blah', spec.name
64
+ assert_equal '1.2.3', spec.version.to_s
65
+ assert_equal '>= 0', spec.required_rubygems_version.to_s
66
+
67
+ assert_equal ['author'], spec.authors
68
+ assert_equal t, spec.date
69
+ assert_equal 'sow', spec.default_executable
70
+ assert_match(/Hoe.*Rakefiles/, spec.description)
71
+ assert_equal ['email'], spec.email
72
+ assert_equal ['sow'], spec.executables
73
+ assert_equal files.grep(/txt$/), spec.extra_rdoc_files
74
+ assert_equal files, spec.files
75
+ assert_equal true, spec.has_rdoc
76
+ assert_equal "http://rubyforge.org/projects/seattlerb/", spec.homepage
77
+ assert_equal ['--main', 'README.txt'], spec.rdoc_options
78
+ assert_equal ['lib'], spec.require_paths
79
+ assert_equal 'blah', spec.rubyforge_project
80
+ assert_equal Gem::RubyGemsVersion, spec.rubygems_version
81
+ assert_match(/^Hoe.*Rakefiles$/, spec.summary)
82
+ assert_equal files.grep(/^test/), spec.test_files
83
+
84
+ deps = spec.dependencies
85
+
86
+ assert_equal 1, deps.size
87
+
88
+ dep = deps.first
89
+
90
+ assert_equal 'hoe', dep.name
91
+ assert_equal :development, dep.type
92
+ assert_equal ">= #{Hoe::VERSION}", dep.version_requirements.to_s
93
+ end
52
94
  end
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: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-18 00:00:00 -07:00
12
+ date: 2008-06-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubyforge
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -23,6 +24,7 @@ dependencies:
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: rake
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
@@ -72,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
74
  requirements: []
73
75
 
74
76
  rubyforge_project: seattlerb
75
- rubygems_version: 1.1.1
77
+ rubygems_version: 1.2.0
76
78
  signing_key:
77
79
  specification_version: 2
78
80
  summary: Hoe is a simple rake/rubygems helper for project Rakefiles