1 # -*- encoding: binary -*-
2 autoload :Gem, 'rubygems'
4 # most tasks are in the GNUmakefile which offers better parallelism
6 TIMEFMT = '%Y-%m-%dT%H:%M:%SZ'
8 @tags ||= `git tag -l`.split(/\n/).map do |tag|
9 if %r{\Av[\d\.]+} =~ tag
10 header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
11 header = header.split(/\n/)
12 tagger = header.grep(/\Atagger /).first
15 :time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(TIMEFMT),
16 :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1].strip,
17 :tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
18 :id => `git rev-parse refs/tags/#{tag}`.chomp!,
24 end.compact.sort { |a,b| b[:time] <=> a[:time] }
27 cgit_url = "http://git.bogomips.org/cgit/metropolis.git"
28 git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/metropolis.git'
30 desc 'prints news as an Atom feed'
34 puts(Nokogiri::XML::Builder.new do
35 feed :xmlns => "http://www.w3.org/2005/Atom" do
36 id! "http://metropolis.bogomips.org/NEWS.atom.xml"
37 title "Metropolis news"
38 subtitle "Rack HTTP key value store"
39 link! :rel => 'alternate', :type => 'text/html',
40 :href => 'http://metropolis.bogomips.org/NEWS.html'
42 updated(new_tags[0][:time])
44 updated(Time.now.utc.strftime(TIMEFMT))
46 new_tags.each do |tag|
52 name tag[:tagger_name]
53 email tag[:tagger_email]
55 url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
56 link! :rel => "alternate", :type => "text/html", :href =>url
58 message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/s).first.strip
59 content({:type =>:text}, message_only)
60 content(:type =>:xhtml) { pre tag[:body] }
67 desc 'prints RDoc-formatted news'
70 time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
71 puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
75 puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
80 desc "print release changelog for Rubyforge"
81 task :release_changes do
82 version = ENV['VERSION'] or abort "VERSION= needed"
83 version = "v#{version}"
84 vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
85 prev = vtags[vtags.index(version) - 1]
87 system('git', 'diff', '--stat', prev, version) or abort $?
89 system('git', 'log', "#{prev}..#{version}") or abort $?
91 system('git', 'log', version) or abort $?
95 desc "print release notes for Rubyforge"
96 task :release_notes do
97 spec = Gem::Specification.load('metropolis.gemspec')
98 puts spec.description.strip
100 puts "* #{spec.homepage}"
101 puts "* #{spec.email}"
104 _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
105 print "\nChanges:\n\n"
113 rc = Net::Netrc.locate('metropolis-raa') or abort "~/.netrc not found"
114 password = rc.password
116 s = Gem::Specification.load('metropolis.gemspec')
117 desc = [ s.description.strip ]
119 desc << "* #{s.email}"
120 desc << "* #{git_url}"
121 desc << "* #{cgit_url}"
122 desc = desc.join("\n")
123 uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
126 :short_description => s.summary,
127 :version => s.version.to_s,
129 :owner => s.authors.first,
131 :category_major => 'Library',
132 :category_minor => 'Web',
134 :download => "http://rubyforge.org/frs/?group_id=1306",
135 :license => "Ruby's",
136 :description_style => 'Plain',
137 :description => desc,
141 res = Net::HTTP.post_form(uri, form)