README: fix links
[clogger.git] / Rakefile
blobcdcded15c050c408749c33a9048988bee676736c
1 begin
2   require 'rake/extensiontask'
3   Rake::ExtensionTask.new('clogger_ext')
4 rescue LoadError
5   warn "rake-compiler not available, cross compiling disabled"
6 end
8 desc 'prints RDoc-formatted history'
9 task :history do
10   tags = `git tag -l`.split(/\n/).grep(/^v/).reverse
11   timefmt = '%Y-%m-%d %H:%M UTC'
12   tags.each do |tag|
13     header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/)
14     tagger = header.split(/\n/).grep(/^tagger /).first.split(/\s/)
15     time = Time.at(tagger[-2].to_i).utc
16     puts "=== #{tag.sub(/^v/, '')} / #{time.strftime(timefmt)}"
17     puts ""
18     puts body
19     puts ""
20   end
21 end
23 desc "read news article from STDIN and post to rubyforge"
24 task :publish_news do
25   require 'rubyforge'
26   IO.select([STDIN], nil, nil, 1) or abort "E: news must be read from stdin"
27   msg = STDIN.readlines
28   subject = msg.shift
29   blank = msg.shift
30   blank == "\n" or abort "no newline after subject!"
31   subject.strip!
32   body = msg.join("").strip!
34   rf = RubyForge.new.configure
35   rf.login
36   rf.post_news('clogger', subject, body)
37 end