aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/container/zip.rb
blob: 8e3cf5b2dc26de66d13e2174734bcd61e1656476 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require "hbc/container/base"

module Hbc
  class Container
    class Zip < Base
      def self.me?(criteria)
        criteria.magic_number(/^PK(\003\004|\005\006)/n)
      end

      def extract
        Dir.mktmpdir do |unpack_dir|
          @command.run!("/usr/bin/ditto", args: ["-x", "-k", "--", @path, unpack_dir])

          extract_nested_inside(unpack_dir)
        end
      end
    end
  end
end