Class: Milestoner::CLI::Actions::Publish

Inherits:
Sod::Action
  • Object
show all
Defined in:
lib/milestoner/cli/actions/publish.rb

Overview

Handles tag creation and pushing of tag to local repository.

Instance Method Summary collapse

Constructor Details

#initialize(publisher: Tags::Publisher.new) ⇒ Publish

Returns a new instance of Publish.



25
26
27
28
# File 'lib/milestoner/cli/actions/publish.rb', line 25

def initialize(publisher: Tags::Publisher.new, **)
  super(**)
  @publisher = publisher
end

Instance Method Details

#call(version = default) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/milestoner/cli/actions/publish.rb', line 30

def call version = default
  settings.build_max = 1

  case publisher.call Version(version)
    in Success(version) then version
    in Failure(message) then log_error message
    else log_error "Publish failed, unable to parse result."
  end
rescue Versionaire::Error => error
  log_error error.message
end