Class: Babushka::DmgAsset
Constant Summary
Constants inherited from Asset
Instance Attribute Summary
Attributes inherited from Asset
Instance Method Summary collapse
Methods inherited from Asset
#build_prefix, #content_subdir, detect_type_by_contents, detect_type_by_extension, #filename, for, #identity_dirs, #initialize, #process_extract, #supported?, type, #type
Methods included from ShellHelpers
cmd_dir, current_username, log_shell, login_shell, raw_shell, shell, shell!, shell?, shell_cmd, sudo, which
Methods included from LogHelpers
debug, deprecated!, log, log_block, log_error, log_ok, log_stderr, log_warn, removed!
Methods included from PathHelpers
cd, in_build_dir, in_download_dir
Constructor Details
This class inherits a constructor from Babushka::Asset
Instance Method Details
#extract(&block) ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/babushka/asset.rb', line 139 def extract &block in_download_dir { output = ShellHelpers.log_shell "Attaching #{filename}", "hdiutil attach '#{filename.p.basename}'" if output.nil? LogHelpers.log_error "Couldn't mount #{filename.p}." elsif (path = mountpoint_for(output)).nil? raise "Couldn't find where `hdiutil` mounted #{filename.p}." else cd(path) { block.call(self) }.tap { ShellHelpers.log_shell "Detaching #{filename}", "hdiutil detach '#{path}'" } end } end |
#mountpoint_for(output) ⇒ Object
156 157 158 |
# File 'lib/babushka/asset.rb', line 156 def mountpoint_for output output.scan(/\s+(\/Volumes\/[^\n]+)/).flatten.first end |