class Milestoner::Tags::Pusher

Handles publishing of tags to a remote repository.

Attributes

container[R]

Public Class Methods

new(container: Container) click to toggle source
# File lib/milestoner/tags/pusher.rb, line 11
def initialize container: Container
  @container = container
end

Public Instance Methods

call(configuration = CLI::Configuration::Loader.call) click to toggle source
# File lib/milestoner/tags/pusher.rb, line 15
def call configuration = CLI::Configuration::Loader.call
  version = Version configuration.git_tag_version

  fail Error, "Remote repository not configured." unless repository.config_origin?
  fail Error, "Remote tag exists: #{version}." if repository.tag_remote? version
  fail Error, "Tags could not be pushed to remote repository." unless push

  logger.debug "Local tag pushed: #{version}."
end

Private Instance Methods

logger(= container[__method__]) click to toggle source
# File lib/milestoner/tags/pusher.rb, line 37
  def logger = container[__method__]
end
push() click to toggle source
# File lib/milestoner/tags/pusher.rb, line 29
def push
  repository.tag_push.then do |_stdout, stderr, status|
    status.success? && stderr.match?(/[new tag]/)
  end
end
repository(= container[__method__]) click to toggle source
# File lib/milestoner/tags/pusher.rb, line 35
    def repository = container[__method__]

    def logger = container[__method__]
  end
end