about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile54
1 files changed, 27 insertions, 27 deletions
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'