Sha256: 4a0506cd4f8d272921c274c4e508b89abc1ef621df8c3c69db7c5bb5574fa1f2

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Wrongdoc::Release
  self.extend Wrongdoc::History

  def self.changes(io)
    vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
    cmds = []
    if vtags.empty?
      cmds << %w(git log)
    else
      version = vtags[0]
      prev = vtags[vtags.index(version) - 1]
      if prev
        cmds << [ 'git', 'diff', '--stat', prev, version ]
        cmds << [ 'git', 'log', "#{prev}..#{version}" ]
      else
        cmds << [ 'git', 'log', version ]
      end
    end

    io.sync = true
    cmds.each_with_index do |cmd,i|
      i > 0 and io.puts
      pid, status = Process.waitpid2(fork do
        $stdout.reopen(io)
        io.close
        exec *cmd
      end)
      status.success? or abort status.inspect
    end
  end

  def self.notes(io, opts)
    spec = Gem::Specification.load(Dir['*.gemspec'][0])
    io.puts spec.description.strip
    io.puts
    io.puts "* #{spec.homepage}"
    io.puts "* #{spec.email}"
    io.puts "* #{opts[:git_url] || opts[:cgit_url]}"

    _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
    io.print "\nChanges:\n\n"
    io.puts body
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wrongdoc-1.0.0 lib/wrongdoc/release.rb