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].strip,
16 :tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
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/sunshowers.git"
27 git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/sunshowers.git'
29 desc 'prints news as an Atom feed'
33 puts(Nokogiri::XML::Builder.new do
34 feed :xmlns => "http://www.w3.org/2005/Atom" do
35 id! "http://rainbows.rubyforge.org/sunshowers/NEWS.atom.xml"
36 title "Sunshowers news"
37 subtitle "Web Sockets for Ruby, Rack+Rainbows!"
38 link! :rel => 'alternate', :type => 'text/html',
39 :href => 'http://rainbows.rubyforge.org/sunshowers/NEWS.html'
40 updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time])
41 new_tags.each do |tag|
47 name tag[:tagger_name]
48 email tag[:tagger_email]
50 url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
51 link! :rel => "alternate", :type => "text/html", :href =>url
53 message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/s).first.strip
54 content({:type =>:text}, message_only)
55 content(:type =>:xhtml) { pre tag[:body] }
62 desc 'prints RDoc-formatted news'
65 time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
66 puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
70 puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
75 desc "print release changelog for Rubyforge"
76 task :release_changes do
77 version = ENV['VERSION'] or abort "VERSION= needed"
78 version = "v#{version}"
79 vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
80 prev = vtags[vtags.index(version) - 1]
82 system('git', 'diff', '--stat', prev, version) or abort $?
84 system('git', 'log', "#{prev}..#{version}") or abort $?
86 system('git', 'log', version) or abort $?
90 desc "print release notes for Rubyforge"
91 task :release_notes do
94 spec = Gem::Specification.load('sunshowers.gemspec')
95 puts spec.description.strip
97 puts "* #{spec.homepage}"
98 puts "* #{spec.email}"
101 _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
102 print "\nChanges:\n\n"
106 desc "read news article from STDIN and post to rubyforge"
107 task :publish_news do
109 IO.select([STDIN], nil, nil, 1) or abort "E: news must be read from stdin"
110 msg = STDIN.readlines
113 blank == "\n" or abort "no newline after subject!"
115 body = msg.join("").strip!
117 rf = RubyForge.new.configure
119 rf.post_news('rainbows', subject, body)
127 rc = Net::Netrc.locate('sunshowers-raa') or abort "~/.netrc not found"
128 password = rc.password
130 s = Gem::Specification.load('sunshowers.gemspec')
131 desc = [ s.description.strip ]
133 desc << "* #{s.email}"
134 desc << "* #{git_url}"
135 desc << "* #{cgit_url}"
136 desc = desc.join("\n")
137 uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
140 :short_description => s.summary,
141 :version => s.version.to_s,
142 :status => 'experimental',
143 :owner => s.authors.first,
145 :category_major => 'Library',
146 :category_minor => 'Web',
148 :download => "http://rubyforge.org/frs/?group_id=8977",
149 :license => "Ruby's",
150 :description_style => 'Plain',
151 :description => desc,
155 res = Net::HTTP.post_form(uri, form)