2016-08-18 22:11:42 +03:00
|
|
|
require "hbc/container/base"
|
|
|
|
|
2016-09-24 13:52:43 +02:00
|
|
|
module Hbc
|
|
|
|
class Container
|
|
|
|
class Xz < Base
|
|
|
|
def self.me?(criteria)
|
2018-07-14 03:25:42 +02:00
|
|
|
criteria.magic_number(/\A\xFD7zXZ\x00/n)
|
2016-09-24 13:52:43 +02:00
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2016-09-24 13:52:43 +02:00
|
|
|
def extract
|
2018-07-14 03:25:42 +02:00
|
|
|
unpack_dir = @cask.staged_path
|
|
|
|
basename = path.basename
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-07-14 03:25:42 +02:00
|
|
|
@command.run!("/usr/bin/ditto", args: ["--", path, unpack_dir])
|
|
|
|
@command.run!("xz",
|
|
|
|
args: ["-q", "--", unpack_dir/basename],
|
|
|
|
env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) })
|
|
|
|
end
|
|
|
|
|
|
|
|
def dependencies
|
|
|
|
@dependencies ||= [Formula["xz"]]
|
2016-09-24 13:52:43 +02:00
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|