Sha256: bc843ec7a11e82fe700555c363d34d241dcd3b11665244a3983bb00c7e57d079

Contents?: true

Size: 654 Bytes

Versions: 4

Compression:

Stored size: 654 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

4 entries across 4 versions & 1 rubygems

Version Path
milestoner-8.3.0 lib/milestoner/pusher.rb
milestoner-8.2.0 lib/milestoner/pusher.rb
milestoner-8.1.0 lib/milestoner/pusher.rb
milestoner-8.0.0 lib/milestoner/pusher.rb