hoe 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/History.txt +11 -0
  2. data/README.txt +1 -1
  3. data/Rakefile +3 -0
  4. data/lib/hoe.rb +88 -16
  5. data/test/test_hoe.rb +5 -1
  6. metadata +6 -6
@@ -1,3 +1,14 @@
1
+ = 1.0.5 2006-10-03
2
+
3
+ * Doco cleanup.
4
+ * Removed Manifest.txt from rdoc and added title.
5
+ * Added changeset support.
6
+ * Added spec_extras for easy gemspec attribute setting.
7
+ * Added release_notes, changeset setting for releases.
8
+ * Added paragraphs_of utility method.
9
+ * Added email and rubyforge news announcement tasks.
10
+ * Url attribute may now be an array of urls.
11
+
1
12
  = 1.0.4 2006-09-23
2
13
 
3
14
  * Damnit... I messed up. There is no rubygems gem to be dependent upon. Duh.
data/README.txt CHANGED
@@ -35,7 +35,7 @@ See class rdoc for help. Hint: ri Hoe
35
35
 
36
36
  == SYNOPSYS:
37
37
 
38
- require './lib/hoe.rb'
38
+ require 'hoe'
39
39
 
40
40
  Hoe.new(projectname, version) do |p|
41
41
  # ... project specific data ...
data/Rakefile CHANGED
@@ -5,6 +5,9 @@ require './lib/hoe.rb'
5
5
  Hoe.new("hoe", Hoe::VERSION) do |p|
6
6
  p.rubyforge_name = "seattlerb"
7
7
  p.summary = "Hoe is a way to write Rakefiles much easier and cleaner."
8
+ p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
9
+ p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
10
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
8
11
  end
9
12
 
10
13
  # vim: syntax=Ruby
data/lib/hoe.rb CHANGED
@@ -50,21 +50,26 @@ require 'rbconfig'
50
50
  #
51
51
  # The attributes that you can provide inside the new block above are:
52
52
  #
53
- # ==== Mandatory (or damn good to set)
53
+ # ==== Mandatory
54
+ #
55
+ # * name - The name of the release.
56
+ # * version - The version. Don't hardcode! use a constant in the project.
57
+ #
58
+ # ==== Damn Good to Set
54
59
  #
55
60
  # * author - The author of the package. (can be array of authors)
61
+ # * changes - A description of the release's latest changes.
56
62
  # * description - A description of the project.
57
- # * email - The author's email address.
58
- # * name - The name of the release.
63
+ # * email - The author's email address. (can be array of urls)
59
64
  # * summary - A short summary of the project.
60
65
  # * url - The url of the project.
61
- # * version - The version. Don't hardcode! use a constant in the project.
62
66
  #
63
67
  # ==== Optional
64
68
  #
65
69
  # * clean_globs - An array of file patterns to delete on clean.
66
70
  # * extra_deps - An array of rubygem dependencies.
67
71
  # * rubyforge_name - The name of the rubyforge project. [default: name.downcase]
72
+ # * spec_extras - A hash of extra values to set in the gemspec.
68
73
  #
69
74
  # === Environment Variables
70
75
  #
@@ -74,7 +79,7 @@ require 'rbconfig'
74
79
  # * FILTER - Used to add flags to test_unit (e.g., -n test_borked)
75
80
 
76
81
  class Hoe
77
- VERSION = '1.0.4'
82
+ VERSION = '1.0.5'
78
83
 
79
84
  rubyprefix = Config::CONFIG['prefix']
80
85
  sitelibdir = Config::CONFIG['sitelibdir']
@@ -91,7 +96,7 @@ class Hoe
91
96
  (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
92
97
  FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
93
98
 
94
- attr_accessor :author, :bin_files, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :rubyforge_name, :spec, :summary, :test_files, :url, :version
99
+ attr_accessor :author, :bin_files, :changes, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :url, :version
95
100
 
96
101
  def initialize(name, version)
97
102
  self.name = name
@@ -102,16 +107,18 @@ class Hoe
102
107
  self.url = "http://www.zenspider.com/ZSS/Products/#{name}/"
103
108
  self.author = "Ryan Davis"
104
109
  self.email = "ryand-ruby@zenspider.com"
105
- self.clean_globs = %w(diff diff.txt demo.rb ri *.gem **/*~)
110
+ self.clean_globs = %w(diff diff.txt demo.rb email.txt ri *.gem **/*~)
111
+ self.changes = "#{author} is too lazy to write a changeset"
106
112
  self.description = "#{author} is too lazy to write a description"
107
113
  self.summary = "#{author} is too lazy to write a summary"
108
114
  self.extra_deps = []
115
+ self.spec_extras = {}
109
116
 
110
117
  if name == 'hoe' then
111
118
  extra_deps << ['rake']
112
- extra_deps << ['rubyforge']
119
+ extra_deps << ['rubyforge', '>= 0.3.0']
113
120
  else
114
- extra_deps << ['hoe']
121
+ extra_deps << ['hoe', ">= #{VERSION}"]
115
122
  end
116
123
 
117
124
  yield self if block_given?
@@ -147,7 +154,7 @@ class Hoe
147
154
  s.author = author
148
155
  end
149
156
  s.email = email
150
- s.homepage = url
157
+ s.homepage = Array(url).first
151
158
  s.rubyforge_project = rubyforge_name
152
159
 
153
160
  s.description = description
@@ -156,6 +163,10 @@ class Hoe
156
163
  s.add_dependency(*dep)
157
164
  end
158
165
 
166
+ spec_extras.each do |msg, val|
167
+ s.send "#{msg}=", val
168
+ end
169
+
159
170
  s.files = File.read("Manifest.txt").split
160
171
  s.executables = s.files.grep(/bin/) { |f| File.basename(f) }
161
172
 
@@ -216,6 +227,12 @@ class Hoe
216
227
  rf = RubyForge.new
217
228
  puts "Logging in"
218
229
  rf.login
230
+
231
+ c = rf.config
232
+ c["release_notes"] = description if description
233
+ c["release_changes"] = changes if changes
234
+ c["preformatted"] = true
235
+
219
236
  puts "Releasing #{name} v. #{version} tarball"
220
237
  release_id = rf.add_release rubyforge_name, name, version, "#{pkg}.tgz"
221
238
  if release_id then
@@ -232,9 +249,16 @@ class Hoe
232
249
 
233
250
  Rake::RDocTask.new(:docs) do |rd|
234
251
  rd.main = "README.txt"
235
- rd.options << '-d' if `which dot` =~ /\/dot/ and RUBY_PLATFORM !~ /win32/
252
+ rd.options << '-d' if RUBY_PLATFORM !~ /win32/ and `which dot` =~ /\/dot/
236
253
  rd.rdoc_dir = 'doc'
237
- rd.rdoc_files.push(*spec.files.grep(/^(lib|bin)|txt$/))
254
+ files = spec.files.grep(/^(lib|bin)|txt$/)
255
+ files -= ['Manifest.txt']
256
+ rd.rdoc_files.push(*files)
257
+
258
+ title = "#{name}-#{version} Documentation"
259
+ title = "#{rubyforge_name}'s " + title if rubyforge_name != title
260
+
261
+ rd.options << "-t #{title}"
238
262
  end
239
263
 
240
264
  desc "Generate ri locally for testing"
@@ -279,21 +303,69 @@ class Hoe
279
303
  rm_rf files unless files.empty?
280
304
  end
281
305
  end
306
+
307
+ desc 'Generate email announcement file.'
308
+ task :email do
309
+ require 'rubyforge'
310
+ subject, body = announcement
311
+
312
+ File.open("email.txt", "w") do |mail|
313
+ mail.puts subject
314
+ mail.puts
315
+ mail.puts body
316
+ end
317
+ puts "Created email.txt"
318
+ end
319
+
320
+ desc 'Post announcement to rubyforge.'
321
+ task :post_news do
322
+ require 'rubyforge'
323
+ subject, body = announcement
324
+
325
+ rf = RubyForge.new
326
+ rf.login
327
+ rf.post_news(rubyforge_name, subject, body)
328
+ puts "Posted to rubyforge"
329
+ end
330
+
331
+ desc 'Generate email announcement file and post to rubyforge.'
332
+ task :announce => [:email, :post_news]
333
+
282
334
  end # end define
283
335
 
284
- def run_tests(multi=false)
336
+ def announcement
337
+ urls = " " + Array(url).map {|s| s.strip}.join("\n ")
338
+
339
+ subject = "Subject: #{name} #{version} Released"
340
+ body = "#{name} version #{version} has been released!\n\n#{urls}\n\n#{description}\n\nChanges:\n\n#{changes}\n\n#{urls}\n"
341
+
342
+ return subject, body
343
+ end
344
+
345
+ def run_tests(multi=false) # :nodoc:
285
346
  msg = multi ? :sh : :ruby
286
347
  cmd = if test ?f, 'test/test_all.rb' then
287
348
  "#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
288
349
  else
289
- tests = (Dir.glob("test/**/test_*.rb") + ['test/unit']).map { |f|
290
- "require \"#{f}\""
291
- }
350
+ tests = ((Dir.glob("test/**/test_*.rb") + ['test/unit']).map { |f|
351
+ "require \"#{f}\""
352
+ })
292
353
  "#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
293
354
  end
294
355
  cmd = "multiruby #{cmd}" if multi
295
356
  send msg, cmd
296
357
  end
358
+
359
+ ##
360
+ # Reads a file at +path+ and spits out an array of the +paragraphs+ specified
361
+ #
362
+ # changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
363
+ # summary, *description = p.paragraphs_of('Readme.txt', 3, 3..8)
364
+
365
+ def paragraphs_of(path, *paragraphs)
366
+ file = File.read(path)
367
+ file.split(/\n\n+/).values_at(*paragraphs)
368
+ end
297
369
  end
298
370
 
299
371
  class ::Rake::SshDirPublisher # :nodoc:
@@ -9,9 +9,13 @@ class TestHoe < Test::Unit::TestCase
9
9
  Rake.application.clear
10
10
  end
11
11
 
12
+ ##
13
+ # Yes, these tests suck, but it is damn hard to test this since
14
+ # everything is forked out.
15
+
12
16
  def test_basics
13
17
  boring = %w(clobber clobber_docs clobber_package doc doc/index.html pkg pkg/blah-1.0.0 pkg/blah-1.0.0.gem pkg/blah-1.0.0.tgz redocs repackage)
14
- expected = %w(audit clean debug_gem default docs gem install multi package publish_docs release ridocs test uninstall)
18
+ expected = %w(audit announce clean debug_gem default docs email gem install multi package post_news publish_docs release ridocs test uninstall)
15
19
  expected += boring
16
20
 
17
21
  Hoe.new('blah', '1.0.0')
metadata CHANGED
@@ -3,16 +3,16 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: hoe
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.4
7
- date: 2006-09-23 00:00:00 -07:00
6
+ version: 1.0.5
7
+ date: 2006-10-03 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
11
11
  - test
12
12
  email: ryand-ruby@zenspider.com
13
- homepage: http://www.zenspider.com/ZSS/Products/hoe/
13
+ homepage: " http://rubyforge.org/projects/seattlerb/"
14
14
  rubyforge_project: seattlerb
15
- description: Ryan Davis is too lazy to write a description
15
+ description: "Hoe is a simple rake/rubygems helper for project Rakefiles. It generates all the usual tasks for projects including rdoc generation, testing, packaging, and deployment. Tasks Provided: * audit - Run ZenTest against the package * clean - Clean up all the extras * debug_gem - Show information about the gem * default - Run the default tasks * docs - Build the docs HTML Files * install - Install the package. Uses PREFIX and RUBYLIB * multi - Run the test suite using multiruby * package - Build all the packages * publish_docs - Publish RDoc to RubyForge * release - Package and upload the release to RubyForge * test - Run the test suite. Use FILTER to add to the command line. * uninstall - Uninstall the package. * upload - Upload RDoc to RubyForge See class rdoc for help. Hint: ri Hoe"
16
16
  autorequire:
17
17
  default_executable:
18
18
  bindir: bin
@@ -63,7 +63,7 @@ dependencies:
63
63
  version_requirement:
64
64
  version_requirements: !ruby/object:Gem::Version::Requirement
65
65
  requirements:
66
- - - ">"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.0.0
68
+ version: 0.3.0
69
69
  version: