From bf3148f749cdca20e14e9b5bc44703b4298c5f0e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 24 Dec 2010 02:41:06 +0000 Subject: switch to wrongdoc, no more JavaScript! bogomips.org will no longer be hosting JavaScript in RDoc --- .document | 1 + .gitignore | 1 + .wrongdoc.yml | 4 ++ GNUmakefile | 63 +++++++------------------------- Rakefile | 105 +---------------------------------------------------- metropolis.gemspec | 18 +++------ 6 files changed, 26 insertions(+), 166 deletions(-) create mode 100644 .wrongdoc.yml diff --git a/.document b/.document index f02a4d1..55c50c1 100644 --- a/.document +++ b/.document @@ -5,3 +5,4 @@ COPYING LICENSE SPEC lib +LATEST diff --git a/.gitignore b/.gitignore index b98bf2e..85df4dd 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ log/ pkg/ /vendor +/LATEST /NEWS /ChangeLog /.manifest diff --git a/.wrongdoc.yml b/.wrongdoc.yml new file mode 100644 index 0000000..bdad892 --- /dev/null +++ b/.wrongdoc.yml @@ -0,0 +1,4 @@ +--- +rdoc_url: http://metropolis.bogomips.org/ +cgit_url: http://git.bogomips.org/cgit/metropolis.git +git_url: git://git.bogomips.org/metropolis.git diff --git a/GNUmakefile b/GNUmakefile index 3a67494..2d05b07 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -2,7 +2,6 @@ all:: RUBY = ruby RAKE = rake -GIT_URL = git://git.bogomips.org/metropolis.git RSYNC = rsync GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @@ -30,56 +29,22 @@ prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean clean: $(RM) $(setup_rb_files) -pkg_extra := GIT-VERSION-FILE NEWS ChangeLog -manifest: $(pkg_extra) +pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST +manifest: $(RM) .manifest $(MAKE) .manifest .manifest: - (git ls-files && \ - for i in $@ $(pkg_extra) $(man1_paths); \ - do echo $$i; done) | LC_ALL=C sort > $@+ + wrongdoc prepare + (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 $@+ $@ - -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://metropolis.bogomips.org/NEWS.atom.xml -cgit_atom := http://git.bogomips.org/cgit/metropolis.git/atom/?h=master -atom = - -# using rdoc 2.5.x -doc: .document NEWS ChangeLog - rdoc -t "$(shell sed -ne '1s/^= //p' README)" +doc: .document .wrongdoc.yml + 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 ifneq ($(VERSION),) rfproject := rainbows @@ -92,10 +57,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 @@ -159,11 +124,10 @@ $(test_units): # 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 + $(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/ metropolis.bogomips.org:/srv/metropolis/ @@ -173,7 +137,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 diff --git a/Rakefile b/Rakefile index 5d03a19..35e37e4 100644 --- a/Rakefile +++ b/Rakefile @@ -1,110 +1,7 @@ # -*- encoding: binary -*- autoload :Gem, 'rubygems' - -# most tasks are in the GNUmakefile which offers better parallelism - -TIMEFMT = '%Y-%m-%dT%H:%M:%SZ' -def tags - @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/metropolis.git" -git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/metropolis.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://metropolis.bogomips.org/NEWS.atom.xml" - title "Metropolis news" - subtitle "Rack HTTP key value store" - link! :rel => 'alternate', :type => 'text/html', - :href => 'http://metropolis.bogomips.org/NEWS.html' - if new_tags[0] - updated(new_tags[0][:time]) - else - updated(Time.now.utc.strftime(TIMEFMT)) - end - 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('metropolis.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/metropolis.git' desc "post to RAA" task :raa_update do diff --git a/metropolis.gemspec b/metropolis.gemspec index 3517fd8..f8629e8 100644 --- a/metropolis.gemspec +++ b/metropolis.gemspec @@ -2,6 +2,9 @@ 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 # don't bother with tests that fork, not worth our time to get working # with `gem check -t` ... (of course we care for them when testing with @@ -14,21 +17,11 @@ Gem::Specification.new do |s| s.authors = ["The Sleeper"] s.date = Time.now.utc.strftime('%Y-%m-%d') - s.description = File.read("README").split(/\n\n/)[1].delete('\\') + s.description = readme_description.delete('\\') s.email = %q{metropolis@librelist.org} s.executables = [] - 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 s.files = manifest s.homepage = %q{http://metropolis.bogomips.org/} @@ -40,6 +33,7 @@ Gem::Specification.new do |s| s.test_files = test_files s.add_dependency(%q) + s.add_development_dependency('wrongdoc', '~> 1.0.1') # s.licenses = %w(AGPL) # licenses= method is not in older RubyGems end -- cgit v1.2.3-24-ge0c7