From 2384ecce25e91feb1ec0a9537c76beb18a7d4f86 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 25 Dec 2010 00:19:49 -0800 Subject: switch to wrongdoc for documentation No more JavaScript on our site! --- .document | 1 + .gitignore | 1 + .wrongdoc.yml | 7 ++++ GNUmakefile | 74 ++++++++++++++++----------------------- Rakefile | 104 +------------------------------------------------------ local.mk.sample | 70 ------------------------------------- posix_mq.gemspec | 33 ++++++------------ 7 files changed, 51 insertions(+), 239 deletions(-) create mode 100644 .wrongdoc.yml delete mode 100644 local.mk.sample diff --git a/.document b/.document index 1ae5ae7..c43f92c 100644 --- a/.document +++ b/.document @@ -5,3 +5,4 @@ ChangeLog lib ext/posix_mq/posix_mq.c posix-mq-rb_1 +LATEST diff --git a/.gitignore b/.gitignore index a81a2c1..2f04990 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ Makefile /man /pkg /doc +/LATEST diff --git a/.wrongdoc.yml b/.wrongdoc.yml new file mode 100644 index 0000000..4796079 --- /dev/null +++ b/.wrongdoc.yml @@ -0,0 +1,7 @@ +--- +rdoc_url: http://bogomips.org/ruby_posix_mq/ +cgit_url: http://git.bogomips.org/cgit/ruby_posix_mq.git +git_url: git://git.bogomips.org/ruby_posix_mq.git +changelog_since: 0.4.0 +merge_html: + posix-mq-rb_1: Documentation/posix-mq.rb.1.html diff --git a/GNUmakefile b/GNUmakefile index d67dee2..fe1b160 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -2,7 +2,7 @@ all:: RUBY = ruby RAKE = rake -GIT_URL = git://git.bogomips.org/ruby_posix_mq.git +RSYNC = rsync GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @./GIT-VERSION-GEN @@ -39,10 +39,10 @@ clean: -$(MAKE) -C ext/posix_mq clean $(RM) $(setup_rb_files) ext/posix_mq/Makefile -man: - $(MAKE) -C Documentation install-man +man html: + $(MAKE) -C Documentation install-$@ -pkg_extra := GIT-VERSION-FILE NEWS ChangeLog +pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST manifest: $(pkg_extra) man $(RM) .manifest $(MAKE) .manifest @@ -54,48 +54,16 @@ manifest: $(pkg_extra) man cmp $@+ $@ || mv $@+ $@ $(RM) $@+ -NEWS: GIT-VERSION-FILE - $(RAKE) -s news_rdoc > $@+ - mv $@+ $@ - -SINCE = 0.4.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_posix_mq/NEWS.atom.xml -cgit_atom := http://git.bogomips.org/cgit/ruby_posix_mq.git/atom/?h=master -atom = + wrongdoc prepare -# using rdoc 2.5.x+ -doc: .document NEWS ChangeLog +doc: .document NEWS ChangeLog man html for i in $(man1_rdoc); do > $$i; done - rdoc -a -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 \ - 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!("",%q{\&$(call atom,$(cgit_atom))})' \ - doc/ChangeLog.html - $(RUBY) -i -p -e \ - '$$_.gsub!("",%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 $(RM) $(man1_rdoc) ifneq ($(VERSION),) @@ -109,10 +77,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 @@ -177,4 +145,22 @@ test: test-unit test-unit: build $(RUBY) -I lib:ext/posix_mq test/test_posix_mq.rb -.PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test +# publishes docs to http://bogomips.org/ruby_posix_mq/ +publish_doc: + -git set-file-times + $(RM) -r doc + $(MAKE) doc + find doc/images -type f | \ + TZ=UTC xargs touch -d '1970-01-01 00:00:03' doc/rdoc.css + $(MAKE) doc_gz + $(RSYNC) -av doc/ bogomips.org:/srv/bogomips/ruby_posix_mq/ + git ls-files | xargs touch + +# Create gzip variants of the same timestamp as the original so nginx +# "gzip_static on" can serve the gzipped versions directly. +doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$') +doc_gz: + 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 html diff --git a/Rakefile b/Rakefile index 902595f..5882d80 100644 --- a/Rakefile +++ b/Rakefile @@ -1,108 +1,6 @@ # -*- 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 - cgit_url = "http://git.bogomips.org/cgit/ruby_posix_mq.git" -git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/ruby_posix_mq.git' -web_url = "http://bogomips.org/ruby_posix_mq/" - -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 posix_mq news" - subtitle "POSIX Message Queues 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 - require 'rubygems' - - spec = Gem::Specification.load('posix_mq.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/ruby_posix_mq.git' desc "read news article from STDIN and post to rubyforge" task :publish_news do diff --git a/local.mk.sample b/local.mk.sample deleted file mode 100644 index 4ce6cf8..0000000 --- a/local.mk.sample +++ /dev/null @@ -1,70 +0,0 @@ -# this is a sample local.mk file, feel free to modify it for your needs -# GNUmakefile will source local.mk in the top-level source tree -# if it is present. -# -# This is depends on a bunch of GNU-isms from bash, touch. - -RSYNC = rsync -DLEXT := so -gems := - -# Avoid loading rubygems to speed up tests because gmake is -# fork+exec heavy with Ruby. -prefix = $(HOME) -ifeq ($(r19),) - RUBY := $(prefix)/bin/ruby - gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.8/gems/,$(gems)) -else - prefix := $(prefix)/ruby-1.9 - export PATH := $(prefix)/bin:$(PATH) - RUBY := $(prefix)/bin/ruby --disable-gems - gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.9.1/gems/,$(gems)) -endif - -ifdef gem_paths - sp := - sp += - export RUBYLIB := $(subst $(sp),:,$(addsuffix /lib,$(gem_paths))) -endif - -# pipefail is THE reason to use bash (v3+) or never revisions of ksh93 -# SHELL := /bin/bash -e -o pipefail -SHELL := /bin/ksh93 -e -o pipefail - -# trace execution of tests -# TRACER = strace -f -o $(t_pfx).strace -s 100000 -TRACER = /usr/bin/time -v -o $(t_pfx).time - -full-test: test-18 test-19 -test-18: - $(MAKE) test 2>&1 | sed -e 's!^!1.8 !' -test-19: - $(MAKE) test r19=t 2>&1 | sed -e 's!^!1.9 !' - -latest: NEWS - @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $< - -# publishes docs to http://bogomips.org/ruby_posix_mq/ -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_gz - chmod 644 $$(find doc -type f) - $(RSYNC) -av doc/ dcvr:/srv/bogomips/ruby_posix_mq/ - git ls-files | xargs touch - -# Create gzip variants of the same timestamp as the original so nginx -# "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 - -# launches any of the following shells with RUBYLIB set -irb sh bash ksh: - $@ diff --git a/posix_mq.gemspec b/posix_mq.gemspec index d4cf30e..a773579 100644 --- a/posix_mq.gemspec +++ b/posix_mq.gemspec @@ -1,39 +1,28 @@ # -*- 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{posix_mq} - s.version = ENV["VERSION"] - + s.version = ENV["VERSION"].dup s.authors = ["Ruby POSIX MQ 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.posix.mq@librelist.com} s.executables = %w(posix-mq-rb) s.extensions = %w(ext/posix_mq/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_posix_mq/} - s.summary = %q{POSIX Message Queues for Ruby} - s.rdoc_options = [ "-Na", "-t", "posix_mq - #{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.test_files = manifest.grep(%r{\Atest/test_.*\.rb\z}) + s.add_development_dependency(%q, "~> 1.0") # s.licenses = %w(LGPLv3) # accessor not compatible with older RubyGems end -- cgit v1.2.3-24-ge0c7