Sha256: 6ed410b4701d73d5411af55d63b1bdaa6371fc1f4975de283fc3355c06f8842c

Contents?: true

Size: 800 Bytes

Versions: 10

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

require "versionaire"

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

      using Versionaire::Cast

      def call override = nil
        version = compute_version override

        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." if git.tags_push.failure?

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

      def compute_version value
        Version value || input.project_version
      rescue Versionaire::Error => error
        raise Error, error
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
milestoner-17.11.0 lib/milestoner/tags/pusher.rb
milestoner-17.10.0 lib/milestoner/tags/pusher.rb
milestoner-17.9.0 lib/milestoner/tags/pusher.rb
milestoner-17.6.0 lib/milestoner/tags/pusher.rb
milestoner-17.5.0 lib/milestoner/tags/pusher.rb
milestoner-17.4.0 lib/milestoner/tags/pusher.rb
milestoner-17.3.0 lib/milestoner/tags/pusher.rb
milestoner-17.2.0 lib/milestoner/tags/pusher.rb
milestoner-17.1.0 lib/milestoner/tags/pusher.rb
milestoner-17.0.0 lib/milestoner/tags/pusher.rb