Module: Wrongdoc::Release

Extended by:
History
Defined in:
lib/wrongdoc/release.rb

Class Method Summary collapse

Methods included from History

initialize_history, old_summaries, tag_uri, tags

Class Method Details

.changes(io) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/wrongdoc/release.rb', line 4

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[-1]
    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
    _, status = Process.waitpid2(fork do
      if io.fileno != $stdout.fileno
        $stdout.reopen(io)
        io.close
      end
      exec(*cmd)
    end)
    status.success? or abort status.inspect
  end
end

.notes(io, opts) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/wrongdoc/release.rb', line 34

def self.notes(io, opts)
  spec = Gem::Specification.load(Dir['*.gemspec'][0])
  _, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
  io.puts subject
  io.puts
  io.puts spec.description.strip
  io.puts
  io.puts "* #{spec.homepage}"
  io.puts "* #{spec.email}"
  io.puts "* #{opts[:git_url] || opts[:cgit_url]}"
  io.puts "* #{spec.homepage}NEWS.atom.xml"

  io.print "\nChanges:\n\n"
  io.puts body
end