class Released::Goals::GitTagExists

Public Class Methods

new(config) click to toggle source
# File lib/released/goals/git_tag_exists.rb, line 8
def initialize(config)
  @working_dir = config.fetch('working_dir')
  @name = config.fetch('name')
  @ref = config.fetch('ref')
end

Public Instance Methods

achieved?() click to toggle source
# File lib/released/goals/git_tag_exists.rb, line 24
def achieved?
  g.tags.any? { |t| t.name == @name && t.sha == ref_sha }
end
failure_reason() click to toggle source
# File lib/released/goals/git_tag_exists.rb, line 28
def failure_reason
  tag_with_name = g.tags.find { |t| t.name == @name }
  if tag_with_name
    "tag named #{@name} points to different rev"
  else
    "no tag named #{@name} exists"
  end
end
to_s() click to toggle source

git tag –sign –annotate 2.7.1 –message 'Version 2.7.1'

# File lib/released/goals/git_tag_exists.rb, line 16
def to_s
  "Git tag exists (#{@name}, ref #{@ref})"
end
try_achieve() click to toggle source
# File lib/released/goals/git_tag_exists.rb, line 20
def try_achieve
  g.add_tag(@name, @ref)
end

Private Instance Methods

g() click to toggle source
# File lib/released/goals/git_tag_exists.rb, line 39
def g
  @_g ||= Git.open(@working_dir)
end
ref_sha() click to toggle source
# File lib/released/goals/git_tag_exists.rb, line 43
def ref_sha
  g.object(@ref).sha
end