1 # -*- encoding: binary -*-
3 cgit_url = Olddoc.config['cgit_url']
4 git_url = Olddoc.config['git_url']
6 desc "post news article to rubyforge"
9 spec = Gem::Specification.load('local-openid.gemspec')
10 tmp = Tempfile.new('rf-news')
11 _, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
14 tmp.puts spec.description.strip
16 tmp.puts "* #{spec.homepage}"
17 tmp.puts "* #{spec.email}"
18 tmp.puts "* #{git_url}"
19 tmp.print "\nChanges:\n\n"
22 system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
23 msg = File.readlines(tmp.path)
26 blank == "\n" or abort "no newline after subject!"
28 body = msg.join("").strip!
30 rf = RubyForge.new.configure
32 rf.post_news('qrp', subject, body)
41 version = ENV['VERSION'] or abort "VERSION= needed"
42 uri = URI.parse('https://freecode.com/projects/local-openid/releases.json')
43 rc = Net::Netrc.locate('local-openid-fm') or abort "~/.netrc not found"
44 api_token = rc.password
45 _, subject, body = `git cat-file tag v#{version}`.split(/\n\n/, 3)
46 tmp = Tempfile.new('fm-changelog')
51 system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
52 changelog = File.read(tmp.path).strip
55 "auth_code" => api_token,
57 "tag_list" => "Stable",
59 "changelog" => changelog,
63 if ! changelog.strip.empty? && version =~ %r{\A[\d\.]+\d+\z}
64 Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
65 p http.post(uri.path, req, {'Content-Type'=>'application/json'})
68 warn "not updating freshmeat for v#{version}"