Class: Fastlane::Helper::AppInfoHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::AppInfoHelper
- Defined in:
- lib/fastlane/plugin/app_info/helper/app_info_helper.rb
Constant Summary collapse
- COMMON_COLUMNS =
%w[os name release_version build_version identifier size device_type]
Class Method Summary collapse
- .column_name(key, value) ⇒ Object
- .common_columns(app) ⇒ Object
- .hash_to_columns(raw) ⇒ Object
- .object_to_column(object) ⇒ Object
- .platform_columns(app) ⇒ Object
- .raw_data(app) ⇒ Object
- .store_sharedvalue(key, value) ⇒ Object
- .upcase(key) ⇒ Object
Class Method Details
.column_name(key, value) ⇒ Object
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 65 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_columns(app) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 47 def self.common_columns(app) COMMON_COLUMNS.each_with_object({}) do |key, hash| value = key == 'size' ? app.size(human_size: true) : app.send(key.to_sym) hash[upcase(key)] = value end end |
.hash_to_columns(raw) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 8 def self.hash_to_columns(raw) raw.each_with_object({}) do |(key, value), obj| next if value.respond_to?(:empty?) && value.empty? name = upcase(column_name(key, value)) obj[name] = object_to_column(value) end end |
.object_to_column(object) ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 54 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 |
.platform_columns(app) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 21 def self.platform_columns(app) obj = {} if app.os == 'iOS' obj[upcase('release_type')] = app.release_type obj[upcase('archs')] = app.archs return {} unless app.mobileprovision && !app.mobileprovision.empty? app.mobileprovision.mobileprovision.each do |key, value| next if key == 'DeveloperCertificates' || key == 'Name' || key == 'DER-Encoded-Profile' obj[upcase(key)] = value end elsif app.os == 'Android' obj = { "MinSDKVersion" => app.min_sdk_version, "TargetSDKVersion" => app.target_sdk_version, "DeepLinks" => app.deep_links, "Schemes" => app.schemes, "UsePermissions" => app., "UseFeatures" => app.use_features, } end obj end |
.raw_data(app) ⇒ Object
17 18 19 |
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 17 def self.raw_data(app) common_columns(app).merge(platform_columns(app)) end |
.store_sharedvalue(key, value) ⇒ Object
87 88 89 90 91 92 |
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 87 def self.store_sharedvalue(key, value) Actions.lane_context[key] = value ENV[key.to_s] = value value end |
.upcase(key) ⇒ Object
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fastlane/plugin/app_info/helper/app_info_helper.rb', line 76 def self.upcase(key) return key.upcase if key == 'os' str = key.dup ['-', '_', '\s'].each do |s| str = str.gsub(/(?:#{s}+)([a-z])/) { $1.upcase } end return str.gsub(/(\A|\s)([a-z])/) { $1 + $2.upcase } end |