1 # -*- encoding: binary -*-
3 # most tasks are in the GNUmakefile which offers better parallelism
6 timefmt = '%Y-%m-%dT%H:%M:%SZ'
7 @tags ||= `git tag -l`.split(/\n/).map do |tag|
8 if %r{\Av[\d\.]+\z} =~ tag
9 header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
10 header = header.split(/\n/)
11 tagger = header.grep(/\Atagger /).first
14 :time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
15 :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1],
16 :tagger_email => %r{<([^>]+)>}.match(tagger)[1],
17 :id => `git rev-parse refs/tags/#{tag}`.chomp!,
23 end.compact.sort { |a,b| b[:time] <=> a[:time] }
26 cgit_url = "http://git.bogomips.org/cgit/rainbows.git"
28 desc 'prints news as an Atom feed'
32 puts(Nokogiri::XML::Builder.new do
33 feed :xmlns => "http://www.w3.org/2005/Atom" do
34 id! "http://rainbows.rubyforge.org/NEWS.atom.xml"
35 title "Rainbows! news"
36 subtitle "Unicorn for sleepy apps and slow clients"
37 link! :rel => 'alternate', :type => 'text/html',
38 :href => 'http://rainbows.rubyforge.org/NEWS.html'
39 updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time])
40 new_tags.each do |tag|
46 name tag[:tagger_name]
47 email tag[:tagger_email]
49 url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
50 link! :rel => "alternate", :type => "text/html", :href =>url
52 content(:type => 'text') { tag[:body] }
59 desc 'prints RDoc-formatted news'
62 time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
63 puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
67 puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
72 desc "print release changelog for Rubyforge"
73 task :release_changes do
74 version = ENV['VERSION'] or abort "VERSION= needed"
75 version = "v#{version}"
76 vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
77 prev = vtags[vtags.index(version) - 1]
79 system('git', 'diff', '--stat', prev, version) or abort $?
81 system('git', 'log', "#{prev}..#{version}") or abort $?
83 system('git', 'log', version) or abort $?
87 desc "print release notes for Rubyforge"
88 task :release_notes do
91 git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/rainbows.git'
93 spec = Gem::Specification.load('rainbows.gemspec')
94 puts spec.description.strip
96 puts "* #{spec.homepage}"
97 puts "* #{spec.email}"
100 _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
101 print "\nChanges:\n\n"
105 desc "read news article from STDIN and post to rubyforge"
106 task :publish_news do
108 IO.select([STDIN], nil, nil, 1) or abort "E: news must be read from stdin"
109 msg = STDIN.readlines
112 blank == "\n" or abort "no newline after subject!"
114 body = msg.join("").strip!
116 rf = RubyForge.new.configure
118 rf.post_news('rainbows', subject, body)