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/upr.git"
27 git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/upr.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://upr.bogomips.org/NEWS.atom.xml"
37 subtitle "Upload Progress for Rack"
38 link! :rel => 'alternate', :type => 'text/html',
39 :href => 'http://upr.bogomips.org/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 content({:type => 'text'}, tag[:body])
60 desc 'prints RDoc-formatted news'
63 time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
64 puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
68 puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
73 desc "print release changelog for Rubyforge"
74 task :release_changes do
75 version = ENV['VERSION'] or abort "VERSION= needed"
76 version = "v#{version}"
77 vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
78 prev = vtags[vtags.index(version) - 1]
80 system('git', 'diff', '--stat', prev, version) or abort $?
82 system('git', 'log', "#{prev}..#{version}") or abort $?
84 system('git', 'log', version) or abort $?
88 desc "print release notes for Rubyforge"
89 task :release_notes do
92 spec = Gem::Specification.load('upr.gemspec')
93 puts spec.description.strip
95 puts "* #{spec.homepage}"
96 puts "* #{spec.email}"
99 _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
100 print "\nChanges:\n\n"
104 desc "read news article from STDIN and post to rubyforge"
105 task :publish_news do
107 IO.select([STDIN], nil, nil, 1) or abort "E: news must be read from stdin"
108 msg = STDIN.readlines
111 blank == "\n" or abort "no newline after subject!"
113 body = msg.join("").strip!
115 rf = RubyForge.new.configure
117 rf.post_news('rainbows', subject, body)
125 rc = Net::Netrc.locate('upr-raa') or abort "~/.netrc not found"
126 password = rc.password
129 s = Gem::Specification.load('upr.gemspec')
130 desc = [ s.description.strip ]
132 desc << "* #{s.homepage}"
133 desc << "* #{s.email}"
134 desc << "* #{git_url}"
135 desc << "* http://upr-demo.bogomips.org/"
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,
143 :owner => s.authors.first,
144 :email => 'upr@bogomips.org',
145 :category_major => 'Library',
146 :category_minor => 'Rack',
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)