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



59
60
61
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 59

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

.available_optionsObject



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 73

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :file,
                                 env_name: 'APP_INFO_FILE',
                                 description: 'Path to your ipa/apk 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)
  ]
end

.common_columnsObject



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

def self.common_columns
  Helper::AppInfoHelper.common_columns.each_with_object({}) do |key, hash|
    name = key.split('_').map(&:capitalize).join('')
    hash[name] = Helper::AppInfoHelper.object_to_column(@app.send(key.to_sym))
  end
end

.descriptionObject



55
56
57
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 55

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

.detailsObject



63
64
65
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 63

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

.ios_columnsObject



44
45
46
47
48
49
50
51
52
53
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 44

def self.ios_columns
  return {} unless @app.os == 'iOS' && @app.mobileprovision && !@app.mobileprovision.empty?

  @app.mobileprovision.mobileprovision.each_with_object({}) do |(key, value), hash|
    next if key == 'DeveloperCertificates'

    name = Helper::AppInfoHelper.column_name(key, value)
    hash[name] = Helper::AppInfoHelper.object_to_column(value)
  end
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 86

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

.outputObject



67
68
69
70
71
# File 'lib/fastlane/plugin/app_info/actions/app_info_action.rb', line 67

def self.output
  [
    [SharedValues::APP_INFO.to_s, 'the json formated app info data']
  ]
end


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

def self.print_table!
  params = {}
  params[:rows] = table_columns
  params[:title] = "Summary for app_info #{AppInfo::VERSION}".green

  puts ""
  puts Terminal::Table.new(params)
  puts ""
end

.run(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# 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 or an apk file' unless @file
  @file = File.expand_path(@file)
  @app = ::AppInfo.parse(@file)

  print_table!

  # Store shared value
  Helper::AppInfoHelper.store_sharedvalue(:APP_INFO, Helper::AppInfoHelper.app_to_json(@app))
end

.table_columnsObject



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

def self.table_columns
  common_columns.merge(ios_columns)
end