about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-21 04:45:30 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-21 04:45:30 +0000
commit5ffaf7df44425766a60d632881a2debd83605b52 (patch)
treeee80d1b32d4f2f943fd15829a28a79847923c021 /Rakefile
parent3a67490b10ca38d7d3d30c6917d75ce0e093706b (diff)
downloadunicorn-5ffaf7df44425766a60d632881a2debd83605b52.tar.gz
It's more useful this way
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile15
1 files changed, 12 insertions, 3 deletions
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]