summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Davis <ryand@zenspider.com>2008-01-30 19:38:18 -0800
committerRyan Davis <ryand@zenspider.com>2008-01-30 19:38:18 -0800
commitafa23dd844644fa4cba681d3002e4123522b011e (patch)
tree2789d7a576cded4344b714084b9248f91015550b
parent0e2579a9b7f84a305b6b531b37d22af6554b461c (diff)
downloadhoe-afa23dd844644fa4cba681d3002e4123522b011e.tar.gz
* Added autopopulation of changes from History.txt.
* Added autopopulation of urls from History.txt. * Added autopopulation of description from History.txt * Added autopopulation of summary from description. * Added description_sections to declare what sections of readme to use. * Added summary_sentences to declare how many sentences you want in summary. * Added developer(name, email) to cleanly populate both author/email arrays. * author and email now default to "doofus". * author and email warn that they'll blow up on 2008-04-01. [git-p4: depot-paths = "//src/hoe/dev/": change = 3797]
-rw-r--r--History.txt14
-rw-r--r--README.txt4
-rw-r--r--Rakefile9
-rwxr-xr-xbin/sow4
-rw-r--r--lib/hoe.rb62
5 files changed, 72 insertions, 21 deletions
diff --git a/History.txt b/History.txt
index 1425974..f36c0a1 100644
--- a/History.txt
+++ b/History.txt
@@ -1,3 +1,17 @@
+=== 1.5.0 / 2008-01-30
+
+* 9 Minor Enhancements:
+
+ * Added autopopulation of changes from History.txt.
+ * Added autopopulation of urls from History.txt.
+ * Added autopopulation of description from History.txt
+ * Added autopopulation of summary from description.
+ * Added description_sections to declare what sections of readme to use.
+ * Added summary_sentences to declare how many sentences you want in summary.
+ * Added developer(name, email) to cleanly populate both author/email arrays.
+ * author and email now default to "doofus".
+ * author and email warn that they'll blow up on 2008-04-01.
+
=== 1.4.0 / 2007-12-20
* 1 Major Enhancement:
diff --git a/README.txt b/README.txt
index 65240b5..bcd6a55 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-Hoe
+= Hoe
* http://rubyforge.org/projects/seattlerb/
* http://seattlerb.rubyforge.org/hoe/
@@ -38,7 +38,7 @@ Tasks Provided:
See class rdoc for help. Hint: ri Hoe
== FEATURES/PROBLEMS:
-
+
* Provides 'sow' for quick project directory creation.
* Make making and maintaining Rakefiles fun and easy.
diff --git a/Rakefile b/Rakefile
index 1e7c0a4..6db6deb 100644
--- a/Rakefile
+++ b/Rakefile
@@ -2,12 +2,9 @@
require './lib/hoe.rb'
-Hoe.new("hoe", Hoe::VERSION) do |p|
- p.rubyforge_name = "seattlerb"
- p.summary = "Hoe is a way to write Rakefiles much easier and cleaner."
- p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
- p.url = p.paragraphs_of('README.txt', 1).first.gsub(/^\* /, '').split(/\n/)
- p.changes = p.paragraphs_of('History.txt', 0..2).join("\n\n")
+Hoe.new("hoe", Hoe::VERSION) do |hoe|
+ hoe.rubyforge_name = "seattlerb"
+ hoe.developer("Ryan Davis", "ryand-ruby@zenspider.com")
end
# vim: syntax=Ruby
diff --git a/bin/sow b/bin/sow
index 20d9ae5..5f060db 100755
--- a/bin/sow
+++ b/bin/sow
@@ -49,8 +49,8 @@ Dir.chdir project do
end
files = {
- "History.txt" => "== 1.0.0 / #{Time.new.strftime("%Y-%m-%d")}\n\n* 1 major enhancement\n * Birthday!\n\n",
- "README.txt" => "#{project}\n by #{X} (your name)\n #{X} (url)\n\n== DESCRIPTION:\n \n#{X} (describe your package)\n\n== FEATURES/PROBLEMS:\n \n* #{X} (list of features or problems)\n\n== SYNOPSIS:\n\n #{X} (code sample of usage)\n\n== REQUIREMENTS:\n\n* #{X} (list of requirements)\n\n== INSTALL:\n\n* #{X} (sudo gem install, anything else)\n\n== LICENSE:\n\n(The MIT License)\n\nCopyright (c) #{Time.new.strftime("%Y")} #{X}\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "History.txt" => "=== 1.0.0 / #{Time.new.strftime("%Y-%m-%d")}\n\n* 1 major enhancement\n * Birthday!\n\n",
+ "README.txt" => "= #{project}\n\n* #{X} (url)\n\n== DESCRIPTION:\n\n#{X} (describe your package)\n\n== FEATURES/PROBLEMS:\n\n* #{X} (list of features or problems)\n\n== SYNOPSIS:\n\n #{X} (code sample of usage)\n\n== REQUIREMENTS:\n\n* #{X} (list of requirements)\n\n== INSTALL:\n\n* #{X} (sudo gem install, anything else)\n\n== LICENSE:\n\n(The MIT License)\n\nCopyright (c) #{Time.new.strftime("%Y")} #{X}\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
"Manifest.txt" => "",
"bin/#{file_name}" => "",
"lib/#{file_name}.rb" => "class #{klass}\n VERSION = '1.0.0'\nend",
diff --git a/lib/hoe.rb b/lib/hoe.rb
index 854a86c..77e5b59 100644
--- a/lib/hoe.rb
+++ b/lib/hoe.rb
@@ -117,7 +117,7 @@ require 'yaml'
#
class Hoe
- VERSION = '1.4.0'
+ VERSION = '1.5.0'
ruby_prefix = Config::CONFIG['prefix']
sitelibdir = Config::CONFIG['sitelibdir']
@@ -181,7 +181,7 @@ class Hoe
attr_accessor :bin_files # :nodoc:
##
- # *Recommended*: A description of the release's latest changes.
+ # Optional: A description of the release's latest changes. Auto-populates.
attr_accessor :changes
@@ -191,11 +191,16 @@ class Hoe
attr_accessor :clean_globs
##
- # *Recommended*: A description of the project.
+ # Optional: A description of the project. Auto-populates.
attr_accessor :description
##
+ # Optional: What sections from the readme to use for auto-description. Defaults to %w(description).
+
+ attr_accessor :description_sections
+
+ ##
# *Recommended*: The author's email address(es). (can be array)
attr_accessor :email
@@ -256,11 +261,16 @@ class Hoe
attr_accessor :spec_extras
##
- # *Recommended*: A short summary of the project.
+ # Optional: A short summary of the project. Auto-populates.
attr_accessor :summary
##
+ # Optional: Number of sentences from description for summary. Defaults to 1.
+
+ attr_accessor :summary_sentences
+
+ ##
# Populated automatically from the manifest. List of tests.
attr_accessor :test_files # :nodoc:
@@ -271,7 +281,7 @@ class Hoe
attr_accessor :test_globs
##
- # *Recommended*: The url(s) of the project. (can be array)
+ # Optional: The url(s) of the project. (can be array). Auto-populates.
attr_accessor :url
@@ -285,11 +295,10 @@ class Hoe
self.version = version
# Defaults
- self.author = "Ryan Davis"
- self.changes = "The author was too lazy to write a changeset"
+ self.author = []
self.clean_globs = %w(diff diff.txt email.txt ri *.gem **/*~)
- self.description = "The author was too lazy to write a description"
- self.email = "ryand-ruby@zenspider.com"
+ self.description_sections = %w(description)
+ self.email = []
self.extra_deps = []
self.need_tar = true
self.need_zip = false
@@ -298,12 +307,37 @@ class Hoe
self.rsync_args = '-av --delete'
self.rubyforge_name = name.downcase
self.spec_extras = {}
- self.summary = "The author was too lazy to write a summary"
+ self.summary_sentences = 1
self.test_globs = ['test/**/test_*.rb']
- self.url = "http://www.zenspider.com/ZSS/Products/#{name}/"
yield self if block_given?
+ # Intuit values:
+
+ history = File.read("History.txt").split(/^(===.*)/)
+ readme = File.read("README.txt").split(/^(=+ .*)$/)[1..-1]
+ sections = readme.map { |s| s =~ /^=/ ? s.strip.downcase.chomp(':').split.last : s.strip }
+ sections = Hash[*sections]
+ desc = sections.values_at(*description_sections).join("\n\n")
+ summ = desc.split(/\.\s+/).first(summary_sentences).join(". ")
+
+ self.description ||= desc
+ self.changes ||= history[0..2].join.strip
+ self.summary ||= summ
+ self.url ||= readme[1].gsub(/^\* /, '').split(/\n/).grep(/\S+/)
+
+ %w(email author).each do |field|
+ value = self.send(field)
+ if value.nil? or value.empty? then
+ if Time.now < Time.local(2008, 4, 1) then
+ warn "Hoe #{field} value not set - Fix by 2008-04-01!"
+ self.send "#{field}=", "doofus"
+ else
+ abort "Hoe #{field} value not set"
+ end
+ end
+ end
+
hoe_deps = {
'rake' => ">= #{RAKEVERSION}",
'rubyforge' => ">= #{::RubyForge::VERSION}",
@@ -322,6 +356,12 @@ class Hoe
define_tasks
end
+ def developer name, email
+ self.author << email
+ self.email << email
+ end
+ alias :[]= :developer
+
def define_tasks # :nodoc:
def with_config # :nodoc:
rc = File.expand_path("~/.hoerc")