about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-26 01:21:33 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-26 01:29:22 +0000
commitf132c6baa33496515743de1a31854d169479518d (patch)
tree2a8c88ea23937d928c8a902327dfa5de668c9f2e /Rakefile
parenta4b13f3e1376b539a1b7b7cbfeb9e38f6de2b289 (diff)
It's interactive and sucks less, now.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile25
1 files changed, 19 insertions, 6 deletions
diff --git a/Rakefile b/Rakefile
index 84195de..c3d4a39 100644
--- a/Rakefile
+++ b/Rakefile
@@ -5,11 +5,27 @@ rescue LoadError
   warn "rake-compiler not available, cross compiling disabled"
 end
 
-desc "read news article from STDIN and post to rubyforge"
+cgit_url = "http://git.bogomips.org/cgit/clogger.git"
+git_url = 'git://git.bogomips.org/clogger.git'
+
+desc "post news article 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('clogger.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!"
@@ -21,9 +37,6 @@ task :publish_news do
   rf.post_news('clogger', subject, body)
 end
 
-cgit_url = "http://git.bogomips.org/cgit/clogger.git"
-git_url = 'git://git.bogomips.org/clogger.git'
-
 desc "post to RAA"
 task :raa_update do
   require 'rubygems'