aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/artifact/nested_container.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/artifact/nested_container.rb
parent687f0fcf721c8e36f32570ed72d0988a6eaf986f (diff)
downloadbrew-b86c8efb79b3ed835d552c4d7416640ef10caf21.tar.bz2
Cask: Use nested classes and modules.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb36
1 files changed, 20 insertions, 16 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb b/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb
index 68e4a552c..107640797 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb
@@ -1,24 +1,28 @@
require "hbc/artifact/base"
-class Hbc::Artifact::NestedContainer < Hbc::Artifact::Base
- def install_phase
- @cask.artifacts[:nested_container].each { |container| extract(container) }
- end
+module Hbc
+ module Artifact
+ class NestedContainer < Base
+ def install_phase
+ @cask.artifacts[:nested_container].each { |container| extract(container) }
+ end
- def uninstall_phase
- # no need to take action; is removed after extraction
- end
+ def uninstall_phase
+ # no need to take action; is removed after extraction
+ end
- def extract(container_relative_path)
- source = @cask.staged_path.join(container_relative_path)
- container = Hbc::Container.for_path(source, @command)
+ def extract(container_relative_path)
+ source = @cask.staged_path.join(container_relative_path)
+ container = Container.for_path(source, @command)
- unless container
- raise Hbc::CaskError, "Aw dang, could not identify nested container at '#{source}'"
- end
+ unless container
+ raise CaskError, "Aw dang, could not identify nested container at '#{source}'"
+ end
- ohai "Extracting nested container #{source.basename}"
- container.new(@cask, source, @command).extract
- FileUtils.remove_entry_secure(source)
+ ohai "Extracting nested container #{source.basename}"
+ container.new(@cask, source, @command).extract
+ FileUtils.remove_entry_secure(source)
+ end
+ end
end
end