Class: Wrapp::DMGBuilder

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

Constant Summary collapse

DEFAULT_FILESYSTEM =
'HFS+'

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
# File 'lib/wrapp/dmg_builder.rb', line 12

def create
  cmd = %w(hdiutil create)
  cmd << "-srcfolder '#{app_path}'"
  cmd << "-fs '#{filesystem}'"
  cmd << "-volname '#{volume_name}'"
  cmd << "'#{dmg_filename}'"
  system(cmd.join(' '))
end

#filesystemObject



21
22
23
# File 'lib/wrapp/dmg_builder.rb', line 21

def filesystem
  @opts.fetch(:filesystem) { DEFAULT_FILESYSTEM }
end

#volume_nameObject



25
26
27
# File 'lib/wrapp/dmg_builder.rb', line 25

def volume_name
  @opts.fetch(:volume_name) { app.name }
end