Class: Gemsmith::Tools::Packager

Inherits:
Object
  • Object
show all
Defined in:
lib/gemsmith/tools/packager.rb

Overview

Builds a gem package for distribution.

Instance Method Summary collapse

Constructor Details

#initialize(command: Gem::CommandManager.new) ⇒ Packager

Returns a new instance of Packager.



15
16
17
# File 'lib/gemsmith/tools/packager.rb', line 15

def initialize command: Gem::CommandManager.new
  @command = command
end

Instance Method Details

#call(specification) ⇒ Object

:reek:TooManyStatements



20
21
22
23
24
25
26
# File 'lib/gemsmith/tools/packager.rb', line 20

def call specification
  command.run ["build", "#{specification.name}.gemspec"]
  specification.package_path.then { |path| path.make_ancestors.basename.copy path.parent }
  Success specification
rescue Gem::Exception => error
  Failure error.message
end