Class: HDIUtil::DMG
- Inherits:
-
Object
- Object
- HDIUtil::DMG
- Defined in:
- lib/iesd/utility/hdiutil.rb
Overview
:nodoc:
Direct Known Subclasses
IESD::DMG::BaseSystem, IESD::DMG::InstallESD, IESD::DMG::InstallOSX
Instance Attribute Summary collapse
-
#url ⇒ Object
The String path to the DMG.
Instance Method Summary collapse
-
#edit ⇒ Object
Open a read-write shell in the DMG.
-
#initialize(url) ⇒ DMG
constructor
Initialize a new DMG.
-
#show(&block) ⇒ Object
Perform read-only actions on the DMG.
-
#update(&block) ⇒ Object
Perform read-write actions on the DMG.
-
#valid? ⇒ Boolean
Returns true if the DMG is a valid image, false otherwise.
Constructor Details
#initialize(url) ⇒ DMG
Initialize a new DMG.
url - The String path to the DMG.
123 124 125 |
# File 'lib/iesd/utility/hdiutil.rb', line 123 def initialize url @url = File.absolute_path url end |
Instance Attribute Details
#url ⇒ Object
The String path to the DMG.
118 119 120 |
# File 'lib/iesd/utility/hdiutil.rb', line 118 def url @url end |
Instance Method Details
#edit ⇒ Object
Open a read-write shell in the DMG.
133 134 135 |
# File 'lib/iesd/utility/hdiutil.rb', line 133 def edit update end |
#show(&block) ⇒ Object
Perform read-only actions on the DMG.
128 129 130 |
# File 'lib/iesd/utility/hdiutil.rb', line 128 def show &block HDIUtil.read(@url, &block) end |
#update(&block) ⇒ Object
Perform read-write actions on the DMG.
138 139 140 141 142 143 144 145 |
# File 'lib/iesd/utility/hdiutil.rb', line 138 def update &block Dir.mktmpdir { |tmp| flags = `/usr/bin/env ls -lO #{@url.shellescape}`.split[4] HDIUtil.write(@url, (tmpfile = File.join(tmp, File.basename(@url))), &block) system("/usr/bin/env", "mv", tmpfile, @url) system("/usr/bin/env", "chflags", flags, @url) unless flags == "-" } end |