copy_stream: enough to get this working under MRI 1.8
[ruby_io_splice.git] / Rakefile
blob117a03eaa95aebbabf5aa1291ce34d1b5c9d9b2e
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('io_splice.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 'net/http'
38   require 'net/netrc'
39   rc = Net::Netrc.locate('io_splice-raa') or abort "~/.netrc not found"
40   password = rc.password
42   s = Gem::Specification.load('io_splice.gemspec')
43   desc = [ s.description.strip ]
44   desc << ""
45   desc << "* #{s.email}"
46   desc << "* #{git_url}"
47   desc << "* #{cgit_url}"
48   desc = desc.join("\n")
49   uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
50   form = {
51     :name => s.name,
52     :short_description => s.summary,
53     :version => s.version.to_s,
54     :status => 'stable',
55     :owner => s.authors.first,
56     :email => s.email,
57     :category_major => 'Library',
58     :category_minor => 'System',
59     :url => s.homepage,
60     :download => 'http://rubyforge.org/frs/?group_id=5626',
61     :license => "LGPL",
62     :description_style => 'Plain',
63     :description => desc,
64     :pass => password,
65     :submit => 'Update',
66   }
67   res = Net::HTTP.post_form(uri, form)
68   p res
69   puts res.body
70 end