about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-24 08:52:55 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-24 09:02:12 +0000
commit43e3d3f7a8dd2b184c8485469c2acff3dac34009 (patch)
treed605a400799b874c78f4f1299b9c4eb38317fe97
parent7e0dc42f7084e1719456a80b2e44049133c2e8b7 (diff)
downloadrainbows-43e3d3f7a8dd2b184c8485469c2acff3dac34009.tar.gz
It is a common base so we can share documentation tasks
more easily with Unicorn and it ensures our RDoc no longer
has JavaScript in it!
-rw-r--r--.document1
-rw-r--r--.gitignore1
-rw-r--r--.wrongdoc.yml8
-rw-r--r--Documentation/comparison.haml5
-rw-r--r--GNUmakefile85
-rw-r--r--Rakefile99
-rw-r--r--Summary7
-rw-r--r--rainbows.gemspec29
8 files changed, 47 insertions, 188 deletions
diff --git a/.document b/.document
index 699583e..d8f91c9 100644
--- a/.document
+++ b/.document
@@ -2,6 +2,7 @@ ChangeLog
 DEPLOY
 FAQ
 lib
+LATEST
 LICENSE
 NEWS
 rainbows_1
diff --git a/.gitignore b/.gitignore
index a9cb887..e71d8b3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ pkg/
 /.manifest
 /GIT-VERSION-FILE
 /man
+/LATEST
diff --git a/.wrongdoc.yml b/.wrongdoc.yml
new file mode 100644
index 0000000..78dba2d
--- /dev/null
+++ b/.wrongdoc.yml
@@ -0,0 +1,8 @@
+---
+cgit_url: http://git.bogomips.org/cgit/rainbows.git
+git_url: git://git.bogomips.org/rainbows.git
+rdoc_url: http://rainbows.rubyforge.org/
+changelog_start: v0.97.0
+merge_html:
+  rainbows_1: Documentation/rainbows.1.html
+  Summary: Documentation/comparison.html
diff --git a/Documentation/comparison.haml b/Documentation/comparison.haml
index d9382bc..d1f689f 100644
--- a/Documentation/comparison.haml
+++ b/Documentation/comparison.haml
@@ -1,3 +1,8 @@
+%h1 Rainbows! at a glance
+%p
+  Confused by all the options we give you?  So are we!  Here's some tables
+  to help keep your head straight.  Remember, engineering is all about
+  trade-offs.
 %h2 core features and compatibility
 %br
 %table.comp
diff --git a/GNUmakefile b/GNUmakefile
index f3ececc..01c5906 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -4,7 +4,6 @@ MRI = ruby
 RUBY = ruby
 RAKE = rake
 RSYNC = rsync
-GIT_URL = git://git.bogomips.org/rainbows.git
 
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
         @./GIT-VERSION-GEN
@@ -43,80 +42,36 @@ clean:
         -$(MAKE) -C Documentation clean
         $(RM) $(setup_rb_files) $(t_log)
 
-man:
-        $(MAKE) -C Documentation install-man
+man html:
+        $(MAKE) -C Documentation install-$@
 
-pkg_extra := GIT-VERSION-FILE NEWS ChangeLog
-manifest: $(pkg_extra) man
-        $(RM) .manifest
-        $(MAKE) .manifest
+ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
+        wrongdoc prepare
 
 .manifest:
-        (git ls-files && \
-         for i in $@ $(pkg_extra) $(man1_paths); \
-         do echo $$i; done) | LC_ALL=C sort > $@+
+        (git ls-files && for i in $@ $(pkg_extra) ; do echo $$i; done) | \
+          LC_ALL=C sort > $@+
         cmp $@+ $@ || mv $@+ $@
         $(RM) $@+
 
-NEWS: GIT-VERSION-FILE
-        $(RAKE) -s news_rdoc > $@+
-        mv $@+ $@
-
-SINCE = 0.97.0
-ChangeLog: LOG_VERSION = \
-  $(shell git rev-parse -q "$(GIT_VERSION)" >/dev/null 2>&1 && \
-          echo $(GIT_VERSION) || git describe)
-ChangeLog: log_range = v$(SINCE)..$(LOG_VERSION)
-ChangeLog: GIT-VERSION-FILE
-        @echo "ChangeLog from $(GIT_URL) ($(log_range))" > $@+
-        @echo >> $@+
-        git log $(log_range) | sed -e 's/^/    /' >> $@+
-        mv $@+ $@
 
-news_atom := http://rainbows.rubyforge.org/NEWS.atom.xml
-cgit_atom := http://git.bogomips.org/cgit/rainbows.git/atom/?h=master
-atom = <link rel="alternate" title="Atom feed" href="$(1)" \
-             type="application/atom+xml"/>
-
-# using rdoc 2.5.x+
-doc: .document NEWS ChangeLog
+doc: .document man html .wrongdoc.yml
+        $(MAKE) -C Documentation comparison.html
         for i in $(man1_rdoc); do echo > $$i; done
         find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';'
-        rdoc -t "$(shell sed -ne '1s/^= //p' README)"
+        $(RM) -r doc
+        wrongdoc all
         install -m644 COPYING doc/COPYING
-        install -m644 $(shell grep '^[A-Z]' .document)  doc/
-        $(MAKE) -C Documentation install-html install-man
+        install -m644 $(shell grep '^[A-Z]' .document) doc/
         install -m644 $(man1_paths) doc/
-        cd doc && for i in $(base_bins); do \
-          $(RM) 1.html $${i}.1.html; \
-          sed -e '/"documentation">/r man1/'$$i'.1.html' \
-                < $${i}_1.html > tmp && mv tmp $${i}_1.html; \
-          ln $${i}_1.html $${i}.1.html; \
-          done
-        $(MRI) -i -p -e \
-          '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
-          doc/ChangeLog.html
-        $(MRI) -i -p -e \
-          '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
-          doc/NEWS.html doc/README.html
-        $(RAKE) -s news_atom > doc/NEWS.atom.xml
-        cd doc && ln README.html tmp && mv tmp index.html
-        $(MAKE) -C Documentation comparison.html
-        $(MRI) -i -p -e \
-          '$$_.gsub!(/INCLUDE/){File.read("Documentation/comparison.html")}' \
-          doc/Summary.html
         cat Documentation/comparison.css >> doc/rdoc.css
         $(RM) $(man1_rdoc)
 
-# publishes docs to http://rainbows.rubyforge.org
-publish_doc: NEWS
+publish_doc:
         -git set-file-times
-        $(RM) -r doc ChangeLog NEWS
-        $(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
-        awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' \
-         < NEWS > doc/LATEST
-        -find doc/images doc/js -type f | \
-                TZ=UTC xargs touch -d '1970-01-01 00:00:01' doc/rdoc.css
+        $(MAKE) doc
+        -find doc/images -type f | \
+                TZ=UTC xargs touch -d '1970-01-01 00:00:02' doc/rdoc.css
         chmod 644 $$(find doc -type f)
         $(RSYNC) -av doc/ rubyforge.org:/var/www/gforge-projects/rainbows/
         git ls-files | xargs touch
@@ -132,10 +87,10 @@ release_changes := release_changes-$(VERSION)
 release-notes: $(release_notes)
 release-changes: $(release_changes)
 $(release_changes):
-        $(RAKE) -s release_changes > $@+
+        wrongdoc release_changes > $@+
         $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
 $(release_notes):
-        GIT_URL=$(GIT_URL) $(RAKE) -s release_notes > $@+
+        wrongdoc release_notes > $@+
         $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
 
 # ensures we're actually on the tagged $(VERSION), only used for release
@@ -166,8 +121,8 @@ $(pkgtgz): manifest fix-perms
         @test -n "$(distdir)"
         $(RM) -r $(distdir)
         mkdir -p $(distdir)
-        tar c `cat .manifest` | (cd $(distdir) && tar x)
-        cd pkg && tar c $(basename $(@F)) | gzip -9 > $(@F)+
+        tar cf - $$(cat .manifest) | (cd $(distdir) && tar xf -)
+        cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
         mv $@+ $@
 
 package: $(pkgtgz) $(pkggem)
@@ -193,4 +148,4 @@ all:: test
 test:
         $(MAKE) -C t
 
-.PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test
+.PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test html
diff --git a/Rakefile b/Rakefile
index 3736044..3c5b1a3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -3,105 +3,8 @@ autoload :Gem, 'rubygems'
 autoload :Tempfile, 'tempfile'
 
 # most tasks are in the GNUmakefile which offers better parallelism
-
-def tags
-  timefmt = '%Y-%m-%dT%H:%M:%SZ'
-  @tags ||= `git tag -l`.split(/\n/).map do |tag|
-    if %r{\Av[\d\.]+} =~ tag
-      header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
-      header = header.split(/\n/)
-      tagger = header.grep(/\Atagger /).first
-      body ||= "initial"
-      {
-        :time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
-        :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1].strip,
-        :tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
-        :id => `git rev-parse refs/tags/#{tag}`.chomp!,
-        :tag => tag,
-        :subject => subject,
-        :body => body,
-      }
-    end
-  end.compact.sort { |a,b| b[:time] <=> a[:time] }
-end
-
 cgit_url = "http://git.bogomips.org/cgit/rainbows.git"
-git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/rainbows.git'
-
-desc 'prints news as an Atom feed'
-task :news_atom do
-  require 'nokogiri'
-  new_tags = tags[0,10]
-  puts(Nokogiri::XML::Builder.new do
-    feed :xmlns => "http://www.w3.org/2005/Atom" do
-      id! "http://rainbows.rubyforge.org/NEWS.atom.xml"
-      title "Rainbows! news"
-      subtitle "Unicorn for sleepy apps and slow clients"
-      link! :rel => 'alternate', :type => 'text/html',
-            :href => 'http://rainbows.rubyforge.org/NEWS.html'
-      updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time])
-      new_tags.each do |tag|
-        entry do
-          title tag[:subject]
-          updated tag[:time]
-          published tag[:time]
-          author {
-            name tag[:tagger_name]
-            email tag[:tagger_email]
-          }
-          url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
-          link! :rel => "alternate", :type => "text/html", :href =>url
-          id! url
-          message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/s).first.strip
-          content({:type =>:text}, message_only)
-          content(:type =>:xhtml) { pre tag[:body] }
-        end
-      end
-    end
-  end.to_xml)
-end
-
-desc 'prints RDoc-formatted news'
-task :news_rdoc do
-  tags.each do |tag|
-    time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
-    puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
-    puts ""
-
-    body = tag[:body]
-    puts tag[:body].gsub(/^/sm, "  ").gsub(/[ \t]+$/sm, "")
-    puts ""
-  end
-end
-
-desc "print release changelog for Rubyforge"
-task :release_changes do
-  version = ENV['VERSION'] or abort "VERSION= needed"
-  version = "v#{version}"
-  vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
-  prev = vtags[vtags.index(version) - 1]
-  if prev
-    system('git', 'diff', '--stat', prev, version) or abort $?
-    puts ""
-    system('git', 'log', "#{prev}..#{version}") or abort $?
-  else
-    system('git', 'log', version) or abort $?
-  end
-end
-
-desc "print release notes for Rubyforge"
-task :release_notes do
-  spec = Gem::Specification.load('rainbows.gemspec')
-  puts spec.description.strip
-  puts ""
-  puts "* #{spec.homepage}"
-  puts "* #{spec.email}"
-  puts "* #{git_url}"
-
-  _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
-  print "\nChanges:\n\n"
-  puts body
-end
+git_url = 'git://git.bogomips.org/rainbows.git'
 
 desc "read news article from STDIN and post to rubyforge"
 task :publish_news do
diff --git a/Summary b/Summary
index 12d5447..e69de29 100644
--- a/Summary
+++ b/Summary
@@ -1,7 +0,0 @@
-= \Rainbows! at a glance
-
-Confused by all the options we give you?  So are we!  Here's some tables
-to help keep your head straight.  Remember, engineering is all about
-trade-offs.
-
-INCLUDE
diff --git a/rainbows.gemspec b/rainbows.gemspec
index fc8b015..761b71b 100644
--- a/rainbows.gemspec
+++ b/rainbows.gemspec
@@ -9,32 +9,24 @@ manifest = File.readlines('.manifest').map! { |x| x.chomp! }
 test_files = manifest.grep(%r{\Atest/unit/test_.*\.rb\z}).map do |f|
   File.readlines(f).grep(/\bfork\b/).empty? ? f : nil
 end.compact
+require 'wrongdoc'
+extend Wrongdoc::Gemspec
+name, summary, title = readme_metadata
 
 Gem::Specification.new do |s|
   s.name = %q{rainbows}
-  s.version = ENV["VERSION"]
+  s.version = ENV["VERSION"].dup
 
-  s.authors = ["Rainbows! hackers"]
+  s.authors = ["#{name} hackers"]
   s.date = Time.now.utc.strftime('%Y-%m-%d')
-  s.description = File.read("README").split(/\n\n/)[1]
+  s.description = readme_description
   s.email = %q{rainbows-talk@rubyforge.org}
   s.executables = %w(rainbows)
-
-  s.extra_rdoc_files = File.readlines('.document').map! do |x|
-    x.chomp!
-    if File.directory?(x)
-      manifest.grep(%r{\A#{x}/})
-    elsif File.file?(x)
-      x
-    else
-      nil
-    end
-  end.flatten.compact
-
+  s.extra_rdoc_files = extra_rdoc_files(manifest)
   s.files = manifest
-  s.homepage = %q{http://rainbows.rubyforge.org/}
-  s.summary = %q{Unicorn for sleepy apps and slow clients}
-  s.rdoc_options = [ "-t", "Rainbows! #{s.summary}" ]
+  s.homepage = Wrongdoc.config[:rdoc_url]
+  s.summary = summary
+  s.rdoc_options = rdoc_options
   s.require_paths = %w(lib)
   s.rubyforge_project = %q{rainbows}
 
@@ -46,6 +38,7 @@ Gem::Specification.new do |s|
   # we need Unicorn for the HTTP parser and process management
   s.add_dependency(%q<unicorn>, ["~> 3.1.0"])
   s.add_development_dependency(%q<isolate>, "~> 3.0.0")
+  s.add_development_dependency(%q<wrongdoc>, "~> 1.0.1")
 
   # optional runtime dependencies depending on configuration
   # see t/test_isolate.rb for the exact versions we've tested with