Module: Omnibus::Compressor

Includes:
Logging
Defined in:
lib/omnibus/compressor.rb

Defined Under Namespace

Classes: Base, DMG, Null, TGZ

Class Method Summary collapse

Methods included from Logging

included

Class Method Details

.for_current_system(compressors) ⇒ ~Compressor::Base

Determine the best compressor for the current system. This method returns the class, not an instance of the class.

Examples:

Compressor.for_current_system([:dmg, :tgz]) #=> Packager::DMG

Parameters:

  • compressors (Array<Symbol>)

    the list of configured compressors

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/omnibus/compressor.rb', line 38

def for_current_system(compressors)
  family = Ohai["platform_family"]

  if family == "mac_os_x"
    if compressors.include?(:dmg)
      return DMG
    end

    if compressors.include?(:tgz)
      return TGZ
    end
  end

  if compressors.include?(:tgz)
    TGZ
  else
    log.info(log_key) { "No compressor defined for `#{family}'." }
    Null
  end
end