hoe 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/History.txt +28 -17
  2. data/lib/hoe.rb +118 -34
  3. data/test/test_hoe.rb +1 -0
  4. metadata +3 -3
@@ -1,4 +1,15 @@
1
- == 1.2.2 / 2007-07-23
1
+ === 1.3.0 / 2007-08-13
2
+
3
+ * 1 major enhancement:
4
+ * Hoe now builds signed gems automatically. Run the generate_key task to
5
+ automatically create a signing key.
6
+ * 4 minor enhancements:
7
+ * Extended rdoc pattern to include ext dirs.
8
+ * Fixed dependency adding for versionless dependencies.
9
+ * Added NODOT env var to disable RDoc diagram generation.
10
+ * The config_hoe task automatically merges in new config entries.
11
+
12
+ === 1.2.2 / 2007-07-23
2
13
 
3
14
  * 2 minor enhancement:
4
15
  * Added exclude parameter for check_manifest filtering to .hoerc.
@@ -6,7 +17,7 @@
6
17
  * 1 bug fix:
7
18
  * Various (untested) fixes for windows compatibility.
8
19
 
9
- == 1.2.1 / 2007-05-21
20
+ === 1.2.1 / 2007-05-21
10
21
 
11
22
  * 8 minor enhancements:
12
23
  * Allow for spaces in filenames in manifest. Thanks to Aaron Patterson.
@@ -20,14 +31,14 @@
20
31
  * 1 bug fixes:
21
32
  * Fixed executables regexp to /^bin/.
22
33
 
23
- == 1.2.0 / 2007-02-13
34
+ === 1.2.0 / 2007-02-13
24
35
 
25
36
  * Added more support for ext dirs.
26
37
  * Added a simple config file (yaml). Use 'rake config_hoe' to edit.
27
38
  * Added post_blog task (thanks Aaron!), configured via config_hoe.
28
39
  * Announce task now posts to your blogs and/or publishes API depending on config.
29
40
 
30
- == 1.1.7 / 2007-01-10
41
+ === 1.1.7 / 2007-01-10
31
42
 
32
43
  * extra_deps is now self-healing, and ensures no (direct) cycles.
33
44
  * cleans check_manifest for CVS projects.
@@ -35,22 +46,22 @@
35
46
  * Now uses rsync for publish_docs. YAY for fast!
36
47
  * Bug #7193 fix spelling of 'synopsys'. Submitted by Jacob Atzen.
37
48
 
38
- == 1.1.6 / 2006-11-29
49
+ === 1.1.6 / 2006-11-29
39
50
 
40
51
  * Fix release to work correctly with need_zip and need_tar.
41
52
 
42
- == 1.1.5 / 2006-11-29
53
+ === 1.1.5 / 2006-11-29
43
54
 
44
55
  * Reduced check_manifest dependencies to just diff for windows.
45
56
  * Don't use default author in summary, description or changes.
46
57
 
47
- == 1.1.4 / 2006-11-12
58
+ === 1.1.4 / 2006-11-12
48
59
 
49
60
  * Added need_tar and need_zip to customize package requirements. Stupid windoze.
50
61
  * Extended spec_extras to take procs as values. Passes in named parameter.
51
62
  * Removed test from require_paths. I thought I already parameterized this. :/
52
63
 
53
- == 1.1.3 / 2006-11-09
64
+ === 1.1.3 / 2006-11-09
54
65
 
55
66
  * Added test_deps, now you can automatically discover test dependency ommisions.
56
67
  * Added ext support! Build C extensions with hoe!
@@ -59,7 +70,7 @@
59
70
  * Fixed doco and automated updating of it.
60
71
  * Added rdoc_pattern. Go doco go!
61
72
 
62
- == 1.1.2 / 2006-10-22
73
+ === 1.1.2 / 2006-10-22
63
74
 
64
75
  * Added -d and -t flags to sow to make dev or trunk subdirs for p4 and svn projects.
65
76
  * Added install_gem to further test gem builds.
@@ -67,17 +78,17 @@
67
78
  * Removed demo.rb from clean_globs. I'm torn on this one.
68
79
  * Fixed bug in install rule.
69
80
 
70
- == 1.1.1 / 2006-10-11
81
+ === 1.1.1 / 2006-10-11
71
82
 
72
83
  * Fixed minor problem with subject of email.
73
84
  * Fixed problem in test.
74
85
 
75
- == 1.1.0 / 2006-10-04
86
+ === 1.1.0 / 2006-10-04
76
87
 
77
88
  * Added sow, a command-line tool for quickly creating new projects.
78
89
  * Added check_manifest task
79
90
 
80
- == 1.0.5 / 2006-10-03
91
+ === 1.0.5 / 2006-10-03
81
92
 
82
93
  * Doco cleanup.
83
94
  * Removed Manifest.txt from rdoc and added title.
@@ -88,11 +99,11 @@
88
99
  * Added email and rubyforge news announcement tasks.
89
100
  * Url attribute may now be an array of urls.
90
101
 
91
- == 1.0.4 / 2006-09-23
102
+ === 1.0.4 / 2006-09-23
92
103
 
93
104
  * Damnit... I messed up. There is no rubygems gem to be dependent upon. Duh.
94
105
 
95
- == 1.0.3 / 2006-09-23
106
+ === 1.0.3 / 2006-09-23
96
107
 
97
108
  * Added debug_gem rule.
98
109
  * Added lots of doco.
@@ -105,12 +116,12 @@
105
116
  * Renamed upload to publish_docs.
106
117
  * publish_docs is now smart about subprojects and missing subdirectories.
107
118
 
108
- == 1.0.2 / 2006-09-20
119
+ === 1.0.2 / 2006-09-20
109
120
 
110
121
  * Wee little tests.
111
122
  * Fixed up gemspec's require_paths.
112
123
 
113
- == 1.0.1 / 2006-09-20
124
+ === 1.0.1 / 2006-09-20
114
125
 
115
126
  * Finally got deployment straightened out. Maybe. Some might be on rubyforge.org.
116
127
  * Added default description and summary.
@@ -118,6 +129,6 @@
118
129
  * Improved gemspec debugging.
119
130
  * Swapped gem with tgz in deploy... we'd rather screw up on tgz
120
131
 
121
- == 1.0.0 / 2006-09-19
132
+ === 1.0.0 / 2006-09-19
122
133
 
123
134
  * Birthday!
data/lib/hoe.rb CHANGED
@@ -8,6 +8,7 @@ require 'rake/rdoctask'
8
8
  require 'rake/testtask'
9
9
  require 'rbconfig'
10
10
  require 'rubyforge'
11
+ require 'yaml'
11
12
 
12
13
  ##
13
14
  # hoe - a tool to help rake
@@ -64,12 +65,39 @@ require 'rubyforge'
64
65
  # exclude:: A regular expression of files to exclude from
65
66
  # +check_manifest+.
66
67
  # publish_on_announce:: Run +publish_docs+ when you run +release+.
68
+ # signing_key_file:: Signs your gems with this private key.
69
+ # signing_cert_file:: Signs your gem with this certificate.
67
70
  # blogs:: An array of hashes of blog settings.
68
71
  #
69
72
  # Run +config_hoe+ and see ~/.hoerc for examples.
70
73
  #
74
+ # === Signing Gems:
75
+ #
76
+ # Run the 'generate_key' task. This will:
77
+ #
78
+ # 1. Configure your ~/.hoerc.
79
+ # 2. Generate a signing key and certificate.
80
+ # 3. Install the private key and public certificate files into ~/.gem.
81
+ # 4. Upload the certificate to RubyForge.
82
+ #
83
+ # Hoe will now generate signed gems when the package task is run. If you have
84
+ # multiple machines you build gems on, be sure to install your key and
85
+ # certificate on each machine.
86
+ #
87
+ # Keep your private key secret! Keep your private key safe!
88
+ #
89
+ # To make sure your gems are signed run:
90
+ #
91
+ # rake package; tar tf pkg/yourproject-1.2.3.gem
92
+ #
93
+ # If your gem is signed you will see:
94
+ #
95
+ # data.tar.gz
96
+ # data.tar.gz.sig
97
+ # metadata.gz
98
+ # metadata.gz.sig
71
99
  class Hoe
72
- VERSION = '1.2.2'
100
+ VERSION = '1.3.0'
73
101
 
74
102
  ruby_prefix = Config::CONFIG['prefix']
75
103
  sitelibdir = Config::CONFIG['sitelibdir']
@@ -243,7 +271,7 @@ class Hoe
243
271
  self.extra_deps = []
244
272
  self.need_tar = true
245
273
  self.need_zip = false
246
- self.rdoc_pattern = /^(lib|bin)|txt$/
274
+ self.rdoc_pattern = /^(lib|bin|ext)|txt$/
247
275
  self.remote_rdoc_dir = name
248
276
  self.rsync_args = '-av --delete'
249
277
  self.rubyforge_name = name.downcase
@@ -259,9 +287,8 @@ class Hoe
259
287
  'rubyforge' => ">= #{::RubyForge::VERSION}",
260
288
  }
261
289
 
262
- self.extra_deps = Array(extra_deps) # just in case user used = instead of <<
263
- self.extra_deps = [extra_deps] unless
264
- extra_deps.empty? or Array === extra_deps.first
290
+ self.extra_deps = Array(extra_deps).map { |o| String === o ? [o] : o }
291
+
265
292
  if name == 'hoe' then
266
293
  hoe_deps.each do |pkg, version|
267
294
  extra_deps << [pkg, version]
@@ -274,6 +301,13 @@ class Hoe
274
301
  end
275
302
 
276
303
  def define_tasks # :nodoc:
304
+ def with_config # :nodoc:
305
+ rc = File.expand_path("~/.hoerc")
306
+ exists = File.exist? rc
307
+ config = exists ? YAML.load_file(rc) : {}
308
+ yield(config, rc)
309
+ end
310
+
277
311
  desc 'Run the default tasks'
278
312
  task :default => :test
279
313
 
@@ -301,6 +335,18 @@ class Hoe
301
335
  ############################################################
302
336
  # Packaging and Installing
303
337
 
338
+ signing_key = nil
339
+ cert_chain = []
340
+
341
+ with_config do |config, path|
342
+ break unless config['signing_key_file'] and config['signing_cert_file']
343
+ key_file = File.expand_path config['signing_key_file'].to_s
344
+ signing_key = key_file if File.exist? key_file
345
+
346
+ cert_file = File.expand_path config['signing_cert_file'].to_s
347
+ cert_chain << cert_file if File.exist? cert_file
348
+ end
349
+
304
350
  self.spec = Gem::Specification.new do |s|
305
351
  s.name = name
306
352
  s.version = version
@@ -338,6 +384,11 @@ class Hoe
338
384
  s.test_files = Dir[*test_globs]
339
385
  end
340
386
 
387
+ if signing_key and cert_chain then
388
+ s.signing_key = signing_key
389
+ s.cert_chain = cert_chain
390
+ end
391
+
341
392
  # Do any extra stuff the user wants
342
393
  spec_extras.each do |msg, val|
343
394
  case val
@@ -424,7 +475,7 @@ class Hoe
424
475
 
425
476
  Rake::RDocTask.new(:docs) do |rd|
426
477
  rd.main = "README.txt"
427
- rd.options << '-d' if RUBY_PLATFORM !~ /win32/ and `which dot` =~ /\/dot/
478
+ rd.options << '-d' if RUBY_PLATFORM !~ /win32/ and `which dot` =~ /\/dot/ and not ENV['NODOT']
428
479
  rd.rdoc_dir = 'doc'
429
480
  files = spec.files.grep(rdoc_pattern)
430
481
  files -= ['Manifest.txt']
@@ -454,32 +505,14 @@ class Hoe
454
505
 
455
506
  # no doco for this one
456
507
  task :publish_on_announce do
457
- with_config do |rc, path|
458
- if rc["publish_on_announce"] then
459
- Rake::Task['publish_docs'].invoke
460
- end
508
+ with_config do |config, _|
509
+ Rake::Task['publish_docs'].invoke if config["publish_on_announce"]
461
510
  end
462
511
  end
463
512
 
464
513
  ############################################################
465
514
  # Misc/Maintenance:
466
515
 
467
- def with_config(create=false) # :nodoc:
468
- require 'yaml'
469
- rc = File.expand_path("~/.hoerc")
470
-
471
- unless create then
472
- if test ?f, rc then
473
- config = YAML.load_file(rc)
474
- yield(config, rc)
475
- end
476
- else
477
- unless test ?f, rc then
478
- yield(rc)
479
- end
480
- end
481
- end
482
-
483
516
  desc 'Run ZenTest against the package'
484
517
  task :audit do
485
518
  libs = %w(lib test ext).join(File::PATH_SEPARATOR)
@@ -496,10 +529,12 @@ class Hoe
496
529
 
497
530
  desc 'Create a fresh ~/.hoerc file'
498
531
  task :config_hoe do
499
- with_config(:create) do |rc, path|
500
- blog = {
532
+ with_config do |config, path|
533
+ default_config = {
501
534
  "exclude" => /tmp$|CVS|\.svn/,
502
535
  "publish_on_announce" => false,
536
+ "signing_key_file" => "~/.gem/gem-private_key.pem",
537
+ "signing_cert_file" => "~/.gem/gem-public_cert.pem",
503
538
  "blogs" => [ {
504
539
  "user" => "user",
505
540
  "url" => "url",
@@ -510,14 +545,12 @@ class Hoe
510
545
  "password"=>"password",
511
546
  } ],
512
547
  }
513
- File.open(rc, "w") do |f|
514
- YAML.dump(blog, f)
548
+ File.open(path, "w") do |f|
549
+ YAML.dump(default_config.merge(config), f)
515
550
  end
516
- end
517
551
 
518
- with_config do |rc, path|
519
552
  editor = ENV['EDITOR'] || 'vi'
520
- system "#{editor} #{path}"
553
+ system "#{editor} #{path}" if ENV['SHOW_EDITOR'] != 'no'
521
554
  end
522
555
  end
523
556
 
@@ -545,8 +578,9 @@ class Hoe
545
578
  require 'xmlrpc/client'
546
579
 
547
580
  with_config do |config, path|
548
- subject, title, body, urls = announcement
581
+ break unless config['blogs']
549
582
 
583
+ subject, title, body, urls = announcement
550
584
  body += "\n\n#{urls}"
551
585
 
552
586
  config['blogs'].each do |site|
@@ -596,6 +630,56 @@ class Hoe
596
630
  end
597
631
  end
598
632
 
633
+ desc 'Generate a key for signing your gems.'
634
+ task :generate_key do
635
+ email = spec.email
636
+ abort "No email in your gemspec" if email.nil? or email.empty?
637
+
638
+ key_file = with_config { |config, _| config['signing_key_file'] }
639
+ cert_file = with_config { |config, _| config['signing_cert_file'] }
640
+
641
+ if key_file.nil? or cert_file.nil? then
642
+ ENV['SHOW_EDITOR'] ||= 'no'
643
+ Rake::Task['config_hoe'].invoke
644
+
645
+ key_file = with_config { |config, _| config['signing_key_file'] }
646
+ cert_file = with_config { |config, _| config['signing_cert_file'] }
647
+ end
648
+
649
+ key_file = File.expand_path key_file
650
+ cert_file = File.expand_path cert_file
651
+
652
+ unless File.exist? key_file or File.exist? cert_file then
653
+ sh "gem cert --build #{email}"
654
+ mv "gem-private_key.pem", key_file, :verbose => true
655
+ mv "gem-public_cert.pem", cert_file, :verbose => true
656
+
657
+ puts "Installed key and certificate."
658
+
659
+ rf = RubyForge.new
660
+ rf.login
661
+
662
+ cert_package = "#{rubyforge_name}-certificates"
663
+
664
+ begin
665
+ rf.lookup 'package', cert_package
666
+ rescue
667
+ rf.create_package rubyforge_name, cert_package
668
+ end
669
+
670
+ begin
671
+ rf.lookup('release', cert_package)['certificates']
672
+ rf.add_file rubyforge_name, cert_package, 'certificates', cert_file
673
+ rescue
674
+ rf.add_release rubyforge_name, cert_package, 'certificates', cert_file
675
+ end
676
+
677
+ puts "Uploaded certificate to release \"certificates\" in package #{cert_package}"
678
+ else
679
+ puts "Keys already exist."
680
+ end
681
+ end
682
+
599
683
  end # end define
600
684
 
601
685
  def announcement # :nodoc:
@@ -24,6 +24,7 @@ class TestHoe < Test::Unit::TestCase
24
24
  default
25
25
  docs
26
26
  email
27
+ generate_key
27
28
  install
28
29
  install_gem
29
30
  multi
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: hoe
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.2.2
7
- date: 2007-07-23 00:00:00 -07:00
6
+ version: 1.3.0
7
+ date: 2007-08-13 00:00:00 -07:00
8
8
  summary: Hoe is a way to write Rakefiles much easier and cleaner.
9
9
  require_paths:
10
10
  - lib
@@ -59,7 +59,7 @@ dependencies:
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 0.4.2
62
+ version: 0.4.4
63
63
  version:
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: rake