Class: Fastlane::Helper::UpdateDmgHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/create_dmg/helper/update_dmg_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params: nil) ⇒ UpdateDmgHelper

Returns a new instance of UpdateDmgHelper.



8
9
10
11
12
13
14
15
# File 'lib/fastlane/plugin/create_dmg/helper/update_dmg_helper.rb', line 8

def initialize(params: nil)
  self.params = params
  self.verbose = self.params[:verbose] == true
  self.source = File.expand_path(self.params[:source])
  source_basename_no_extension = File.basename(self.source, File.extname(source))
  output_filename = self.params[:output_filename] || "#{File.dirname(self.source)}/#{source_basename_no_extension}.dmg"
  self.output_filename = File.expand_path(output_filename)
end

Instance Attribute Details

#output_filenameObject

Returns the value of attribute output_filename.



6
7
8
# File 'lib/fastlane/plugin/create_dmg/helper/update_dmg_helper.rb', line 6

def output_filename
  @output_filename
end

#sourceObject

Returns the value of attribute source.



6
7
8
# File 'lib/fastlane/plugin/create_dmg/helper/update_dmg_helper.rb', line 6

def source
  @source
end

#verboseObject

Returns the value of attribute verbose.



6
7
8
# File 'lib/fastlane/plugin/create_dmg/helper/update_dmg_helper.rb', line 6

def verbose
  @verbose
end

Instance Method Details

#update_dmg_parametersObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fastlane/plugin/create_dmg/helper/update_dmg_helper.rb', line 17

def update_dmg_parameters
  parameters = {
    '--source'       => self.source,
    '--output-dmg'   => self.output_filename,
    '--template-dmg' => self.params[:template]
  }

  update_dmg_parameters = []
  parameters.each do |key, value|
    if value
      update_dmg_parameters << key.to_s
      update_dmg_parameters << value.to_s
    end
  end

  update_dmg_parameters << '--hdiutil-verbose' if self.params[:hdiutil_verbose]
  update_dmg_parameters << '--hdiutil-quiet'   if self.params[:hdiutil_quiet]

  return update_dmg_parameters
end