about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-08-03 08:39:22 +0000
committerEric Wong <normalperson@yhbt.net>2010-08-03 08:39:49 +0000
commit3607ef808c947c37d1810cdb34ed924c86502ad1 (patch)
treebc71caaab240f2a526504f656d4a14691dd1f427 /Rakefile
parent07d2c8318651ed85451fedcd950aff34d6f56efc (diff)
downloadrainbows-3607ef808c947c37d1810cdb34ed924c86502ad1.tar.gz
I keep forgetting, so I'll force it on myself.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile19
1 files changed, 16 insertions, 3 deletions
diff --git a/Rakefile b/Rakefile
index 219744a..d2db54d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,6 @@
 # -*- encoding: binary -*-
 autoload :Gem, 'rubygems'
+autoload :Tempfile, 'tempfile'
 
 # most tasks are in the GNUmakefile which offers better parallelism
 
@@ -105,8 +106,21 @@ end
 desc "read news article from STDIN and post to rubyforge"
 task :publish_news do
   require 'rubyforge'
-  IO.select([STDIN], nil, nil, 1) or abort "E: news must be read from stdin"
-  msg = STDIN.readlines
+  spec = Gem::Specification.load('rainbows.gemspec')
+  tmp = Tempfile.new('rf-news')
+  _, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
+  tmp.puts subject
+  tmp.puts
+  tmp.puts spec.description.strip
+  tmp.puts ""
+  tmp.puts "* #{spec.homepage}"
+  tmp.puts "* #{spec.email}"
+  tmp.puts "* #{git_url}"
+  tmp.print "\nChanges:\n\n"
+  tmp.puts body
+  tmp.flush
+  system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
+  msg = File.readlines(tmp.path)
   subject = msg.shift
   blank = msg.shift
   blank == "\n" or abort "no newline after subject!"
@@ -157,7 +171,6 @@ end
 
 desc "post to FM"
 task :fm_update do
-  require 'tempfile'
   require 'net/http'
   require 'net/netrc'
   require 'json'