Class: Gemsmith::CLI::Actions::Publish

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

Overview

Handles the publish action.

Instance Method Summary collapse

Constructor Details

#initialize(publisher: Tools::Publisher.new, loader: Spek::Loader) ⇒ Publish

Returns a new instance of Publish.



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

def initialize(publisher: Tools::Publisher.new, loader: Spek::Loader, **)
  super(**)
  @publisher = publisher
  @loader = loader
end

Instance Method Details

#call(name = default) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/gemsmith/cli/actions/publish.rb', line 30

def call name = default
  case publisher.call loader.call("#{name}.gemspec")
    in Success(spec) then logger.info { "Published: #{spec.package_name}." }
    in Failure(message) then log_error message
    else log_error "Publish failed, unable to parse result."
  end
end