Class: Wrapp::DMGBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/wrapp/dmg_builder.rb

Constant Summary collapse

BIG_SOURCE_FOLDER_SIZE =
100

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_path, opts = {}) ⇒ DMGBuilder

Returns a new instance of DMGBuilder.



7
8
9
10
# File 'lib/wrapp/dmg_builder.rb', line 7

def initialize(app_path, opts = {})
  @app_path = app_path
  @opts = opts
end

Instance Attribute Details

#app_pathObject (readonly)

Returns the value of attribute app_path.



5
6
7
# File 'lib/wrapp/dmg_builder.rb', line 5

def app_path
  @app_path
end

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/wrapp/dmg_builder.rb', line 12

def create
  cmd = %w(hdiutil create)
  cmd << "-srcfolder '#{source_path}'"
  # NOTE: There is a known bug in hdiutil that causes the image creation
  # to fail, see: https://discussions.apple.com/thread/5667409
  # Therefore we have to explicitely set the dmg size for bigger sources.
  cmd << "-megabytes #{dmg_size}" if big_source_folder?
  cmd << "'#{dmg_filename}'"
  system(cmd.join(' '))
end