Class: Fastlane::Actions::BuildIpaAction

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

Overview

Build an IPA binary

Class Method Summary collapse

Class Method Details

.authorsObject



45
46
47
# File 'lib/fastlane/plugin/apadmi_grout/actions/build_ipa_action.rb', line 45

def self.authors
  ["[email protected]"]
end

.available_optionsObject



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
# File 'lib/fastlane/plugin/apadmi_grout/actions/build_ipa_action.rb', line 49

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :client_name,
                                 description: "The name of the ipa's client",
                                 env_name: "CLIENT_NAME",
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid client name") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :product_name,
                                 description: "The name of the product",
                                 env_name: "PRODUCT_NAME",
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid product name") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :version,
                                 description: "The app version e.g. 0.1.0",
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid version name") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :build_number,
                                 description: "The app build number e.g. 3948",
                                 default_value: Apadmi::Grout::GitUtils.number_of_commits,
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid build number") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :suffix,
                                 description: "Suffix to identify what this output is (e.g. SOURCE, UAT, QA, DEV)",
                                 type: String,
                                 default_value: "",
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid suffix") unless value
                                 end,
                                 optional: false)
  ] + Gym::Options.available_options
end

.descriptionObject



41
42
43
# File 'lib/fastlane/plugin/apadmi_grout/actions/build_ipa_action.rb', line 41

def self.description
  "Builds an IPA"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/fastlane/plugin/apadmi_grout/actions/build_ipa_action.rb', line 93

def self.is_supported?(platform)
  platform == :ios
end

.run(params) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fastlane/plugin/apadmi_grout/actions/build_ipa_action.rb', line 14

def self.run(params)
  logger = FastLane::FastlaneLogger.new

  output_name = params[:output_name] || Apadmi::Grout::FilenameUtils.binary_output_filename(
    client_name: params[:client_name],
    product_name: params[:product_name],
    platform: "iOS",
    version: params[:version],
    build_number: params[:build_number],
    suffix: params[:suffix]
  )

  logger.message("Generating IPA: #{output_name}.ipa")
  new_params = params
  new_params[:output_name] = output_name

  # Output dir being "." is the gym default, so overwrite this
  if params[:output_directory].empty? || params[:output_directory] == "."
    new_params[:output_directory] = ENV["BITRISE_DEPLOY_DIR"] || "#{Apadmi::Grout::GitUtils.git_root}/build"
  end

  result = Fastlane::Actions::GymAction.run(new_params)

  logger.success("Generated #{output_name}.ipa in #{result}")
  result
end