From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 83ADB633861 for ; Thu, 15 Oct 2015 16:40:19 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH] use olddoc 1.1.0 for generating NEWS + NEWS.atom.xml Date: Thu, 15 Oct 2015 16:40:21 +0000 Message-Id: <20151015164021.30860-1-e@80x24.org> List-Id: This removes the build-time dependency on Nokogiri, which can be time-consuming to install. We won't be supporting any public APIs, so we will not actually support RDoc here. --- .gitignore | 1 + .olddoc.yml | 7 ++++++ Rakefile | 72 ++++--------------------------------------------------------- 3 files changed, 12 insertions(+), 68 deletions(-) create mode 100644 .olddoc.yml diff --git a/.gitignore b/.gitignore index 3c8af53..2d6dc88 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ .gem-manifest .tgz-manifest /doc +/LATEST diff --git a/.olddoc.yml b/.olddoc.yml new file mode 100644 index 0000000..585a3a2 --- /dev/null +++ b/.olddoc.yml @@ -0,0 +1,7 @@ +--- +cgit_url: http://yhbt.net/yahns.git +git_url: git://yhbt.net/yahns.git +rdoc_url: http://yahns.yhbt.net/ +ml_url: http://yhbt.net/yahns-public/ +public_email: yahns-public@yhbt.net +private_email: yahns@yhbt.net diff --git a/Rakefile b/Rakefile index 8a2ca77..e8e4af0 100644 --- a/Rakefile +++ b/Rakefile @@ -61,76 +61,12 @@ def tags end.compact.sort { |a,b| b[:time] <=> a[:time] } end -url_base = 'http://yahns.yhbt.net' -cgit_url = 'http://yhbt.net/yahns.git' -git_url = 'git://yhbt.net/yahns.git' -since = "v0.0.2" - desc 'prints news as an Atom feed' task "NEWS.atom.xml" do - require 'nokogiri' - new_tags = tags[0,10] - time = nil - str = Nokogiri::XML::Builder.new do - feed :xmlns => "http://www.w3.org/2005/Atom" do - id! "#{url_base}/NEWS.atom.xml" - title "yahns news" - subtitle "sleepy, multi-threaded, non-blocking Ruby application server" - link! :rel => 'alternate', :type => 'text/plain', - :href => "#{url_base}/NEWS" - updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time]) - new_tags.each do |tag| - time ||= tag[:time_obj] - 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}/).first.strip - content({:type =>:text}, message_only) - content(:type =>:xhtml) { pre tag[:body] } - end - end - end - end.to_xml - - fp = Tempfile.new("NEWS.atom.xml", ".") - fp.sync = true - fp.write(str) - fp.chmod 0644 - File.utime(time, time, fp.path) if time - File.rename(fp.path, "NEWS.atom.xml") - fp.close! + # gem install 'olddoc', 'olddoc prepare' has no API besides the + # command-line. This requires olddoc 1.1 or later. + system('olddoc', 'prepare') or abort "olddoc prepare failed #$?" end desc 'prints news as a text file' -task "NEWS" do - fp = Tempfile.new("NEWS", ".") - fp.sync = true - time = nil - tags.each do |tag| - time ||= tag[:time_obj] - line = tag[:subject] + " / " + tag[:time].sub(/T.*/, '') - fp.puts line - fp.puts("-" * line.length) - fp.puts - fp.puts tag[:body] - fp.puts - end - fp.write("Unreleased\n\n") unless fp.size > 0 - fp.puts "COPYRIGHT" - fp.puts "---------" - bdfl = 'Eric Wong ' - fp.puts "Copyright (C) 2013, #{bdfl} and all contributors" - fp.puts "License: GPLv3 or later (http://www.gnu.org/licenses/gpl-3.0.txt)" - fp.chmod 0644 - File.utime(time, time, fp.path) if time - File.rename(fp.path, "NEWS") - fp.close! -end +task 'NEWS' => 'NEWS.atom.xml' -- EW