Sha256: 4e3810f581b534aeca6faa7deb36e9b4d51846f8efe2daace7667cd25eb9d103

Contents?: true

Size: 651 Bytes

Versions: 13

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  # Handles publishing of Git tags to remote repository.
  class Pusher
    def initialize git: Git::Kit.new
      @git = git
    end

    def push version
      version = Versionaire::Version version

      fail Errors::Git, "Remote repository not configured." unless git.remote?
      fail Errors::Git, "Remote tag exists: #{version}." if tag_exists? version
      return if git.push_tags.empty?

      fail Errors::Git, "Tags could not be pushed to remote repository."
    end

    private

    attr_reader :git, :version

    def tag_exists? version
      git.tag_remote? version
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
milestoner-10.4.0 lib/milestoner/pusher.rb
milestoner-10.3.0 lib/milestoner/pusher.rb
milestoner-10.2.0 lib/milestoner/pusher.rb
milestoner-10.1.0 lib/milestoner/pusher.rb
milestoner-10.0.2 lib/milestoner/pusher.rb
milestoner-10.0.1 lib/milestoner/pusher.rb
milestoner-10.0.0 lib/milestoner/pusher.rb
milestoner-9.3.3 lib/milestoner/pusher.rb
milestoner-9.3.2 lib/milestoner/pusher.rb
milestoner-9.3.1 lib/milestoner/pusher.rb
milestoner-9.3.0 lib/milestoner/pusher.rb
milestoner-9.2.1 lib/milestoner/pusher.rb
milestoner-9.2.0 lib/milestoner/pusher.rb