Sha256: 4f978c5c04b07b523dcf988080bd188a26f99406072b6eae55aff13c809c5504

Contents?: true

Size: 666 Bytes

Versions: 8

Compression:

Stored size: 666 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.label}.") 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.label
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
milestoner-7.0.1 lib/milestoner/pusher.rb
milestoner-7.0.0 lib/milestoner/pusher.rb
milestoner-6.3.1 lib/milestoner/pusher.rb
milestoner-6.3.0 lib/milestoner/pusher.rb
milestoner-6.2.0 lib/milestoner/pusher.rb
milestoner-6.1.0 lib/milestoner/pusher.rb
milestoner-6.0.0 lib/milestoner/pusher.rb
milestoner-5.1.0 lib/milestoner/pusher.rb