1 desc "read news article from STDIN and post to rubyforge"
4 IO.select([STDIN], nil, nil, 1) or abort "E: news must be read from stdin"
8 blank == "\n" or abort "no newline after subject!"
10 body = msg.join("").strip!
12 rf = RubyForge.new.configure
14 rf.post_news('rainbows', subject, body)
18 timefmt = '%Y-%m-%dT%H:%M:%SZ'
19 @tags ||= `git tag -l`.split(/\n/).map do |tag|
20 next if tag == "v0.0.0"
21 if %r{\Av[\d\.]+\z} =~ tag
22 header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
23 header = header.split(/\n/)
24 tagger = header.grep(/\Atagger /).first
27 :time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
28 :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1],
29 :tagger_email => %r{<([^>]+)>}.match(tagger)[1],
30 :id => `git rev-parse refs/tags/#{tag}`.chomp!,
36 end.compact.sort { |a,b| b[:time] <=> a[:time] }
39 cgit_url = "http://git.bogomips.org/cgit/kcar.git"
40 git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/kcar.git'
42 desc 'prints news as an Atom feed'
46 puts(Nokogiri::XML::Builder.new do
47 feed :xmlns => "http://www.w3.org/2005/Atom" do
48 id! "http://kcar.rubyforge.org/NEWS.atom.xml"
50 subtitle File.readlines("README").first
51 link! :rel => 'alternate', :type => 'text/html',
52 :href => 'http://bogomips.org/kcar/'
53 updated( (new_tags.first[:time] rescue nil) || Time.now )
54 new_tags.each do |tag|
60 name tag[:tagger_name]
61 email tag[:tagger_email]
63 url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
64 link! :rel => "alternate", :type => "text/html", :href =>url
66 content(:type => 'text') { tag[:body] }
73 desc 'prints RDoc-formatted news'
76 time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
77 puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
81 puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
86 desc "print release changelog for Rubyforge"
87 task :release_changes do
88 version = ENV['VERSION'] or abort "VERSION= needed"
89 version = "v#{version}"
90 vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
91 prev = vtags[vtags.index(version) - 1]
92 system('git', 'diff', '--stat', prev, version) or abort $?
94 system('git', 'log', "#{prev}..#{version}") or abort $?
97 desc "print release notes for Rubyforge"
98 task :release_notes do
101 spec = Gem::Specification.load('kcar.gemspec')
102 puts spec.description.strip
104 puts "* #{spec.homepage}"
105 puts "* #{spec.email}"
108 _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
109 print "\nChanges:\n\n"
118 rc = Net::Netrc.locate('kcar-raa') or abort "~/.netrc not found"
119 password = rc.password
121 s = Gem::Specification.load('kcar.gemspec')
122 desc = [ s.description.strip ]
124 desc << "* #{s.email}"
125 desc << "* #{git_url}"
126 desc << "* #{cgit_url}"
127 desc = desc.join("\n")
128 uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
131 :short_description => s.summary,
132 :version => s.version.to_s,
133 :status => 'experimental',
134 :owner => s.authors.first,
136 :category_major => 'Library',
137 :category_minor => 'WWW',
139 :download => 'http://rubyforge.org/frs/?group_id=8977',
140 :license => "Ruby's",
141 :description_style => 'Plain',
142 :description => desc,
146 res = Net::HTTP.post_form(uri, form)