From 613cf0e32e6060befaae848a0f7d994565f293af Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 13 Dec 2009 12:39:01 -0800 Subject: Rakefile: resync with Unicorn * cleanup NEWS.atom.xml feed * add freshmeat update task --- Rakefile | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 986353a..3cfc6be 100644 --- a/Rakefile +++ b/Rakefile @@ -50,7 +50,9 @@ task :news_atom do url = "#{cgit_url}/tag/?id=#{tag[:tag]}" link! :rel => "alternate", :type => "text/html", :href =>url id! url - content({:type => 'text'}, tag[:body]) + message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/s).first.strip + content({:type =>:text}, message_only) + content(:type =>:xhtml) { pre tag[:body] } end end end @@ -154,3 +156,32 @@ task :raa_update do p res 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 -- cgit v1.2.3-24-ge0c7