Sha256: 3a1f75fd8c79fd466dd8e2a8449a9afe46e638c2358df6e40ee7f0a9b089d78f

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

task "build" => "changelogs"

changelog = proc do |output, ver = nil, prev = nil|
  ver &&= Gem::Version.new(ver)
  range = [[prev], [ver, "HEAD"]].map {|ver, branch| ver ? "v#{ver.to_s}" : branch}.compact.join("..")
  IO.popen(%W[git log --format=fuller --topo-order --no-merges #{range}]) do |log|
    line = log.gets
    FileUtils.mkpath(File.dirname(output))
    File.open(output, "wb") do |f|
      f.print "-*- coding: utf-8 -*-\n\n", line
      log.each_line do |line|
        line.sub!(/^(?!:)(?:Author|Commit)?(?:Date)?: /, '  \&')
        line.sub!(/ +$/, '')
        f.print(line)
      end
    end
  end
end

tags = IO.popen(%w[git tag -l v[0-9]*]).grep(/v(.*)/) {$1}
tags.sort_by! {|tag| tag.scan(/\d+/).map(&:to_i)}
tags.inject(nil) do |prev, tag|
  task("logs/ChangeLog-#{tag}") {|t| changelog[t.name, tag, prev]}
  tag
end

desc "Make ChangeLog"
task "ChangeLog", [:ver, :prev] do |t, ver: nil, prev: tags.last|
  changelog[t.name, ver, prev]
end

changelogs = ["ChangeLog", *tags.map {|tag| "logs/ChangeLog-#{tag}"}]
task "changelogs" => changelogs
CLOBBER.concat(changelogs) << "logs"

Version data entries

15 entries across 15 versions & 7 rubygems

Version Path
cli-option_parser.rb-0.6.0 rakelib/changelogs.rake
cli-option_parser.rb-0.5.3 rakelib/changelogs.rake
cli-option_parser.rb-0.5.2 rakelib/changelogs.rake
cmd-optparse.rb-0.5.2 rakelib/changelogs.rake
cmd-optparse.rb-0.5.0 rakelib/changelogs.rake
cmd-optparse.rb-0.1.1 rakelib/changelogs.rake
cmd-optparse.rb-0.1.0 rakelib/changelogs.rake
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/io-wait-0.2.1/rakelib/changelogs.rake
win32ole-1.8.10 rakelib/changelogs.rake
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/io-wait-0.2.1/rakelib/changelogs.rake
win32ole-1.8.9 rakelib/changelogs.rake
cgi-0.3.2 rakelib/changelogs.rake
io-wait-0.2.1 rakelib/changelogs.rake
io-wait-0.2.0 rakelib/changelogs.rake
optparse-0.1.1 rakelib/changelogs.rake