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