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\.]+} =~ 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/ruby-tdb.git"
27 git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/ruby-tdb.git'
28 web_url = "http://bogomips.org/ruby-tdb/"
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! "#{web_url}NEWS.atom.xml"
38 subtitle "Trivial Database bindings for Ruby"
39 link! :rel => "alternate", :type => "text/html",
40 :href => "#{web_url}NEWS.html"
41 updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time])
42 new_tags.each do |tag|
48 name tag[:tagger_name]
49 email tag[:tagger_email]
51 url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
52 link! :rel => "alternate", :type => "text/html", :href =>url
54 message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/s).first.strip
55 content({:type =>:text}, message_only)
56 content(:type =>:xhtml) { pre tag[:body] }
63 desc 'prints RDoc-formatted news'
66 time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
67 puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
71 puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
76 desc "print release changelog for Rubyforge"
77 task :release_changes do
78 version = ENV['VERSION'] or abort "VERSION= needed"
79 version = "v#{version}"
80 vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
81 prev = vtags[vtags.index(version) - 1]
83 system('git', 'diff', '--stat', prev, version) or abort $?
85 system('git', 'log', "#{prev}..#{version}") or abort $?
87 system('git', 'log', version) or abort $?
91 desc "print release notes for Rubyforge"
92 task :release_notes do
93 spec = Gem::Specification.load('tdb.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"
109 rc = Net::Netrc.locate('tdb-raa') or abort "~/.netrc not found"
110 password = rc.password
112 s = Gem::Specification.load('tdb.gemspec')
113 desc = [ s.description.strip ]
115 desc << "* #{s.email}"
116 desc << "* #{git_url}"
117 desc << "* #{cgit_url}"
118 desc = desc.join("\n")
119 uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
122 :short_description => s.summary,
123 :version => s.version.to_s,
124 :status => 'experimental',
125 :owner => s.authors.first,
127 :category_major => 'Library',
128 :category_minor => 'Database',
130 :download => 'http://bogomips.org/ruby-tdb/files/',
132 :description_style => 'Plain',
133 :description => desc,
137 res = Net::HTTP.post_form(uri, form)