homebrew-cask-versions/lib/cask/container/tar.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

15 lines
362 B
Ruby

require 'tmpdir'
class Cask::Container::Tar < Cask::Container::Base
def self.me?(criteria)
criteria.file.include? 'application/x-tar'
end
def extract
Dir.mktmpdir do |staging_dir|
@command.run!('tar', :args => ['xf', @path, '-C', staging_dir])
@command.run!('ditto', :args => [staging_dir, @cask.destination_path])
end
end
end