Class: Gemsmith::CLI::Actions::Install

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

Overview

Handles the install action.

Instance Method Summary collapse

Constructor Details

#initialize(installer: Tools::Installer.new, loader: Spek::Loader) ⇒ Install

Returns a new instance of Install.



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

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

Instance Method Details

#call(name = default) ⇒ Object



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

def call name = default
  case installer.call loader.call("#{name}.gemspec")
    in Success(spec) then logger.info { "Installed: #{spec.package_name}." }
    in Failure(message) then log_error { message }
    else log_error { "Unable to handle install action." }
  end
end