1 # -*- encoding: binary -*-
2 autoload :Gem, 'rubygems'
5 cgit_url = Wrongdoc.config[:cgit_url]
6 git_url = Wrongdoc.config[:git_url]
14 version = ENV['VERSION'] or abort "VERSION= needed"
15 uri = URI.parse('https://freecode.com/projects/unicorn/releases.json')
16 rc = Net::Netrc.locate('unicorn-fm') or abort "~/.netrc not found"
17 api_token = rc.password
18 _, subject, body = `git cat-file tag v#{version}`.split(/\n\n/, 3)
19 tmp = Tempfile.new('fm-changelog')
24 system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
25 changelog = File.read(tmp.path).strip
28 "auth_code" => api_token,
30 "tag_list" => "Experimental",
32 "changelog" => changelog,
36 if ! changelog.strip.empty? && version =~ %r{\A[\d\.]+\d+\z}
37 Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
38 p http.post(uri.path, req, {'Content-Type'=>'application/json'})
41 warn "not updating freshmeat for v#{version}"
45 # optional rake-compiler support in case somebody needs to cross compile
47 mk = "ext/unicorn_http/Makefile"
49 warn "run 'gmake -C ext/unicorn_http clean' and\n" \
50 "remove #{mk} before using rake-compiler"
52 unless File.readable?("ext/unicorn_http/unicorn_http.c")
53 abort "run 'gmake ragel' or 'make ragel' to generate the Ragel source"
55 spec = Gem::Specification.load('unicorn.gemspec')
56 require 'rake/extensiontask'
57 Rake::ExtensionTask.new('unicorn_http', spec)