Sha256: fb04e81b7671b658184045707523e4680ab55c58daeb69bf89f823c02852e4b4

Contents?: true

Size: 851 Bytes

Versions: 8

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

require "versionaire"

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

      using Versionaire::Cast

      def call configuration = Container[:configuration]
        version = Version configuration.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

      def push
        repository.tag_push.then do |_stdout, stderr, status|
          status.success? && stderr.match?(/[new tag]/)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
milestoner-14.5.0 lib/milestoner/tags/pusher.rb
milestoner-14.4.0 lib/milestoner/tags/pusher.rb
milestoner-14.3.0 lib/milestoner/tags/pusher.rb
milestoner-14.2.0 lib/milestoner/tags/pusher.rb
milestoner-14.1.0 lib/milestoner/tags/pusher.rb
milestoner-14.0.2 lib/milestoner/tags/pusher.rb
milestoner-14.0.1 lib/milestoner/tags/pusher.rb
milestoner-14.0.0 lib/milestoner/tags/pusher.rb