Module: ImageOptim::Pack

Defined in:
lib/image_optim/pack.rb

Overview

Handle selection of directory with binaries most suitable for current operating system and architecture

Defined Under Namespace

Classes: Path

Constant Summary collapse

OS =

downcased ‘uname -s`

begin
  `uname -s`.strip.downcase
rescue Errno::ENOENT
  'unknown'
end
ARCH =

downcased ‘uname -m`

begin
  `uname -m`.strip.downcase
rescue Errno::ENOENT
  'unknown'
end
VENDOR_PATH =

Path to vendor at root of image_optim_pack

FSPath('../../../vendor').expand_path(__FILE__)
PATHS =

List of paths

VENDOR_PATH.glob('*-*').map{ |path| Path.new(path) }

Class Method Summary collapse

Class Method Details

.pathObject

Return path to directory with binaries Yields debug messages if block given



90
91
92
93
94
95
# File 'lib/image_optim/pack.rb', line 90

def path
  ordered_by_os_arch_match.find do |path|
    yield "image_optim_pack: #{debug_message(path)}" if block_given?
    path.all_bins_working?
  end
end