about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile3
-rw-r--r--Rakefile15
2 files changed, 13 insertions, 5 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 03ed4ac..ef0a26c 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -214,7 +214,7 @@ doc: .document $(ext)/unicorn_http.c NEWS ChangeLog
         $(RUBY) -i -p -e \
           '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
           doc/NEWS.html doc/README.html
-        $(RAKE) -s news_atom > doc/NEWS.atom.xml
+        $(RAKE) -s news_atom OUT=doc/NEWS.atom.xml
         cd doc && ln README.html tmp && mv tmp index.html
         $(RM) $(man1_rdoc)
 
@@ -237,7 +237,6 @@ publish_doc:
 # "gzip_static on" can serve the gzipped versions directly.
 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
 doc_gz:
-        touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
         for i in $(docs); do \
           gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
 
diff --git a/Rakefile b/Rakefile
index 72f7a85..b4530a5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -20,8 +20,10 @@ def tags
       header = header.split(/\n/)
       tagger = header.grep(/\Atagger /).first
       body ||= "initial"
+      time = Time.at(tagger.split(/ /)[-2].to_i).utc
       {
-        :time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
+        :time => time.strftime(timefmt),
+        :ruby_time => time,
         :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1].strip,
         :tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
         :id => `git rev-parse refs/tags/#{tag}`.chomp!,
@@ -40,7 +42,8 @@ desc 'prints news as an Atom feed'
 task :news_atom do
   require 'nokogiri'
   new_tags = tags[0,10]
-  puts(Nokogiri::XML::Builder.new do
+  out = ENV["OUT"] ? File.open(ENV["OUT"], "w") : $stdout
+  out.puts(Nokogiri::XML::Builder.new do
     feed :xmlns => "http://www.w3.org/2005/Atom" do
       id! "http://unicorn.bogomips.org/NEWS.atom.xml"
       title "Unicorn news"
@@ -67,13 +70,19 @@ task :news_atom do
       end
     end
   end.to_xml)
+  if out.respond_to?(:path) && new_tags[0]
+    path = out.path
+    out.close
+    time = new_tags[0][:ruby_time]
+    File.utime(time, time, path)
+  end
 end
 
 desc 'prints RDoc-formatted news'
 task :news_rdoc do
   tags.each do |tag|
     time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
-    puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
+    puts "=== #{tag[:subject]} / #{time}"
     puts ""
 
     body = tag[:body]