Files
textmate/bin/update_changes
Allan Odgaard f8c823195f Update script to create release notes
We now place the GitHub version comparison link in the list of changes rather than in the heading.
2015-01-19 12:29:33 +07:00

39 lines
1.2 KiB
Ruby
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -w
require 'optparse'
PROGRAM_NAME = File.basename(__FILE__)
new_tag = nil
OptionParser.new do |opts|
opts.banner = "Usage: #{PROGRAM_NAME} [options]"
opts.on('-t', '--tag=name', 'Tag to use for next release.') { |value| new_tag = value }
opts.on_tail('-h', '--help', 'Show this message.') { puts opts; exit }
end.parse!
abort "#{PROGRAM_NAME}: No release tag specified, use -t/--tag." if new_tag.nil?
did_output = false
ARGF.each do |line|
if !did_output && line =~ %r{^#.*\b(v2(?:\.\d+)*-\w+(?:\.\w+)*)}
old_tag = $1
abort "#{PROGRAM_NAME}: Changes already added for release tag #{old_tag}." if new_tag == old_tag
changes = %x{git log --pretty=tformat:'* %s *[%an]*' --date=short #{old_tag}..|tail -r}
abort "#{PROGRAM_NAME}: Error calling git log: #{changes}" unless $? == 0
changes.gsub!(/\.?( \*\[(?:Allan Odgaard|(.+?))\]\*)$/) do
$2.nil? ? "." : ".#$1"
end
puts "## #{Time.now.strftime('%Y-%m-%d')} (#{new_tag})"
puts ""
puts changes
puts "* See [all changes since #{old_tag}](https://github.com/textmate/textmate/compare/#{old_tag}...#{new_tag})"
puts ""
did_output = true
end
puts line
end