diff options
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/container/lzma.rb')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/container/lzma.rb | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/container/lzma.rb b/Library/Homebrew/cask/lib/hbc/container/lzma.rb index e538b3779..a91132b55 100644 --- a/Library/Homebrew/cask/lib/hbc/container/lzma.rb +++ b/Library/Homebrew/cask/lib/hbc/container/lzma.rb @@ -2,22 +2,26 @@ require "tmpdir" require "hbc/container/base" -class Hbc::Container::Lzma < Hbc::Container::Base - def self.me?(criteria) - criteria.magic_number(%r{^\]\000\000\200\000}n) - end +module Hbc + class Container + class Lzma < Base + def self.me?(criteria) + criteria.magic_number(%r{^\]\000\000\200\000}n) + end - def extract - unlzma = Hbc.homebrew_prefix.join("bin", "unlzma") + def extract + unlzma = Hbc.homebrew_prefix.join("bin", "unlzma") - unless unlzma.exist? - raise Hbc::CaskError, "Expected to find unlzma executable. Cask '#{@cask}' must add: depends_on formula: 'lzma'" - end + unless unlzma.exist? + raise CaskError, "Expected to find unlzma executable. Cask '#{@cask}' must add: depends_on formula: 'lzma'" + end - Dir.mktmpdir do |unpack_dir| - @command.run!("/usr/bin/ditto", args: ["--", @path, unpack_dir]) - @command.run!(unlzma, args: ["-q", "--", Pathname(unpack_dir).join(@path.basename)]) - @command.run!("/usr/bin/ditto", args: ["--", unpack_dir, @cask.staged_path]) + Dir.mktmpdir do |unpack_dir| + @command.run!("/usr/bin/ditto", args: ["--", @path, unpack_dir]) + @command.run!(unlzma, args: ["-q", "--", Pathname(unpack_dir).join(@path.basename)]) + @command.run!("/usr/bin/ditto", args: ["--", unpack_dir, @cask.staged_path]) + end + end end end end |
