homebrew-cask-versions/lib/cask/container/zip.rb
phinze c85ef168fc require most commands to succeed; cleanup on install failure
- add `run!` method which raises if command does not succeed
- use `run!` when the command we are running must succeed for things to
  move forward. this should help produce clearer error messages in
  failure scenarios.
- move caveats earlier in the install process so reports can be made
  about potential failures
- remove the destination tree on cask install failure, so the cask will
  not be considered installed
2013-10-20 16:52:51 -05:00

14 lines
403 B
Ruby

require 'tmpdir'
class Cask::Container::Zip < Cask::Container::Base
def self.me?(criteria)
criteria.file.include? 'compressed-encoding=application/zip;'
end
def extract
Dir.mktmpdir do |staging_dir|
@command.run!('unzip', :args => ['-qq', '-d', staging_dir, @path, '-x', '__MACOSX/*'])
@command.run!('ditto', :args => [staging_dir, @cask.destination_path])
end
end
end