mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Add custom version of git:changelog
This commit is contained in:
parent
95e469c71e
commit
c50d8ea85d
1 changed files with 44 additions and 0 deletions
44
Rakefile
44
Rakefile
|
@ -28,6 +28,50 @@ end
|
|||
# hoe/test's .gemtest touch file thingy for now
|
||||
HOE.spec.files -= [".gemtest"]
|
||||
|
||||
include Hoe::Git
|
||||
|
||||
desc "Print the current changelog."
|
||||
task "changelog" do
|
||||
tag = ENV["FROM"] || git_tags.last
|
||||
range = [tag, "HEAD"].compact.join ".."
|
||||
cmd = "git log #{range} '--format=tformat:%B|||%aN|||%aE|||'"
|
||||
now = Time.new.strftime "%Y-%m-%d"
|
||||
|
||||
changes = `#{cmd}`.split(/\|\|\|/).each_slice(3).map { |msg, author, email|
|
||||
msg.split(/\n/).reject { |s| s.empty? }.first
|
||||
}.flatten.compact
|
||||
|
||||
$changes = Hash.new { |h,k| h[k] = [] }
|
||||
|
||||
codes = {
|
||||
"!" => :major,
|
||||
"+" => :minor,
|
||||
"*" => :minor,
|
||||
"-" => :bug,
|
||||
"?" => :unknown,
|
||||
}
|
||||
|
||||
codes_re = Regexp.escape codes.keys.join
|
||||
|
||||
changes.each do |change|
|
||||
if change =~ /^\s*([#{codes_re}])\s*(.*)/ then
|
||||
code, line = codes[$1], $2
|
||||
else
|
||||
code, line = codes["?"], change.chomp
|
||||
end
|
||||
|
||||
$changes[code] << line
|
||||
end
|
||||
|
||||
puts "=== #{ENV['VERSION'] || 'NEXT'} / #{now}"
|
||||
puts
|
||||
changelog_section :major
|
||||
changelog_section :minor
|
||||
changelog_section :bug
|
||||
changelog_section :unknown
|
||||
puts
|
||||
end
|
||||
|
||||
# puma.gemspec
|
||||
|
||||
file "#{HOE.spec.name}.gemspec" => ['Rakefile', "lib/puma/const.rb"] do |t|
|
||||
|
|
Loading…
Reference in a new issue