From 54cf500266b35beecb9c30b8252e72af9fafbc3e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 24 Dec 2010 16:32:28 -0800 Subject: doc: switch to wrongdoc for documentation wrongdoc eliminates JavaScript from our website and also enables us to cut down on our management scripts/code for supporting the project. --- .document | 1 + .gitignore | 1 + .wrongdoc.yml | 5 +++ GNUmakefile | 49 +++++++++-------------------- Rakefile | 95 +-------------------------------------------------------- clogger.gemspec | 36 ++++++---------------- 6 files changed, 33 insertions(+), 154 deletions(-) create mode 100644 .wrongdoc.yml diff --git a/.document b/.document index cd05772..08e903f 100644 --- a/.document +++ b/.document @@ -4,3 +4,4 @@ ChangeLog lib ext/clogger_ext/clogger.c LICENSE +LATEST diff --git a/.gitignore b/.gitignore index 973362b..2804f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ Makefile /ChangeLog /NEWS /GIT-VERSION-FILE +/LATEST diff --git a/.wrongdoc.yml b/.wrongdoc.yml new file mode 100644 index 0000000..2489427 --- /dev/null +++ b/.wrongdoc.yml @@ -0,0 +1,5 @@ +--- +rdoc_url: http://clogger.rubyforge.org/ +cgit_url: http://git.bogomips.org/cgit/clogger.git +git_url: git://git.bogomips.org/clogger.git +changelog_since: 0.4.0 diff --git a/GNUmakefile b/GNUmakefile index a4a3301..dd2b8dc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,7 +1,7 @@ all:: test RUBY = ruby RAKE = rake -GIT_URL = git://git.bogomips.org/clogger.git +RSYNC = rsync GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @./GIT-VERSION-GEN @@ -43,7 +43,7 @@ test-pure: test: test-ext test-pure -pkg_extra := GIT-VERSION-FILE NEWS ChangeLog +pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST manifest: $(pkg_extra) $(RM) .manifest $(MAKE) .manifest @@ -55,44 +55,25 @@ manifest: $(pkg_extra) cmp $@+ $@ || mv $@+ $@ $(RM) $@+ -NEWS: GIT-VERSION-FILE .manifest - $(RAKE) -s news_rdoc > $@+ - mv $@+ $@ - -SINCE = 0.4.0 -ChangeLog: log_range = $(shell test -n "$(SINCE)" && echo v$(SINCE)..) -ChangeLog: GIT-VERSION-FILE - @echo "ChangeLog from $(GIT_URL) ($(SINCE)..$(GIT_VERSION))" > $@+ - @echo >> $@+ - git log $(log_range) | sed -e 's/^/ /' >> $@+ - mv $@+ $@ +ChangeLog: GIT-VERSION-FILE .wrongdoc.yml + wrongdoc prepare -news_atom := http://clogger.rubyforge.org/NEWS.atom.xml -cgit_atom := http://git.bogomips.org/cgit/clogger.git/atom/?h=master -atom = - -doc: .document NEWS ChangeLog - rdoc -a -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!("",%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 + install -m644 $(shell grep '^[A-Z]' .document) doc/ # publishes docs to http://clogger.rubyforge.org/ # this preserves timestamps as best as possible to help HTTP caches out # git set-file-times is here: http://git-scm.org/gitwiki/ExampleScripts publish_doc: - git set-file-times - $(RM) -r doc + -git set-file-times $(MAKE) doc - rsync -av doc/ rubyforge.org:/var/www/gforge-projects/clogger/ + -find doc/images -type f | \ + TZ=UTC xargs touch -d '1970-01-01 00:00:03' doc/rdoc.css + $(RSYNC) -av doc/ rubyforge.org:/var/www/gforge-projects/clogger/ git ls-files | xargs touch ifneq ($(VERSION),) @@ -106,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 diff --git a/Rakefile b/Rakefile index aed50d9..84195de 100644 --- a/Rakefile +++ b/Rakefile @@ -21,101 +21,8 @@ task :publish_news do rf.post_news('clogger', subject, body) end -def tags - timefmt = '%Y-%m-%dT%H:%M:%SZ' - @tags ||= `git tag -l`.split(/\n/).map do |tag| - next if tag == "v0.0.0" - 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], - :tagger_email => %r{<([^>]+)>}.match(tagger)[1], - :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/clogger.git" -git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/clogger.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://clogger.rubyforge.org/NEWS.atom.xml" - title "Clogger news" - subtitle "configurable request logging for Rack" - link! :rel => 'alternate', :type => 'text/html', - :href => 'http://clogger.rubyforge.org/NEWS.html' - updated 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 - content(:type => 'text') { 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] - system('git', 'diff', '--stat', prev, version) or abort $? - puts "" - system('git', 'log', "#{prev}..#{version}") or abort $? -end - -desc "print release notes for Rubyforge" -task :release_notes do - require 'rubygems' - - spec = Gem::Specification.load('clogger.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/clogger.git' desc "post to RAA" task :raa_update do diff --git a/clogger.gemspec b/clogger.gemspec index 5867d52..1241fe5 100644 --- a/clogger.gemspec +++ b/clogger.gemspec @@ -1,44 +1,28 @@ ENV["VERSION"] or abort "VERSION= must be specified" manifest = File.readlines('.manifest').map! { |x| x.chomp! } +require 'wrongdoc' +extend Wrongdoc::Gemspec +name, summary, title = readme_metadata Gem::Specification.new do |s| s.name = %q{clogger} - s.version = ENV["VERSION"] - - if s.respond_to? :required_rubygems_version= - s.required_rubygems_version = Gem::Requirement.new(">= 0") - end - s.homepage = 'http://clogger.rubyforge.org/' + s.version = ENV["VERSION"].dup + s.homepage = Wrongdoc.config[:rdoc_url] s.authors = ["cloggers"] s.date = Time.now.utc.strftime('%Y-%m-%d') - s.description = %q{ -Clogger is Rack middleware for logging HTTP requests. The log format -is customizable so you can specify exactly which fields to log. -}.strip + s.description = readme_description s.email = %q{clogger@librelist.com} - - 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 = [ "-Na", - "-t", "Clogger - configurable request logging for Rack" - ] + s.rdoc_options = rdoc_options s.require_paths = %w(lib ext) s.rubyforge_project = %q{clogger} - s.summary = %q{configurable request logging for Rack} + s.summary = summary s.test_files = %w(test/test_clogger.rb test/test_clogger_to_path.rb) # HeaderHash wasn't case-insensitive in old versions s.add_dependency(%q, ["> 0.9"]) + s.add_development_dependency(%q, "~> 1.0") s.extensions = %w(ext/clogger_ext/extconf.rb) # s.license = "LGPLv2.1+" # disabled for compatibility with older RubyGems -- cgit v1.2.3-24-ge0c7