Class: Fastlane::Actions::AltoolAction

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

Constant Summary collapse

ALTOOL =
File.expand_path('/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool')

Class Method Summary collapse

Class Method Details

.authorsObject



43
44
45
# File 'lib/fastlane/plugin/altool/actions/altool_action.rb', line 43

def self.authors
  ["Shashikant Jagtap"]
end

.available_optionsObject



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
98
99
100
101
# File 'lib/fastlane/plugin/altool/actions/altool_action.rb', line 56

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :altool_app_type,
                              env_name: "ALTOOL_APP_TYPE",
                              description: "Type or platform of application e.g osx, ios, appletvos ",
                              default_value: "ios",
                              is_string: true,
                              optional: true),

    FastlaneCore::ConfigItem.new(key: :altool_ipa_path,
                              env_name: "ALTOOL_IPA_PATH",
                              description: "Path to IPA file ",
                              is_string: true,
                              default_value: Dir["*.ipa"].sort_by { |x| File.mtime(x) }.last,
                              optional: false,
                              verify_block: proc do |value|
                                value = File.expand_path(value)
                                UI.user_error!("Could not find ipa file at path '#{value}'") unless File.exist?(value)
                                UI.user_error!("'#{value}' doesn't seem to be an ipa file") unless value.end_with?(".ipa")
                              end),

    FastlaneCore::ConfigItem.new(key: :altool_username,
                              env_name: "ALTOOL_USERNAME",
                              description: "Your Apple ID for iTunes Connects. This usually FASTLANE_USER environmental variable",
                              is_string: true,
                              default_value: ENV["FASTLANE_USER"],
                              optional: false,
                              ),

    FastlaneCore::ConfigItem.new(key: :altool_password,
                              env_name: "ALTOOL_PASSWORD",
                              description: "Your Apple ID Password for iTunes Connects. This usually FASTLANE_PASSWORD environmental variable",
                              is_string: true,
                              default_value: ENV["FASTLANE_PASSWORD"],
                              optional: true,
                              ),

    FastlaneCore::ConfigItem.new(key: :altool_output_format,
                              env_name: "ALTOOL_OUTPUT_FORMAT",
                              description: "Output formal xml or normal ",
                              default_value: "normal",
                              is_string: true,
                              optional: true)

  ]
end

.descriptionObject



39
40
41
# File 'lib/fastlane/plugin/altool/actions/altool_action.rb', line 39

def self.description
  "Upload IPA to iTunes Connect using altool"
end

.detailsObject



51
52
53
54
# File 'lib/fastlane/plugin/altool/actions/altool_action.rb', line 51

def self.details
  # Optional:
  "This plugin can be used for uploading ipa files to iTunes Connect using altool rahter than using ITMSTransporter.. Currently Fastlane deliver upload an ipa file using iTMSTransporter tool. There is another slick command line too called altool that can be used to upload ipa files as well"
end

.example_codeObject



103
104
105
106
107
108
109
110
111
112
# File 'lib/fastlane/plugin/altool/actions/altool_action.rb', line 103

def self.example_code
  ['   altool(
      altool_username: ENV["FASTLANE_USER"],
      altool_password: ENV["FASTLANE_PASSWORD"],
      altool_app_type: "ios",
      altool_ipa_path: "./build/Your-ipa.ipa",
      altool_output_format: "xml",
  )
 ']
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


114
115
116
117
118
119
120
# File 'lib/fastlane/plugin/altool/actions/altool_action.rb', line 114

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



47
48
49
# File 'lib/fastlane/plugin/altool/actions/altool_action.rb', line 47

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fastlane/plugin/altool/actions/altool_action.rb', line 9

def self.run(params)
  UI.message(" ----altool binary exists on your machine----- ")

  altool_app_type = params[:altool_app_type]
  altool_ipa_path = "\"#{params[:altool_ipa_path]}\""
  altool_username = params[:altool_username]
  altool_output_format = params[:altool_output_format]

  ENV["ALTOOL_PASSWORD"] = params[:altool_password]
  altool_password = "@env:ALTOOL_PASSWORD"

  UI.message("========Validating and Uploading your ipa file to iTunes Connect=========")
  command = [
    ALTOOL,
    '--upload-app',
    '-t',
    altool_app_type,
    '-f',
    altool_ipa_path,
    '-u',
    altool_username,
    '-p',
    altool_password,
    '--output-format',
    altool_output_format
  ]
  Actions.sh(command.join(' '))
  UI.message("========It maight take so long time to fully upload your IPA files=========")
end