about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-07-28 20:58:49 +0000
committerEric Wong <e@80x24.org>2015-07-28 21:08:34 +0000
commitdc55a5b5bdd60850553ebf01adfe357d2a2a68b8 (patch)
tree4ca5f60634d636f0a2b3c9f7fbdf45c366ce6882
parenta76af438da94e0d7211d4602b7fb00f2beb5e74e (diff)
downloadcmogstored-dc55a5b5bdd60850553ebf01adfe357d2a2a68b8.tar.gz
Nokogiri takes too long to build and install due to the C extension
and bundled library.  Prefer a widely-used pure-Ruby gem instead.
-rw-r--r--HACKING4
-rw-r--r--Rakefile54
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'