no need to rb_intern("*")
[ruby_posix_mq.git] / Rakefile
blobad4962243daf1be672420ec1d1602ab861e8ff16
1 # -*- encoding: binary -*-
2 require 'wrongdoc'
3 cgit_url = Wrongdoc.config[:cgit_url]
4 git_url = Wrongdoc.config[:git_url]
6 desc "post news article to rubyforge"
7 task :publish_news do
8   require 'rubyforge'
9   spec = Gem::Specification.load('posix_mq.gemspec')
10   tmp = Tempfile.new('rf-news')
11   _, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
12   tmp.puts subject
13   tmp.puts
14   tmp.puts spec.description.strip
15   tmp.puts ""
16   tmp.puts "* #{spec.homepage}"
17   tmp.puts "* #{spec.email}"
18   tmp.puts "* #{git_url}"
19   tmp.print "\nChanges:\n\n"
20   tmp.puts body
21   tmp.flush
22   system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
23   msg = File.readlines(tmp.path)
24   subject = msg.shift
25   blank = msg.shift
26   blank == "\n" or abort "no newline after subject!"
27   subject.strip!
28   body = msg.join("").strip!
30   rf = RubyForge.new.configure
31   rf.login
32   rf.post_news('qrp', subject, body)
33 end
35 desc "post to RAA"
36 task :raa_update do
37   require 'rubygems'
38   require 'net/http'
39   require 'net/netrc'
40   rc = Net::Netrc.locate('posix_mq-raa') or abort "~/.netrc not found"
41   password = rc.password
43   s = Gem::Specification.load('posix_mq.gemspec')
44   desc = [ s.description.strip ]
45   desc << ""
46   desc << "* #{s.email}"
47   desc << "* #{git_url}"
48   desc << "* #{cgit_url}"
49   desc = desc.join("\n")
50   uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
51   form = {
52     :name => s.name,
53     :short_description => s.summary,
54     :version => s.version.to_s,
55     :status => 'experimental',
56     :owner => s.authors.first,
57     :email => s.email,
58     :category_major => 'Library',
59     :category_minor => 'System',
60     :url => s.homepage,
61     :download => 'http://rubyforge.org/frs/?group_id=5626',
62     :license => 'LGPL', # LGPLv3, actually, but RAA is ancient...
63     :description_style => 'Plain',
64     :description => desc,
65     :pass => password,
66     :submit => 'Update',
67   }
68   res = Net::HTTP.post_form(uri, form)
69   p res
70   puts res.body
71 end