From: Eric Wong <e@80x24.org>
To: cmogstored-public@bogomips.org
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH] doc: use "builder" RubyGem to generate Atom feed
Date: Tue, 28 Jul 2015 21:13:01 +0000 [thread overview]
Message-ID: <1438117981-14407-1-git-send-email-e@80x24.org> (raw)
Nokogiri takes too long to build and install due to the C extension
and bundled library. Prefer a widely-used pure-Ruby gem instead.
---
HACKING | 4 ++--
Rakefile | 54 +++++++++++++++++++++++++++---------------------------
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/HACKING b/HACKING
index 47c73aa..caa9708 100644
--- a/HACKING
+++ b/HACKING
@@ -33,8 +33,8 @@ Additional development tools we use:
* valgrind - http://valgrind.org/
* sparse - https://sparse.wiki.kernel.org/
-We also use Rake for pre-release checks, generating ChangeLog
-and NEWS documentation, and Nokogiri for generating the Atom
+We also use Rake for pre-release checks, generating ChangeLog and NEWS
+documentation, and the "builder" RubyGem for generating the Atom
feed for our website.
Hack away!
diff --git a/Rakefile b/Rakefile
index 6552411..be3564b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,6 @@
# this is only used for release-related tasks and should not
# be needed by normal development
-require "nokogiri" # gem install nokogiri
include Rake::DSL if defined?(Rake::DSL)
url_base = "http://bogomips.org/cmogstored"
@@ -31,35 +30,36 @@ end
desc 'prints news as an Atom feed'
task :news_atom do
- require 'nokogiri'
+ require 'builder' # gem install builder
new_tags = tags[0,10]
- puts(Nokogiri::XML::Builder.new do
- feed :xmlns => "http://www.w3.org/2005/Atom" do
- id! "#{url_base}/NEWS.atom.xml"
- title "cmogstored news"
- subtitle "alternative mogstored implementation for MogileFS"
- 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|
- 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
+ x = Builder::XmlMarkup.new(:indent => 2)
+ x.instruct! :xml, :encoding => 'UTF-8', :version => '1.0'
+ x.feed(:xmlns => "http://www.w3.org/2005/Atom") do
+ x.id "#{url_base}/NEWS.atom.xml"
+ x.title "cmogstored news"
+ x.subtitle "alternative mogstored implementation for MogileFS"
+ x.link :rel => 'alternate', :type => 'text/plain',
+ :href => "#{url_base}/NEWS"
+ x.updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time])
+ new_tags.each do |tag|
+ x.entry do
+ x.title tag[:subject]
+ x.updated tag[:time]
+ x.published tag[:time]
+ x.author {
+ x.name tag[:tagger_name]
+ x.email tag[:tagger_email]
+ }
+ url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
+ x.link :rel => "alternate", :type => "text/html", :href =>url
+ x.id url
+ message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/).first.strip
+ x.content({:type =>:text}, message_only)
+ x.content(:type =>:xhtml) { x.pre tag[:body] }
end
end
- end.to_xml)
+ end
+ puts x.target!
end
desc 'prints news as a text file'
--
EW
reply other threads:[~2015-07-28 21:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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/cmogstored/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1438117981-14407-1-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=cmogstored-public@bogomips.org \
/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/cmogstored.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).