Class: Milestoner::Pusher

Inherits:
Object
  • Object
show all
Defined in:
lib/milestoner/pusher.rb

Overview

Handles publishing of Git tags to remote repository.

Instance Method Summary collapse

Constructor Details

#initialize(git: Git::Kit.new) ⇒ Pusher

Returns a new instance of Pusher.



6
7
8
# File 'lib/milestoner/pusher.rb', line 6

def initialize git: Git::Kit.new
  @git = git
end

Instance Method Details

#push(version) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/milestoner/pusher.rb', line 10

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