aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/container/tar.rb
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-24 13:52:43 +0200
committerMarkus Reiter2016-09-24 16:00:58 +0200
commitb86c8efb79b3ed835d552c4d7416640ef10caf21 (patch)
tree7e1edc8a8f339e4d2781f43576d40c9c79aebcdc /Library/Homebrew/cask/lib/hbc/container/tar.rb
parent687f0fcf721c8e36f32570ed72d0988a6eaf986f (diff)
downloadbrew-b86c8efb79b3ed835d552c4d7416640ef10caf21.tar.bz2
Cask: Use nested classes and modules.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/container/tar.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/container/tar.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/container/tar.rb b/Library/Homebrew/cask/lib/hbc/container/tar.rb
index 8bc7c5f64..df77e454d 100644
--- a/Library/Homebrew/cask/lib/hbc/container/tar.rb
+++ b/Library/Homebrew/cask/lib/hbc/container/tar.rb
@@ -2,17 +2,21 @@ require "tmpdir"
require "hbc/container/base"
-class Hbc::Container::Tar < Hbc::Container::Base
- def self.me?(criteria)
- criteria.magic_number(%r{^.{257}ustar}n) ||
- # or compressed tar (bzip2/gzip/lzma/xz)
- IO.popen(["/usr/bin/tar", "-t", "-f", criteria.path.to_s], err: "/dev/null") { |io| !io.read(1).nil? }
- end
+module Hbc
+ class Container
+ class Tar < Base
+ def self.me?(criteria)
+ criteria.magic_number(%r{^.{257}ustar}n) ||
+ # or compressed tar (bzip2/gzip/lzma/xz)
+ IO.popen(["/usr/bin/tar", "-t", "-f", criteria.path.to_s], err: "/dev/null") { |io| !io.read(1).nil? }
+ end
- def extract
- Dir.mktmpdir do |unpack_dir|
- @command.run!("/usr/bin/tar", args: ["-x", "-f", @path, "-C", unpack_dir])
- @command.run!("/usr/bin/ditto", args: ["--", unpack_dir, @cask.staged_path])
+ def extract
+ Dir.mktmpdir do |unpack_dir|
+ @command.run!("/usr/bin/tar", args: ["-x", "-f", @path, "-C", unpack_dir])
+ @command.run!("/usr/bin/ditto", args: ["--", unpack_dir, @cask.staged_path])
+ end
+ end
end
end
end