class FPM::Fry::Command

Attributes

client[W]
ui[R]

Public Class Methods

new(invocation_path, ctx = {}, parent_attribute_values = {}) click to toggle source
Calls superclass method
# File lib/fpm/fry/command.rb, line 26
def initialize(invocation_path, ctx = {}, parent_attribute_values = {})
  super
  @ui = ctx.fetch(:ui){ UI.new(tmpdir: dir) }
  @client = ctx[:client]
end

Public Instance Methods

client() click to toggle source
# File lib/fpm/fry/command.rb, line 39
def client
  @client ||= begin
    client = FPM::Fry::Client.new(
      logger: logger,
      tls: tls?, tlsverify: tlsverify?
    )
    logger.debug("Docker connected",client.server_version)
    client
  end
end
execute() click to toggle source
# File lib/fpm/fry/command.rb, line 60
def execute
  require 'fpm/fry/inspector'
  require 'fpm/fry/detector'

  Inspector.for_image(client, image) do | inspector |
    begin
      data = Detector.detect(inspector)
      logger.info("Detected the following parameters",data)
      return 0
    rescue => e
      logger.error(e)
      return 1
    end
  end
end
parse(attrs) click to toggle source
Calls superclass method
# File lib/fpm/fry/command.rb, line 32
def parse(attrs)
  super
  if debug?
    ui.logger.level = :debug
  end
end