1 # this is only used for release-related tasks and should not
2 # be needed by normal development
4 include Rake::DSL if defined?(Rake::DSL)
6 url_base = "https://yhbt.net/cmogstored"
7 cgit_url = url_base + '.git'
8 git_url = 'https://yhbt.net/cmogstored.git'
11 timefmt = '%Y-%m-%dT%H:%M:%SZ'
12 @tags ||= `git tag -l`.split(/\n/).map do |tag|
13 if %r{\Av[\d\.]+} =~ tag
14 header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
15 header = header.split(/\n/)
16 tagger = header.grep(/\Atagger /).first
19 :time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
20 :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1].strip,
21 :tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
22 :id => `git rev-parse refs/tags/#{tag}`.chomp!,
28 end.compact.sort { |a,b| b[:time] <=> a[:time] }
31 desc 'prints news as an Atom feed'
33 require 'builder' # gem install builder
35 x = Builder::XmlMarkup.new
36 x.instruct! :xml, :encoding => 'UTF-8', :version => '1.0'
37 x.feed(:xmlns => "http://www.w3.org/2005/Atom") do
38 x.id "#{url_base}/NEWS.atom.xml"
39 x.title "cmogstored news"
40 x.subtitle "alternative mogstored implementation for MogileFS"
41 x.link :rel => 'alternate', :type => 'text/plain',
42 :href => "#{url_base}/NEWS"
43 x.updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time])
44 new_tags.each do |tag|
48 x.published tag[:time]
50 x.name tag[:tagger_name]
51 x.email tag[:tagger_email]
53 url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
54 x.link :rel => "alternate", :type => "text/html", :href => url
56 x.content(:type =>:xhtml) do
57 x.div(:xmlns => 'http://www.w3.org/1999/xhtml') do
67 desc 'prints news as a text file'
69 title = "cmogstored news"
71 puts('-' * title.length)
74 time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
75 line = "#{tag[:tag].sub(/^v/, '')} / #{time}"
77 puts("-" * line.length)
80 puts tag[:body].gsub(/^/m, " ").gsub(/[ \t]+$/m, "")
81 puts "" unless tag == tags.last
85 desc "dump changelog to stdout"
89 puts "cmogstored changelog since #{since}"
90 puts "Full changeset information is available at #{git_url}"
91 puts "See NEWS file for a user-oriented summary of changes"
94 cmd = %w(git log --pretty=medium --date=iso --decorate) << "#{since}.."
95 system(*cmd) or abort $?
98 desc "compare dist tar.gz against contents in the git tree"
99 task :distcheck_git do
100 tgz = ENV["TGZ"] or abort "TGZ= not specified"
101 tgzfiles = `tar -ztf #{tgz}`.split(/\n/)
102 tgzfiles.map! { |f| f.gsub!(%r{^[^/]+/}, '') }
103 gitfiles = `git ls-files`.split(/\n/)
104 gitonly = gitfiles - tgzfiles
105 gitonly -= %w(build-aux/manpage-hack.mk)
107 warn "The following files are missing from #{tgz}"
109 gitonly.each { |f| warn f }