hoe 2.1.0 → 2.2.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,22 @@
1
+ === 2.2.0 / 2009-06-17
2
+
3
+ * 8 minor enhancements:
4
+
5
+ * Alter task descriptions to say what plugin they come from. jbarnette
6
+ * Fix and improve generate_key task. Patch #20441 by Matthew Kent.
7
+ * Hoe.plugin can take multiple names. jbarnette
8
+ * Increase configurability of RDoc tasks. Patch #19597 by Sylvain Joyeux.
9
+ * Refactored and renamed email task to debug_email, removed from announce.
10
+ * Removed email task from announce task.
11
+ * Switched to seattlerb plugin
12
+ * check_extra_deps now installs developer dependencies as well
13
+
14
+ * 3 bug fixes:
15
+
16
+ * Fixed blogs entry in DEFAULT_CONFIG.
17
+ * activated but missing plugins are properly skipped now
18
+ * exclude field was missing from DEFAULT_CONFIG
19
+
1
20
  === 2.1.0 / 2009-06-14
2
21
 
3
22
  * 6 minor enhancements:
data/Rakefile CHANGED
@@ -1,9 +1,10 @@
1
1
  # -*- ruby -*-
2
2
 
3
+ $: << 'lib'
4
+
3
5
  require './lib/hoe.rb'
4
6
 
5
- Hoe.plugin :perforce
6
- Hoe.plugin :minitest
7
+ Hoe.plugin :seattlerb
7
8
 
8
9
  Hoe.spec "hoe" do
9
10
  developer "Ryan Davis", "ryand-ruby@zenspider.com"
@@ -15,4 +16,4 @@ Hoe.spec "hoe" do
15
16
  pluggable!
16
17
  end
17
18
 
18
- # vim: syntax=Ruby
19
+ # vim: syntax=ruby
data/lib/hoe.rb CHANGED
@@ -69,7 +69,7 @@ end
69
69
 
70
70
  class Hoe
71
71
  # duh
72
- VERSION = '2.1.0'
72
+ VERSION = '2.2.0'
73
73
 
74
74
  ##
75
75
  # Used to add extra flags to RUBY_FLAGS.
@@ -245,10 +245,10 @@ class Hoe
245
245
  end
246
246
 
247
247
  ##
248
- # Activate a plugin.
248
+ # Activate plugins.
249
249
 
250
- def self.plugin name
251
- self.plugins << name
250
+ def self.plugin *names
251
+ self.plugins.concat names
252
252
  end
253
253
 
254
254
  ##
@@ -451,10 +451,28 @@ class Hoe
451
451
  # Load activated plugins by calling their define tasks method.
452
452
 
453
453
  def load_plugin_tasks
454
+ bad = []
455
+
456
+ $plugin_max = self.class.plugins.map { |s| s.to_s.size }.max
457
+
454
458
  self.class.plugins.each do |plugin|
455
459
  warn plugin if $DEBUG
456
- send "define_#{plugin}_tasks"
460
+
461
+ old_tasks = Rake::Task.tasks.dup
462
+
463
+ begin
464
+ send "define_#{plugin}_tasks"
465
+ rescue NoMethodError => e
466
+ warn "warning: couldn't activate the #{plugin} plugin, skipping"
467
+ bad << plugin
468
+ next
469
+ end
470
+
471
+ (Rake::Task.tasks - old_tasks).each do |task|
472
+ task.plugin = plugin # "%-#{max}s" % plugin
473
+ end
457
474
  end
475
+ @@plugins -= bad
458
476
  end
459
477
 
460
478
  ##
@@ -542,3 +560,13 @@ class File
542
560
  File.read(path).sub(/\A\xEF\xBB\xBF/, '')
543
561
  end
544
562
  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
@@ -10,6 +10,8 @@
10
10
  module Hoe::Debug
11
11
  Hoe.plugin :debug
12
12
 
13
+ Hoe::DEFAULT_CONFIG["exclude"] = /tmp$|CVS|TAGS|\.(svn|git|DS_Store)/
14
+
13
15
  # :stopdoc:
14
16
 
15
17
  DIFF = if Hoe::WINDOZE
@@ -111,7 +111,7 @@ module Hoe::Deps
111
111
  desc 'Install missing dependencies.'
112
112
  task :check_extra_deps do
113
113
  # extra_deps = [["rubyforge", ">= 1.0.0"], ["rake", ">= 0.8.1"]]
114
- extra_deps.each do |dep|
114
+ (extra_deps + extra_dev_deps).each do |dep|
115
115
  begin
116
116
  gem(*dep)
117
117
  rescue Gem::LoadError
@@ -4,7 +4,7 @@
4
4
  # === Tasks Provided:
5
5
  #
6
6
  # announce:: Create news email file and post to rubyforge.
7
- # email:: Generate email announcement file.
7
+ # debug_email:: Generate email announcement file.
8
8
  # post_blog:: Post announcement to blog.
9
9
  # post_news:: Post announcement to rubyforge.
10
10
  # publish_docs:: Publish RDoc to RubyForge.
@@ -19,10 +19,25 @@ module Hoe::Publish
19
19
  Hoe.plugin :publish
20
20
 
21
21
  ##
22
- # *Optional*: An array of the project's blog categories. Defaults to project name.
22
+ # Optional: An array of the project's blog categories. Defaults to project
23
+ # name.
23
24
 
24
25
  attr_accessor :blog_categories
25
26
 
27
+ ##
28
+ # Optional: Name of destination directory for RDoc generated files.
29
+ # [default: rdoc]
30
+
31
+ attr_accessor :local_rdoc_dir
32
+
33
+ ##
34
+ # Optional: Should RDoc and ri generation tasks be defined? [default: true]
35
+ #
36
+ # Allows you to define custom RDoc tasks then use the publish_rdoc task to
37
+ # upload them all. See also local_rdoc_dir
38
+
39
+ attr_accessor :need_rdoc
40
+
26
41
  ##
27
42
  # Optional: Name of RDoc destination directory on Rubyforge. [default: +name+]
28
43
 
@@ -34,23 +49,25 @@ module Hoe::Publish
34
49
  attr_accessor :rsync_args
35
50
 
36
51
  Hoe::DEFAULT_CONFIG["publish_on_announce"] = true
37
- Hoe::DEFAULT_CONFIG["blog"] = [
38
- {
39
- "user" => "user",
40
- "password" => "password",
41
- "url" => "url",
42
- "blog_id" => "blog_id",
43
- "extra_headers" => {
44
- "mt_convert_breaks" => "markdown"
45
- },
46
- }
47
- ]
52
+ Hoe::DEFAULT_CONFIG["blogs"] = [
53
+ {
54
+ "user" => "user",
55
+ "password" => "password",
56
+ "url" => "url",
57
+ "blog_id" => "blog_id",
58
+ "extra_headers" => {
59
+ "mt_convert_breaks" => "markdown"
60
+ },
61
+ }
62
+ ]
48
63
 
49
64
  ##
50
65
  # Initialize variables for plugin.
51
66
 
52
67
  def initialize_publish
53
68
  self.blog_categories ||= [self.name]
69
+ self.local_rdoc_dir ||= 'doc'
70
+ self.need_rdoc ||= true
54
71
  self.remote_rdoc_dir ||= self.name
55
72
  self.rsync_args ||= '-av --delete'
56
73
  end
@@ -59,24 +76,26 @@ module Hoe::Publish
59
76
  # Define tasks for plugin.
60
77
 
61
78
  def define_publish_tasks
62
- Rake::RDocTask.new(:docs) do |rd|
63
- rd.main = readme_file
64
- rd.options << '-d' if (`which dot` =~ /\/dot/) unless
65
- ENV['NODOT'] || Hoe::WINDOZE
66
- rd.rdoc_dir = 'doc'
79
+ if need_rdoc then
80
+ Rake::RDocTask.new(:docs) do |rd|
81
+ rd.main = readme_file
82
+ rd.options << '-d' if (`which dot` =~ /\/dot/) unless
83
+ ENV['NODOT'] || Hoe::WINDOZE
84
+ rd.rdoc_dir = 'doc'
67
85
 
68
- rd.rdoc_files += spec.require_paths
69
- rd.rdoc_files += spec.extra_rdoc_files
86
+ rd.rdoc_files += spec.require_paths
87
+ rd.rdoc_files += spec.extra_rdoc_files
70
88
 
71
- title = "#{name}-#{version} Documentation"
72
- title = "#{rubyforge_name}'s " + title if rubyforge_name != name
89
+ title = "#{name}-#{version} Documentation"
90
+ title = "#{rubyforge_name}'s " + title if rubyforge_name != name
73
91
 
74
- rd.options << "-t" << title
75
- end
92
+ rd.options << "-t" << title
93
+ end
76
94
 
77
- desc 'Generate ri locally for testing.'
78
- task :ridocs => :clean do
79
- sh %q{ rdoc --ri -o ri . }
95
+ desc 'Generate ri locally for testing.'
96
+ task :ridocs => :clean do
97
+ sh %q{ rdoc --ri -o ri . }
98
+ end
80
99
  end
81
100
 
82
101
  desc 'Publish RDoc to RubyForge.'
@@ -85,7 +104,7 @@ module Hoe::Publish
85
104
  host = "#{config["username"]}@rubyforge.org"
86
105
 
87
106
  remote_dir = "/var/www/gforge-projects/#{rubyforge_name}/#{remote_rdoc_dir}"
88
- local_dir = 'doc'
107
+ local_dir = local_rdoc_dir
89
108
 
90
109
  sh %{rsync #{rsync_args} #{local_dir}/ #{host}:#{remote_dir}}
91
110
  end
@@ -98,22 +117,8 @@ module Hoe::Publish
98
117
  end
99
118
 
100
119
  desc 'Generate email announcement file.'
101
- task :email do
102
- require 'rubyforge'
103
- subject, title, body, urls = announcement
104
-
105
- File.open("email.txt", "w") do |mail|
106
- mail.puts "Subject: [ANN] #{subject}"
107
- mail.puts
108
- mail.puts title
109
- mail.puts
110
- mail.puts urls
111
- mail.puts
112
- mail.puts body
113
- mail.puts
114
- mail.puts urls
115
- end
116
- puts "Created email.txt"
120
+ task :debug_email do
121
+ puts generate_email
117
122
  end
118
123
 
119
124
  desc 'Post announcement to blog.'
@@ -153,8 +158,26 @@ module Hoe::Publish
153
158
  puts "Posted to rubyforge"
154
159
  end
155
160
 
156
- desc 'Create news email file and post to rubyforge.'
157
- task :announce => [:email, :post_news, :post_blog, :publish_on_announce ]
161
+ desc 'Announce your release.'
162
+ task :announce => [:post_news, :post_blog, :publish_on_announce ]
163
+ end
164
+
165
+ def generate_email full = nil
166
+ abort "No email 'to' entry. Run `rake config_hoe` to fix." unless
167
+ !full || email_to
168
+
169
+ from_name, from_email = author.first, email.first
170
+ subject, title, body, urls = announcement
171
+
172
+ [
173
+ full && "From: #{from_name} <#{from_email}>",
174
+ full && "To: #{email_to.join(", ")}",
175
+ full && "Date: #{Time.now.rfc2822}",
176
+ "Subject: [ANN] #{subject}",
177
+ "", title,
178
+ "", urls,
179
+ "", body,
180
+ ].compact.join("\n")
158
181
  end
159
182
 
160
183
  def announcement # :nodoc:
@@ -82,7 +82,13 @@ module Hoe::Signing
82
82
  key_file = File.expand_path key_file
83
83
  cert_file = File.expand_path cert_file
84
84
 
85
- unless File.exist? key_file or File.exist? cert_file then
85
+ unless File.exist? key_file then
86
+ puts "Generating certificate"
87
+
88
+ if File.exist? key_file then
89
+ abort "Have #{key_file} but no #{cert_file}, aborting as a precaution"
90
+ end
91
+
86
92
  warn "NOTICE: using #{email.first} for certificate" if email.size > 1
87
93
 
88
94
  sh "gem cert --build #{email.first}"
@@ -90,29 +96,25 @@ module Hoe::Signing
90
96
  mv "gem-public_cert.pem", cert_file, :verbose => true
91
97
 
92
98
  puts "Installed key and certificate."
99
+ end
93
100
 
94
- rf = RubyForge.new.configure
95
- rf.login
96
-
97
- cert_package = "#{rubyforge_name}-certificates"
101
+ rf = RubyForge.new.configure
102
+ rf.login
98
103
 
99
- begin
100
- rf.lookup 'package', cert_package
101
- rescue
102
- rf.create_package rubyforge_name, cert_package
103
- end
104
+ cert_package = "#{rubyforge_name}-certificates"
104
105
 
105
- begin
106
- rf.lookup('release', cert_package)['certificates']
107
- rf.add_file rubyforge_name, cert_package, 'certificates', cert_file
108
- rescue
109
- rf.create_package rubyforge_name, cert_package
110
- rf.add_release rubyforge_name, cert_package, 'certificates', cert_file
111
- end
106
+ begin
107
+ rf.lookup 'package', cert_package
108
+ rescue
109
+ rf.create_package rubyforge_name, cert_package
110
+ end
112
111
 
113
- puts "Uploaded certificate to release \"certificates\" in package #{cert_package}"
112
+ unless rf.lookup('release', cert_package)['certificates'] then
113
+ rf.add_release rubyforge_name, cert_package, 'certificates', cert_file
114
+ puts "Uploaded certificates to release \"certificates\" in package #{cert_package}"
114
115
  else
115
- puts "Keys already exist: #{key_file} and #{cert_file}"
116
+ puts '"certificates" release exists, adding file anyway (will not overwrite)'
117
+ rf.add_file rubyforge_name, cert_package, 'certificates', cert_file
116
118
  end
117
119
  end
118
120
  end
@@ -8,61 +8,6 @@ class TestHoe < MiniTest::Unit::TestCase
8
8
  Rake.application.clear
9
9
  end
10
10
 
11
- ##
12
- # Yes, these tests suck, but it is damn hard to test this since
13
- # everything is forked out.
14
-
15
- def test_basics
16
- boring = %w(clobber_docs
17
- clobber_package
18
- clobber_rcov
19
- gem
20
- redocs
21
- repackage)
22
- expected = %w(audit
23
- announce
24
- check_extra_deps
25
- check_manifest
26
- clean
27
- config_hoe
28
- debug_gem
29
- default
30
- deps:email
31
- deps:fetch
32
- deps:list
33
- docs
34
- email
35
- generate_key
36
- install_gem
37
- multi
38
- package
39
- post_blog
40
- post_news
41
- publish_docs
42
- rcov
43
- release
44
- release_sanity
45
- release_to_rubyforge
46
- ridocs
47
- test
48
- test_deps)
49
- expected += boring
50
-
51
- spec = Hoe.spec('blah') do
52
- self.version = '1.0.0'
53
- developer("name", "email")
54
- end
55
-
56
- assert_equal ["name"], spec.author
57
- assert_equal ["email"], spec.email
58
-
59
- tasks = Rake.application.tasks
60
- public_tasks = tasks.reject { |t| t.comment.nil? }.map { |t| t.name }.sort
61
- public_tasks -= %w(flay flog)
62
-
63
- assert_equal expected.sort, public_tasks
64
- end
65
-
66
11
  def test_possibly_better
67
12
  t = Gem::Specification::TODAY
68
13
  hoe = Hoe.spec("blah") do
@@ -108,6 +53,15 @@ class TestHoe < MiniTest::Unit::TestCase
108
53
  assert_equal ">= #{Hoe::VERSION}", dep.version_requirements.to_s
109
54
  end
110
55
 
56
+ def test_plugins
57
+ before = Hoe.plugins.dup
58
+ Hoe.plugin :first, :second
59
+ assert_equal before + [:first, :second], Hoe.plugins
60
+ ensure
61
+ # FIX: maybe add Hoe.reset
62
+ Hoe.plugins.replace before
63
+ end
64
+
111
65
  def test_rename
112
66
  # project, file_name, klass = Hoe.normalize_names 'project_name'
113
67
 
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.1.0
4
+ version: 2.2.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-14 00:00:00 -07:00
33
+ date: 2009-06-17 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file