about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-17 08:14:10 +0000
committerEric Wong <normalperson@yhbt.net>2011-01-17 08:14:10 +0000
commit1e47ddc03a3f78fc5a74eb8ba7cfa2c3d2ce5399 (patch)
treedf41d95a2d2afae2ea9181dad59650950c348683
parentc6882955b6aa7ec611e1ab6c3e4c75da6508889f (diff)
downloadruby-tdb-1e47ddc03a3f78fc5a74eb8ba7cfa2c3d2ce5399.tar.gz
No more JavaScript!  Down with JavaScript! \o/
-rw-r--r--.document1
-rw-r--r--.gitignore1
-rw-r--r--.wrongdoc.yml4
-rw-r--r--GNUmakefile97
-rw-r--r--Rakefile103
-rw-r--r--tdb.gemspec25
6 files changed, 44 insertions, 187 deletions
diff --git a/.document b/.document
index 95b3d1e..dde87b5 100644
--- a/.document
+++ b/.document
@@ -6,3 +6,4 @@ NEWS
 ChangeLog
 lib
 ext/tdb/tdb.c
+LATEST
diff --git a/.gitignore b/.gitignore
index 1a4b837..473f63f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ pkg/
 /man
 tags
 TAGS
+/LATEST
diff --git a/.wrongdoc.yml b/.wrongdoc.yml
new file mode 100644
index 0000000..cdb9c36
--- /dev/null
+++ b/.wrongdoc.yml
@@ -0,0 +1,4 @@
+---
+cgit_url: http://git.bogomips.org/cgit/ruby-tdb.git
+git_url: git://git.bogomips.org/ruby-tdb.git
+rdoc_url: http://bogomips.org/ruby-tdb/
diff --git a/GNUmakefile b/GNUmakefile
index d8fe7c6..a1c0c96 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -3,8 +3,6 @@ all::
 RUBY = ruby
 RAKE = rake
 RSYNC = rsync
-GIT_URL = git://git.bogomips.org/ruby-tdb.git
-CGIT_URL = http://git.bogomips.org/cgit/ruby-tdb.git
 
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
         @./GIT-VERSION-GEN
@@ -29,61 +27,27 @@ install:
 setup_rb_files := .config InstalledFiles
 prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
 
+extdir := ext/tdb
 clean:
-        -$(MAKE) -C ext/tdb clean
-        $(RM) $(setup_rb_files) ext/tdb/Makefile
-
-pkg_extra := GIT-VERSION-FILE NEWS ChangeLog
-manifest: $(pkg_extra)
-        $(RM) .manifest
-        $(MAKE) .manifest
-
-.manifest:
-        (git ls-files && \
-         for i in $@ $(pkg_extra) $(man1_paths); \
-         do echo $$i; done) | LC_ALL=C sort > $@+
-        cmp $@+ $@ || mv $@+ $@
-        $(RM) $@+
+        -$(MAKE) -C $(extdir) clean
+        $(RM) $(setup_rb_files) $(extdir)/Makefile
 
-NEWS: GIT-VERSION-FILE
-        $(RAKE) -s news_rdoc > $@+
-        mv $@+ $@
+pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST
+ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
+        wrongdoc prepare
 
-latest: NEWS
-        @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $<
-
-SINCE =
-ChangeLog: LOG_VERSION = \
-  $(shell git rev-parse -q "$(GIT_VERSION)" >/dev/null 2>&1 && \
-          echo $(GIT_VERSION) || git describe)
-ifneq ($(SINCE),)
-ChangeLog: log_range = v$(SINCE)..$(LOG_VERSION)
-endif
-ChangeLog: GIT-VERSION-FILE
-        @echo "ChangeLog from $(GIT_URL) ($(log_range))" > $@+
-        @echo >> $@+
-        git log $(log_range) | sed -e 's/^/    /' >> $@+
-        mv $@+ $@
-
-news_atom := http://bogomips.org/ruby-tdb/NEWS.atom.xml
-cgit_atom := $(CGIT_URL)/atom/?h=master
-atom = <link rel="alternate" title="Atom feed" href="$(1)" \
-             type="application/atom+xml"/>
+.manifest: ChangeLog
+        (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
+                LC_ALL=C sort > $@+
+        cmp $@+ $@ || mv $@+ $@
+        $(RM) $@+
 
-# using rdoc 2.5.x
-doc: .document NEWS ChangeLog
-        rdoc --webcvs=$(CGIT_URL)/tree/%s \
-          -t "$(shell sed -ne '1s/^= //p' README)"
+doc: .document .wrongdoc.yml
+        find lib ext -type f -name '*.rbc' -exec rm -f '{}' ';'
+        $(RM) -r doc
+        wrongdoc all
         install -m644 COPYING doc/COPYING
         install -m644 $(shell grep '^[A-Z]' .document) doc/
-        $(RUBY) -i -p -e \
-          '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
-          doc/ChangeLog.html
-        $(RUBY) -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
 
 ifneq ($(VERSION),)
 rfproject := qrp
@@ -96,10 +60,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
@@ -119,14 +83,14 @@ gem: $(pkggem)
 install-gem: $(pkggem)
         gem install $(CURDIR)/$<
 
-$(pkggem): manifest fix-perms
+$(pkggem): .manifest fix-perms
         gem build $(rfpackage).gemspec
         mkdir -p pkg
         mv $(@F) $@
 
 $(pkgtgz): distdir = $(basename $@)
 $(pkgtgz): HEAD = v$(VERSION)
-$(pkgtgz): manifest fix-perms
+$(pkgtgz): .manifest fix-perms
         @test -n "$(distdir)"
         $(RM) -r $(distdir)
         mkdir -p $(distdir)
@@ -147,16 +111,18 @@ release: verify package $(release_notes) $(release_changes)
         -rubyforge add_file \
           $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
         $(RAKE) raa_update VERSION=$(VERSION)
+        $(RAKE) publish_news VERSION=$(VERSION)
 else
 gem install-gem: GIT-VERSION-FILE
         $(MAKE) $@ VERSION=$(GIT_VERSION)
 endif
 
-ext := ext/tdb/tdb_ext.$(DLEXT)
-ext/tdb/Makefile: ext/tdb/extconf.rb
-        cd $(@D) && $(RUBY) extconf.rb $(EXTCONF_ARGS)
+ext := $(extdir)/tdb_ext.$(DLEXT)
+$(extdir)/Makefile: $(extdir)/extconf.rb
+        cd $(@D) && $(RUBY) extconf.rb
 
-$(ext): $(wildcard ext/tdb/*.[ch] ext/tdb/*/*.h) ext/tdb/Makefile
+c_files := $(wildcard $(extdir)/*.[ch] $(extdir)/*/*.h)
+$(ext): $(c_files) $(extdir)/Makefile
         $(MAKE) -C $(@D)
 
 all:: test
@@ -166,16 +132,14 @@ test_units := $(wildcard test/test_*.rb)
 test: test-unit
 test-unit: $(test_units)
 $(test_units): build
-        $(RUBY) -I lib:ext/tdb $@
+        $(RUBY) -I lib:$(extdir) $@
 
 # this requires GNU coreutils variants
 publish_doc:
         -git set-file-times
-        $(RM) -r doc ChangeLog NEWS
-        $(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
-        $(MAKE) -s latest > doc/LATEST
-        find doc/images doc/js -type f | \
-                TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
+        $(MAKE) doc
+        find doc/images -type f | \
+                TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
         $(MAKE) doc_gz
         chmod 644 $$(find doc -type f)
         $(RSYNC) -av doc/ bogomips.org:/srv/bogomips/ruby-tdb/
@@ -185,8 +149,7 @@ publish_doc:
 # "gzip_static on" can serve the gzipped versions directly.
 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
 doc_gz:
-        touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
         for i in $(docs); do \
           gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
 
-.PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test $(test_units)
+.PHONY: .FORCE-GIT-VERSION-FILE doc test $(test_units)
diff --git a/Rakefile b/Rakefile
index d8158a0..309824a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,107 +1,4 @@
 # -*- encoding: binary -*-
-
-# 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/ruby-tdb.git"
-git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/ruby-tdb.git'
-web_url = "http://bogomips.org/ruby-tdb/"
-
-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! "#{web_url}NEWS.atom.xml"
-      title "Ruby tdb news"
-      subtitle "Trivial Database bindings for Ruby"
-      link! :rel => "alternate", :type => "text/html",
-            :href => "#{web_url}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('tdb.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
-
 desc "post to RAA"
 task :raa_update do
   require 'net/http'
diff --git a/tdb.gemspec b/tdb.gemspec
index 9aa953a..69f963b 100644
--- a/tdb.gemspec
+++ b/tdb.gemspec
@@ -1,7 +1,8 @@
 ENV["VERSION"] or abort "VERSION= must be specified"
 manifest = File.readlines('.manifest').map! { |x| x.chomp! }
-summary = File.readlines("README")[0].gsub(/\A=\s+\S+[^\w]+/, '').strip
-description = File.read("README").split(/\n\n/)[1].strip
+require 'wrongdoc'
+extend Wrongdoc::Gemspec
+name, summary, title = readme_metadata
 
 Gem::Specification.new do |s|
   s.name = %q{tdb}
@@ -10,27 +11,17 @@ Gem::Specification.new do |s|
   s.homepage = 'http://bogomips.org/ruby-tdb/'
   s.authors = ["Ruby tdb hackers"]
   s.date = Time.now.utc.strftime('%Y-%m-%d')
-  s.description = description
+  s.description = readme_description
   s.email = %q{ruby.tdb@librelist.org}
-
-  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.rdoc_options = [ "-t", summary ]
+  s.rdoc_options = rdoc_options
   s.require_paths = %w(lib ext)
-  s.rubyforge_project = %q{tdb}
+  s.rubyforge_project = %q{qrp}
   s.summary = summary
   s.test_files = Dir['test/test_*.rb']
   s.extensions = %w(ext/tdb/extconf.rb)
+  s.add_development_dependency('wrongdoc', '~> 1.3')
 
   # s.license = %w(LGPL) # disabled for compatibility with older RubyGems
 end