Class: Fastlane::Actions::AppInfoAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/app_info/actions/app_info_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



37
38
39
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 37

def self.authors
  ["icyleaf <[email protected]>"]
end

.available_optionsObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 55

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :file,
                                 env_name: 'APP_INFO_FILE',
                                 description: 'Path to your ipa, apk and aab file file. Optional if you use the `gym`, `ipa` or `xcodebuild` action. ',
                                 default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] || Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] || Dir['*.ipa'].last || Dir['*.apk'].last,
                                 optional: true,
                                 verify_block: proc do |value|
                                   raise "Couldn't find app file".red unless File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :clean,
                                 env_name: 'APP_INFO_CLEAN',
                                 description: 'Clean cache files to reduce disk size',
                                 default_value: true,
                                 optional: true)
  ]
end

.descriptionObject



33
34
35
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 33

def self.description
  "Parse and dump mobile app(ipa, apk and aab file) metedata."
end

.detailsObject



41
42
43
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 41

def self.details
  "Teardown tool for mobile app(ipa, apk and aab file), analysis metedata like version, name, icon etc."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 73

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

.outputObject



49
50
51
52
53
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 49

def self.output
  [
    [SharedValues::APP_INFO.to_s, 'The JSON formated metadata of given app']
  ]
end


26
27
28
29
30
31
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 26

def self.print_table(raw)
  puts Terminal::Table.new(
    title: "Summary for app_info #{AppInfo::VERSION}".green,
    rows: Helper::AppInfoHelper.hash_to_columns(raw)
  )
end

.return_valueObject



45
46
47
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 45

def self.return_value
  "Returns a Hash formated metadata of given app"
end

.run(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 11

def self.run(params)
  file = params.fetch(:file)
  UI.user_error! 'You have to either pass an ipa, apk or aab file' unless file
  file = File.expand_path(file)
  app = ::AppInfo.parse(file)
  raw = Helper::AppInfoHelper.raw_data(app)

  UI.verbose "Raw params: #{raw}"
  print_table(raw)
  app.clear! if params.fetch(:clean)

  Helper::AppInfoHelper.store_sharedvalue(:APP_INFO, JSON.dump(raw))
  raw
end