about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-27 16:55:28 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-27 16:55:28 +0000
commitf62107bf4b5eb01dbc22b68e56b61db78c73336c (patch)
tree22ac1849a47f1ce0f1e57e25963f556eb9a6fbaa
parent09cd762eeebc07dd7fd0eef6c3bea40a0f74b030 (diff)
downloadruby_io_splice-f62107bf4b5eb01dbc22b68e56b61db78c73336c.tar.gz
No more JavaScript!
-rw-r--r--.document1
-rw-r--r--.gitignore1
-rw-r--r--.wrongdoc.yml5
-rw-r--r--GNUmakefile59
-rw-r--r--Rakefile120
-rw-r--r--io_splice.gemspec28
6 files changed, 45 insertions, 169 deletions
diff --git a/.document b/.document
index bae8fa2..b0426dd 100644
--- a/.document
+++ b/.document
@@ -4,3 +4,4 @@ NEWS
 ChangeLog
 lib
 ext/io_splice/io_splice_ext.c
+LATEST
diff --git a/.gitignore b/.gitignore
index 60074e4..228b730 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,4 @@ Makefile
 /pkg
 /doc
 /coverage
+LATEST
diff --git a/.wrongdoc.yml b/.wrongdoc.yml
new file mode 100644
index 0000000..8bc0c66
--- /dev/null
+++ b/.wrongdoc.yml
@@ -0,0 +1,5 @@
+---
+cgit_url: http://git.bogomips.org/cgit/ruby_io_splice.git
+git_url: git://git.bogomips.org/ruby_io_splice.git
+rdoc_url: http://bogomips.org/ruby_io_splice/
+changelog_start: v1.0.0
diff --git a/GNUmakefile b/GNUmakefile
index ab68db5..f58028c 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -2,7 +2,6 @@
 all::
 RUBY = ruby
 RAKE = rake
-GIT_URL = git://git.bogomips.org/ruby_io_splice.git
 RSYNC = rsync
 RCOV = rcov
 
@@ -35,7 +34,7 @@ clean:
         -$(MAKE) -C ext/io_splice clean
         $(RM) $(setup_rb_files) ext/io_splice/Makefile
 
-pkg_extra := GIT-VERSION-FILE NEWS ChangeLog
+pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST
 manifest: $(pkg_extra)
         $(RM) .manifest
         $(MAKE) .manifest
@@ -47,62 +46,25 @@ manifest: $(pkg_extra)
         cmp $@+ $@ || mv $@+ $@
         $(RM) $@+
 
-NEWS: GIT-VERSION-FILE
-        $(RAKE) -s news_rdoc > $@+
-        mv $@+ $@
-
-SINCE = 1.0.0
-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_io_splice/NEWS.atom.xml
-cgit_atom := http://git.bogomips.org/cgit/ruby_io_splice.git/atom/?h=master
-atom = <link rel="alternate" title="Atom feed" href="$(1)" \
-             type="application/atom+xml"/>
+        wrongdoc prepare
 
 # using rdoc 2.5.x + workaround patch here:
 # rubyforge.org/tracker/index.php?func=detail&aid=28230&group_id=627&atid=2472
-doc: .document NEWS ChangeLog
-        rdoc -a -t "$(shell sed -ne '1s/^= //p' README)"
+doc: .document ChangeLog
+        wrongdoc all
         install -m644 COPYING doc/COPYING
         install -m644 $(shell grep '^[A-Z]' .document) doc/
-        cd doc && for i in $(base_bins); do \
-          html=$$(echo $$i | sed 's/\.rb/_rb/')_1.html; \
-          sed -e '/"documentation">/r man1/'$$i'.1.html' \
-                < $$html > tmp && mv tmp $$html; done
-        $(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
         tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
 
-latest: NEWS
-        @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $<
-
 # publishes docs to http://bogomips.org/ruby_io_splice/,
 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
+        $(RM) -r doc
+        $(MAKE) doc
+        find doc/images -type f | \
+                TZ=UTC xargs touch -d '1970-01-01 00:00:02' doc/rdoc.css
         $(MAKE) doc_gz
-        chmod 644 $$(find doc -type f)
         $(RSYNC) -av doc/ bogomips.org:/srv/bogomips/ruby_io_splice/
         git ls-files | xargs touch
 
@@ -110,7 +72,6 @@ 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
 
@@ -125,10 +86,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
diff --git a/Rakefile b/Rakefile
index 5b2600f..628256c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,112 +1,28 @@
 # -*- 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\.]+\z} =~ 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
-
+autoload :Gem, 'rubygems'
+autoload :Tempfile, 'tempfile'
 cgit_url = "http://git.bogomips.org/cgit/ruby_io_splice.git"
-git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/ruby_io_splice.git'
+git_url = 'git://git.bogomips.org/ruby_io_splice.git'
 web_url = "http://bogomips.org/ruby_io_splice/"
 
-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 io_splice news"
-      subtitle "splice and tee Linux syscalls from 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('io_splice.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 "read news article from STDIN and post to rubyforge"
 task :publish_news do
   require 'rubyforge'
-  IO.select([STDIN], nil, nil, 1) or abort "E: news must be read from stdin"
-  msg = STDIN.readlines
+  spec = Gem::Specification.load('io_splice.gemspec')
+  tmp = Tempfile.new('rf-news')
+  _, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
+  tmp.puts subject
+  tmp.puts
+  tmp.puts spec.description.strip
+  tmp.puts ""
+  tmp.puts "* #{spec.homepage}"
+  tmp.puts "* #{spec.email}"
+  tmp.puts "* #{git_url}"
+  tmp.print "\nChanges:\n\n"
+  tmp.puts body
+  tmp.flush
+  system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
+  msg = File.readlines(tmp.path)
   subject = msg.shift
   blank = msg.shift
   blank == "\n" or abort "no newline after subject!"
diff --git a/io_splice.gemspec b/io_splice.gemspec
index 1c4baa5..342a62b 100644
--- a/io_splice.gemspec
+++ b/io_splice.gemspec
@@ -1,38 +1,30 @@
 # -*- encoding: binary -*-
-
 ENV["VERSION"] or abort "VERSION= must be specified"
 manifest = File.readlines('.manifest').map! { |x| x.chomp! }
 test_files = manifest.grep(%r{\Atest/test_.*\.rb\z})
+require 'wrongdoc'
+extend Wrongdoc::Gemspec
+name, summary, title = readme_metadata
 
 Gem::Specification.new do |s|
   s.name = %q{io_splice}
   s.version = ENV["VERSION"]
 
-  s.authors = ["io_splice hackers"]
+  s.authors = ["Ruby io_splice 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{ruby.io.splice@librelist.com}
   s.extensions = %w(ext/io_splice/extconf.rb)
 
-  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://bogomips.org/ruby_io_splice/}
-  s.summary = %q{zero-copy pipe I/O for Linux and Ruby}
-  s.rdoc_options = [ "-Na", "-t", "io_splice - #{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{qrp}
-
   s.test_files = test_files
+  s.add_development_dependency('wrongdoc', '~> 1.0')
 
   # s.licenses = %w(LGPL) # accessor not compatible with older RubyGems
 end