Class: Fastlane::Helper::AppInfoHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/app_info/helper/app_info_helper.rb

Class Method Summary collapse

Class Method Details

.app_to_json(app) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 32

def self.app_to_json(app)
  data = common_columns.each_with_object({}) do |key, obj|
    name = key.split('_').map(&:capitalize).join('')
    obj[name] = app.send(key.to_sym)
  end

  if app.os == 'iOS' && app.mobileprovision && !app.mobileprovision.empty?
    app.mobileprovision.mobileprovision.each do |key, value|
      next if key == 'DeveloperCertificates'
      data[key] = value
    end
  end

  JSON.dump(data)
end

.column_name(key, value) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 17

def self.column_name(key, value)
  case value
  when Array
    value.size > 1 ? "#{key} (#{value.size})" : key
  when Hash
    value.keys.size > 1 ? "#{key} (#{value.keys.size})" : key
  else
    key
  end
end

.common_columnsObject



28
29
30
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 28

def self.common_columns
  %w[name release_version build_version identifier os]
end

.object_to_column(object) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 6

def self.object_to_column(object)
  case object
  when Hash
    object.collect { |k, v| "#{k}: #{v}" }.join("\n")
  when Array
    object.join("\n")
  else
    object.to_s
  end
end

.store_sharedvalue(key, value) ⇒ Object



48
49
50
51
52
53
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 48

def self.store_sharedvalue(key, value)
  Actions.lane_context[key] = value
  ENV[key.to_s] = value

  value
end