Sha256: 5b52ffa583062c436fe43623d5b0773e676927c38b436d523f86537cf2902765

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

require "versionaire"

module Milestoner
  module Tags
    # Handles publishing of tags to a remote repository.
    class Pusher
      include Import[:git, :logger]

      using Versionaire::Cast

      def call configuration = Container[:configuration]
        version = Version configuration.version

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

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

      private

      def push = git.tags_push.value_or("").match?(/[new tag]/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milestoner-15.0.0 lib/milestoner/tags/pusher.rb