Class: Fastlane::Actions::IosGetStoreAppSizesAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb

Constant Summary collapse

Helper =
Fastlane::Helper::Ios::ADCAppSizesHelper

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



111
112
113
114
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 111

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ['Automattic']
end

.available_optionsObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 45

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :adc_user,
      env_name: 'FL_IOS_STOREAPPSIZES_USER',
      description: 'The ADC user to use to log into ADC',
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :adc_team,
      env_name: 'FL_IOS_STOREAPPSIZES_TEAM',
      description: 'The ADC team name to use to log into ADC',
      type: String,
      optional: true,
      default_value: 'Automattic, Inc.'
    ),
    FastlaneCore::ConfigItem.new(
      key: :bundle_id,
      env_name: 'FL_IOS_STOREAPPSIZES_BUNDLEID',
      description: 'The bundleID of the app to retrieve sizes from',
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :version,
      env_name: 'FL_IOS_STOREAPPSIZES_VERSION',
      description: 'The version to retrive the data for. Keep nil to retrieve data for all the last {limit} versions',
      type: String,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :limit,
      env_name: 'FL_IOS_STOREAPPSIZES_LIMIT',
      description: 'The maximum number of past versions to retrieve information from',
      type: Integer,
      optional: true,
      default_value: 10
    ),
    FastlaneCore::ConfigItem.new(
      key: :devices,
      env_name: 'FL_IOS_STOREAPPSIZES_DEVICES',
      description: 'The list of devices to print the app size for. If nil, will print data for all device types returned by ADC',
      type: Array,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :format,
      env_name: 'FL_IOS_STOREAPPSIZES_FORMAT',
      description: "The output format used to print the result. Can be one of 'csv' or 'markdown', or nil to print nothing (raw data will always be available as the the action's return value)",
      type: String,
      optional: true
    ),
  ]
end

.descriptionObject



37
38
39
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 37

def self.description
  'Gets the size of the app as reported in Apple Developer Portal for recent versions'
end

.detailsObject



41
42
43
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 41

def self.details
  'Gets the download + installed size of the app from the Apple Developer Portail for various app versions release to AppStore and various device types'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


116
117
118
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 116

def self.is_supported?(platform)
  %i[ios mac].include?(platform)
end

.outputObject



99
100
101
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 99

def self.output
  # Define the shared values you are going to provide
end

.return_typeObject



103
104
105
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 103

def self.return_type
  :hash
end

.return_valueObject



107
108
109
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 107

def self.return_value
  'Return a Hash containing the details of download and install app size, for various device models, all that for each requested version of the app'
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb', line 8

def self.run(params)
  app_sizes = Helper.get_adc_sizes(
    adc_user: params[:adc_user],
    adc_team: params[:adc_team],
    bundle_id: params[:bundle_id],
    only_version: params[:version],
    limit: params[:limit]
  )

  devices = params[:devices]

  case params[:format]
  when 'csv'
    csv = Helper.format_csv(app_sizes, devices: devices)
    UI.message "Result (CSV)\n\n#{csv}\n"
  when 'markdown'
    tables = Helper.format_markdown(app_sizes, devices: devices)
    tables.each do |table|
      UI.message "Result (Markdown)\n\n#{table}\n"
    end
  end

  app_sizes
end