Class: IESD::DMG

Inherits:
Object
  • Object
show all
Defined in:
lib/iesd/InstallESD.rb,
lib/iesd/InstallESD/BaseSystem.dmg.rb,
lib/iesd/InstallESD/InstallESD.dmg.rb,
lib/iesd/InstallESD/InstallOSX.dmg.rb

Overview

OS X Installer DMG

Defined Under Namespace

Classes: BaseSystem, InstallESD, InstallOSX

Class Method Summary collapse

Class Method Details

.new(url) ⇒ Object

Initialize a new installer DMG.

Returns an installer DMG if the type of the installer is detected, otherwise nil.


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/iesd/InstallESD.rb', line 28

def self.new url
  i = nil
  if HDIUtil::validate url
    HDIUtil::DMG.new(url).show { |mountpoint|
      oh1 "Detecting #{url}"
      case
      when (File.exist? File.join(mountpoint, *%w[ .IABootFiles ]))
        i = IESD::DMG::InstallOSX.new url
      when (File.exist? File.join(mountpoint, *%w[ BaseSystem.dmg ]))
        i = IESD::DMG::InstallESD.new url
      when (File.exist? File.join(mountpoint, *%w[ System Installation ]))
        i = IESD::DMG::BaseSystem.new url
      else
        raise "unknown type"
      end
      puts "Detected: #{i.class.name.split("::").last}"
    }
  end
  i
end