about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-12-07 02:03:30 -0800
committerEric Wong <normalperson@yhbt.net>2009-12-07 02:03:30 -0800
commit48e206052201d4b5c86f02c9e2fb5772f5a2775d (patch)
tree1f5c2a61bea11cb76bb050bd5d98e4623e0422cd /Rakefile
parent6421d6af3aeffb36befd1159c8f58db01d252ecf (diff)
downloadunicorn-48e206052201d4b5c86f02c9e2fb5772f5a2775d.tar.gz
No more having bother with a clunky web browser \o/
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index dade3a5..755915c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -146,6 +146,35 @@ task :raa_update do
   puts res.body
 end
 
+desc "post to FM"
+task :fm_update do
+  require 'tempfile'
+  require 'net/http'
+  require 'net/netrc'
+  require 'json'
+  version = ENV['VERSION'] or abort "VERSION= needed"
+  uri = URI.parse('http://freshmeat.net/projects/unicorn/releases.json')
+  rc = Net::Netrc.locate('unicorn-fm') or abort "~/.netrc not found"
+  api_token = rc.password
+  changelog = tags.find { |t| t[:tag] == "v#{version}" }[:body]
+  tmp = Tempfile.new('fm-changelog')
+  tmp.syswrite(changelog)
+  system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
+  changelog = File.read(tmp.path).strip
+
+  req = {
+    "auth_code" => api_token,
+    "release" => {
+      "tag_list" => "Stable",
+      "version" => version,
+      "changelog" => changelog,
+    },
+  }.to_json
+  Net::HTTP.start(uri.host, uri.port) do |http|
+    p http.post(uri.path, req, {'Content-Type'=>'application/json'})
+  end
+end
+
 # optional rake-compiler support in case somebody needs to cross compile
 begin
   require 'rubygems'