class GitBump::Release

Attributes

name[R]
sha1[R]
tag[R]
version[R]

Public Class Methods

new(tag, sha1, name, version) click to toggle source
# File lib/git_bump.rb, line 25
def initialize(tag, sha1, name, version)
  @tag, @sha1, @name, @version = tag, sha1, name, Version.new(version)
end

Public Instance Methods

body() click to toggle source
# File lib/git_bump.rb, line 47
def body
  @body ||= %x{git log -1 --pretty=format:%b #{sha1}}
end
format() click to toggle source
# File lib/git_bump.rb, line 51
def format
  body[/(?:\n  |.)*/].sub(/\A([-* ]*)(.*?)(\.?)\z/m, '\1%s\3') unless body.empty?
end
inverse_diff(context = 1) click to toggle source
# File lib/git_bump.rb, line 55
def inverse_diff(context = 1)
  unless defined?(@inverse_diff)
    @inverse_diff =
      if !%x{git rev-parse --verify -q #{sha1}^}.empty?
        %x{git diff -U#{context} #{sha1}..#{sha1}^}
      end
  end
  @inverse_diff
end
tag_body?() click to toggle source
# File lib/git_bump.rb, line 43
def tag_body?
  tag_message.to_s.sub(/\n-----BEGIN PGP.*/m, '').include?("\n\n")
end
tag_message() click to toggle source
# File lib/git_bump.rb, line 33
def tag_message
  if tag_type == 'tag'
    @tag_message ||= %x{git cat-file tag #{tag}}.split("\n\n", 2).last
  end
end
tag_signed?() click to toggle source
# File lib/git_bump.rb, line 39
def tag_signed?
  tag_message.to_s.include?("\n-----BEGIN PGP")
end
tag_type() click to toggle source
# File lib/git_bump.rb, line 29
def tag_type
  @tag_type ||= %x{git cat-file -t #{tag}}.chomp
end