Class: HDIUtil::DMG

Inherits:
Object
  • Object
show all
Defined in:
lib/iesd/utility/hdiutil.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ DMG

Returns a new instance of DMG.



84
85
86
# File 'lib/iesd/utility/hdiutil.rb', line 84

def initialize url
  @url = File.absolute_path url
end

Instance Attribute Details

#urlObject

Returns the value of attribute url.



82
83
84
# File 'lib/iesd/utility/hdiutil.rb', line 82

def url
  @url
end

Instance Method Details

#editObject



92
93
94
# File 'lib/iesd/utility/hdiutil.rb', line 92

def edit
  update
end

#show(&block) ⇒ Object



88
89
90
# File 'lib/iesd/utility/hdiutil.rb', line 88

def show &block
  HDIUtil.read(@url, &block)
end

#update(&block) ⇒ Object



96
97
98
99
100
101
102
103
# File 'lib/iesd/utility/hdiutil.rb', line 96

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

#valid?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/iesd/utility/hdiutil.rb', line 105

def valid?
  HDIUtil.validate @url
end