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

module Hbc
  class Container
    class Naked < Base
      # Either inherit from this class and override with self.me?(criteria),
      # or use this class directly as "container type: :naked",
      # in which case self.me? is not called.
      def self.me?(*)
        false
      end

      def extract
        @command.run!("/usr/bin/ditto", args: ["--", @path, @cask.staged_path.join(target_file)])
      end

      def target_file
        return @path.basename if @nested
        URI.decode(File.basename(@cask.url.path))
      end
    end
  end
end