class Chef::Resource::DmgPackage

Public Instance Methods

dmg_attached?() click to toggle source

@return [Boolean] is the dmg file currently attached?

# File lib/chef/resource/dmg_package.rb, line 192
def dmg_attached?
  # example hdiutil imageinfo output: http://rubular.com/r/CDcqenkixg
  /image-path.*#{dmg_file}/.match?(shell_out!("/usr/bin/hdiutil info #{passphrase_cmd}").stdout)
end
dmg_file() click to toggle source

@return [String] the path to the dmg file

# File lib/chef/resource/dmg_package.rb, line 172
def dmg_file
  @dmg_file ||= if new_resource.file.nil?
                  "#{Chef::Config[:file_cache_path]}/#{new_resource.dmg_name}.dmg"
                else
                  new_resource.file
                end
end
passphrase_cmd() click to toggle source

@return [String] the hdiutil flag for handling DMGs with a password

# File lib/chef/resource/dmg_package.rb, line 181
def passphrase_cmd
  @passphrase_cmd ||= new_resource.dmg_passphrase ? "-passphrase #{new_resource.dmg_passphrase}" : ""
end
software_license_agreement?() click to toggle source

@return [Boolean] does the DMG require a software license agreement

# File lib/chef/resource/dmg_package.rb, line 186
def software_license_agreement?
  # example hdiutil imageinfo output: http://rubular.com/r/0xvOaA6d8B
  /Software License Agreement: true/.match?(shell_out!("/usr/bin/hdiutil imageinfo #{passphrase_cmd} '#{dmg_file}'").stdout)
end