Class: Hbc::Container::Cab

Inherits:
Base
  • Object
show all
Defined in:
Library/Homebrew/cask/lib/hbc/container/cab.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#extract_nested_container, #extract_nested_inside, #initialize, #verbose?

Constructor Details

This class inherits a constructor from Hbc::Container::Base

Class Method Details

.me?(criteria) ⇒ Boolean



8
9
10
# File 'Library/Homebrew/cask/lib/hbc/container/cab.rb', line 8

def self.me?(criteria)
  criteria.magic_number(/^(MSCF|MZ)/n)
end

Instance Method Details

#extractObject



12
13
14
15
16
17
18
19
20
21
# File 'Library/Homebrew/cask/lib/hbc/container/cab.rb', line 12

def extract
  unless cabextract = which("cabextract", PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"))
    raise CaskError, "Expected to find cabextract executable. Cask '#{@cask}' must add: depends_on formula: 'cabextract'"
  end

  Dir.mktmpdir do |unpack_dir|
    @command.run!(cabextract, args: ["-d", unpack_dir, "--", @path])
    @command.run!("/usr/bin/ditto", args: ["--", unpack_dir, @cask.staged_path])
  end
end