Class: Babushka::DmgResource
Constant Summary
Constant Summary
Constants inherited from Resource
Resource::CLASSES, Resource::TYPES
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary (collapse)
Methods inherited from Resource
#archive_prefix, #content_subdir, detect_type_by_contents, detect_type_by_extension, download, extract, #filename, for, get, #identity_dirs, #initialize, #process_extract, #supported?, type, #type
Methods included from PathHelpers
#cd, #in_build_dir, #in_dir, #in_download_dir
Methods included from ShellHelpers
#cmd_dir, #failable_shell, #log_shell, #login_shell, #raw_shell, #shell, #shell!, #shell?, #sudo, #which
Methods included from LogHelpers
#debug, #log, #log_block, #log_error, #log_ok, #log_verbose, #log_warn
Constructor Details
This class inherits a constructor from Babushka::Resource
Instance Method Details
- (Object) extract(&block)
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/babushka/resource.rb', line 173 def extract &block in_download_dir { output = log_shell "Attaching #{filename}", "hdiutil attach '#{filename.p.basename}'" if output.nil? 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 { log_shell "Detaching #{filename}", "hdiutil detach '#{path}'" } end } end |
- (Object) mountpoint_for(output)
190 191 192 |
# File 'lib/babushka/resource.rb', line 190 def mountpoint_for output output.scan(/\s+(\/Volumes\/[^\n]+)/).flatten.first end |