1 # -*- encoding: binary -*-
2 autoload :Gem, 'rubygems'
4 cgit_url = "http://git.bogomips.org/cgit/unicorn.git"
5 git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/unicorn.git'
11 rc = Net::Netrc.locate('unicorn-raa') or abort "~/.netrc not found"
12 password = rc.password
14 s = Gem::Specification.load('unicorn.gemspec')
15 desc = [ s.description.strip ]
17 desc << "* #{s.email}"
18 desc << "* #{git_url}"
19 desc << "* #{cgit_url}"
20 desc = desc.join("\n")
21 uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
24 :short_description => s.summary,
25 :version => s.version.to_s,
27 :owner => s.authors.first,
29 :category_major => 'Library',
30 :category_minor => 'Web',
32 :download => "http://rubyforge.org/frs/?group_id=1306",
34 :description_style => 'Plain',
39 res = Net::HTTP.post_form(uri, form)
50 version = ENV['VERSION'] or abort "VERSION= needed"
51 uri = URI.parse('http://freshmeat.net/projects/unicorn/releases.json')
52 rc = Net::Netrc.locate('unicorn-fm') or abort "~/.netrc not found"
53 api_token = rc.password
54 _, subject, body = `git cat-file tag v#{version}`.split(/\n\n/, 3)
55 tmp = Tempfile.new('fm-changelog')
60 system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
61 changelog = File.read(tmp.path).strip
64 "auth_code" => api_token,
66 "tag_list" => "Experimental",
68 "changelog" => changelog,
72 if ! changelog.strip.empty? && version =~ %r{\A[\d\.]+\d+\z}
73 Net::HTTP.start(uri.host, uri.port) do |http|
74 p http.post(uri.path, req, {'Content-Type'=>'application/json'})
77 warn "not updating freshmeat for v#{version}"
81 # optional rake-compiler support in case somebody needs to cross compile
83 mk = "ext/unicorn_http/Makefile"
85 warn "run 'gmake -C ext/unicorn_http clean' and\n" \
86 "remove #{mk} before using rake-compiler"
88 unless File.readable?("ext/unicorn_http/unicorn_http.c")
89 abort "run 'gmake ragel' or 'make ragel' to generate the Ragel source"
91 spec = Gem::Specification.load('unicorn.gemspec')
92 require 'rake/extensiontask'
93 Rake::ExtensionTask.new('unicorn_http', spec)