mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 06:16:47 -06:00
* part of DSL 1.0 review * `destination_path` was always a bit vague (it refers to Cask-specific, version-specific location under `/opt/homebrew-cask/Caskroom`) * here renamed `staged_path` to match upcoming command verb `brew cask stage` * rename also intended to reduce confusion when we implement copying as a configurable alternative to symlinking * transitional `destination_path` methods to remain while Casks are converted (this was documented as a part of the DSL, and used by 39 Casks in main repo) * unrelated variables containing "stage" recast for clarity
19 lines
620 B
Ruby
19 lines
620 B
Ruby
require 'tmpdir'
|
|
|
|
class Cask::Container::GenericUnar < Cask::Container::Base
|
|
def self.me?(criteria)
|
|
! criteria.lsar.nil? and
|
|
criteria.lsar.include? 'passed, 0 failed'
|
|
end
|
|
|
|
def extract
|
|
unar = HOMEBREW_PREFIX.join('bin/unar')
|
|
if ! Pathname.new(unar).exist?
|
|
raise CaskError.new "Expected to find unar executable. Cask #{@cask} must add: depends_on :formula => 'unar'"
|
|
end
|
|
Dir.mktmpdir do |unpack_dir|
|
|
@command.run!(unar, :args => ['-q', '-D', '-o', unpack_dir, '--', @path])
|
|
@command.run!('/usr/bin/ditto', :args => ['--', unpack_dir, @cask.staged_path])
|
|
end
|
|
end
|
|
end
|