1 # -*- encoding: binary -*-
3 # most tasks are in the GNUmakefile which offers better parallelism
6 @old_summaries ||= File.readlines(".CHANGELOG.old").inject({}) do |hash, line|
7 version, summary = line.split(/ - /, 2)
8 hash[version] = summary
14 timefmt = '%Y-%m-%dT%H:%M:%SZ'
15 @tags ||= `git tag -l`.split(/\n/).map do |tag|
16 next if tag == "v0.0.0"
17 if %r{\Av[\d\.]+\z} =~ tag
18 header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
19 header = header.split(/\n/)
20 tagger = header.grep(/\Atagger /).first
23 :time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
24 :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1],
25 :tagger_email => %r{<([^>]+)>}.match(tagger)[1],
26 :id => `git rev-parse refs/tags/#{tag}`.chomp!,
29 :body => (old = old_summaries[tag]) ? "#{old}\n#{body}" : body,
32 end.compact.sort { |a,b| b[:time] <=> a[:time] }
35 cgit_url = "http://git.bogomips.org/cgit/unicorn.git"
37 desc 'prints news as an Atom feed'
41 puts(Nokogiri::XML::Builder.new do
42 feed :xmlns => "http://www.w3.org/2005/Atom" do
43 id! "http://unicorn.bogomips.org/NEWS.atom.xml"
45 subtitle "Rack HTTP server for Unix and fast clients"
46 link! :rel => 'alternate', :type => 'text/html',
47 :href => 'http://unicorn.bogomips.org/NEWS.html'
48 updated new_tags.first[:time]
49 new_tags.each do |tag|
55 name tag[:tagger_name]
56 email tag[:tagger_email]
58 url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
59 link! :rel => "alternate", :type => "text/html", :href =>url
61 content(:type => 'text') { tag[:body] }
68 desc 'prints RDoc-formatted news'
71 time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
72 puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
76 puts tag[:body].gsub(/^/sm, " ").gsub!(/[ \t]+$/sm, "")
81 desc "print release changelog for Rubyforge"
82 task :release_changes do
83 version = ENV['VERSION'] or abort "VERSION= needed"
84 version = "v#{version}"
85 vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
86 prev = vtags[vtags.index(version) - 1]
87 system('git', 'diff', '--stat', prev, version) or abort $?
89 system('git', 'log', "#{prev}..#{version}") or abort $?
92 desc "print release notes for Rubyforge"
93 task :release_notes do
96 git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/unicorn.git'
98 spec = Gem::Specification.load('unicorn.gemspec')
99 puts spec.description.strip
101 puts "* #{spec.homepage}"
102 puts "* #{spec.email}"
105 _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
106 print "\nChanges:\n\n"