yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: yahns-public@yhbt.net
Subject: [PATCH] use olddoc 1.1.0 for generating NEWS + NEWS.atom.xml
Date: Thu, 15 Oct 2015 01:53:57 +0000	[thread overview]
Message-ID: <20151015015357.29528-1-e@80x24.org> (raw)

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 <normalperson@yhbt.net>'
-  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


             reply	other threads:[~2015-10-15  1:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15  1:53 Eric Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-10-15 16:40 [PATCH] use olddoc 1.1.0 for generating NEWS + NEWS.atom.xml Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/yahns/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151015015357.29528-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/yahns.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).