pkg.mk update
[clogger.git] / Rakefile
blobea15a5846a5459bbbf3bf8dd8a364337dae8f0c9
1 begin
2   require 'rake/extensiontask'
3   Rake::ExtensionTask.new('clogger_ext')
4 rescue LoadError
5   warn "rake-compiler not available, cross compiling disabled"
6 end
8 cgit_url = "http://bogomips.org/clogger.git"
9 git_url = 'git://bogomips.org/clogger.git'
11 desc "post news article to rubyforge"
12 task :publish_news do
13   require 'rubyforge'
14   spec = Gem::Specification.load('clogger.gemspec')
15   tmp = Tempfile.new('rf-news')
16   _, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
17   tmp.puts subject
18   tmp.puts
19   tmp.puts spec.description.strip
20   tmp.puts ""
21   tmp.puts "* #{spec.homepage}"
22   tmp.puts "* #{spec.email}"
23   tmp.puts "* #{git_url}"
24   tmp.print "\nChanges:\n\n"
25   tmp.puts body
26   tmp.flush
27   system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
28   msg = File.readlines(tmp.path)
29   subject = msg.shift
30   blank = msg.shift
31   blank == "\n" or abort "no newline after subject!"
32   subject.strip!
33   body = msg.join("").strip!
35   rf = RubyForge.new.configure
36   rf.login
37   rf.post_news('clogger', subject, body)
38 end
40 desc "post to RAA"
41 task :raa_update do
42   require 'rubygems'
43   require 'net/http'
44   require 'net/netrc'
45   rc = Net::Netrc.locate('clogger-raa') or abort "~/.netrc not found"
46   password = rc.password
48   s = Gem::Specification.load('clogger.gemspec')
49   desc = [ s.description.strip ]
50   desc << ""
51   desc << "* #{s.email}"
52   desc << "* #{git_url}"
53   desc << "* #{cgit_url}"
54   desc = desc.join("\n")
55   uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
56   form = {
57     :name => s.name,
58     :short_description => s.summary,
59     :version => s.version.to_s,
60     :status => 'experimental',
61     :owner => s.authors.first,
62     :email => s.email,
63     :category_major => 'Library',
64     :category_minor => 'Rack',
65     :url => s.homepage,
66     :download => 'http://rubyforge.org/frs/?group_id=8896',
67     :license => 'LGPL',
68     :description_style => 'Plain',
69     :description => desc,
70     :pass => password,
71     :submit => 'Update',
72   }
73   res = Net::HTTP.post_form(uri, form)
74   p res
75   puts res.body
76 end