Class: Fastlane::Actions::GymAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/gym.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, lane_context, method_missing, other_action, output, sample_return_value, sh, step_text

Class Method Details

.authorObject



56
57
58
# File 'lib/fastlane/actions/gym.rb', line 56

def self.author
  "KrauseFx"
end

.available_optionsObject



60
61
62
63
# File 'lib/fastlane/actions/gym.rb', line 60

def self.available_options
  require 'gym'
  Gym::Options.available_options
end

.categoryObject



85
86
87
# File 'lib/fastlane/actions/gym.rb', line 85

def self.category
  :building
end

.descriptionObject



44
45
46
# File 'lib/fastlane/actions/gym.rb', line 44

def self.description
  "Easily build and sign your app using _gym_"
end

.detailsObject



48
49
50
# File 'lib/fastlane/actions/gym.rb', line 48

def self.details
  "More information: https://fastlane.tools/gym"
end

.example_codeObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/fastlane/actions/gym.rb', line 69

def self.example_code
  [
    'gym(scheme: "MyApp", workspace: "MyApp.xcworkspace")',
    'gym(
      workspace: "MyApp.xcworkspace",
      configuration: "Debug",
      scheme: "MyApp",
      silent: true,
      clean: true,
      output_directory: "path/to/dir", # Destination directory. Defaults to current directory.
      output_name: "my-app.ipa",       # specify the name of the .ipa file to generate (including file extension)
      sdk: "10.0"                      # use SDK as the name or path of the base SDK when building the project.
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/fastlane/actions/gym.rb', line 65

def self.is_supported?(platform)
  [:ios, :mac].include? platform
end

.return_valueObject



52
53
54
# File 'lib/fastlane/actions/gym.rb', line 52

def self.return_value
  "The absolute path to the generated ipa file"
end

.run(values) ⇒ 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
38
39
40
41
42
# File 'lib/fastlane/actions/gym.rb', line 9

def self.run(values)
  require 'gym'

  begin
    FastlaneCore::UpdateChecker.start_looking_for_update('gym') unless Helper.is_test?

    should_use_legacy_api = values[:use_legacy_build_api] || Gym::Xcode.pre_7?

    if values[:provisioning_profile_path].to_s.length.zero? && should_use_legacy_api
      sigh_path = Actions.lane_context[Actions::SharedValues::SIGH_PROFILE_PATH] || ENV["SIGH_PROFILE_PATH"]
      values[:provisioning_profile_path] = File.expand_path(sigh_path) if sigh_path
    end

    values[:export_method] ||= Actions.lane_context[Actions::SharedValues::SIGH_PROFILE_TYPE]

    absolute_ipa_path = File.expand_path(Gym::Manager.new.work(values))
    absolute_dsym_path = absolute_ipa_path.gsub(".ipa", ".app.dSYM.zip")

    # This might be the mac app path, so we don't want to set it here
    # https://github.com/fastlane/fastlane/issues/5757
    if absolute_ipa_path.include?(".ipa")
      Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = absolute_ipa_path
      ENV[SharedValues::IPA_OUTPUT_PATH.to_s] = absolute_ipa_path # for deliver
    end

    Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = absolute_dsym_path if File.exist?(absolute_dsym_path)
    Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE] = Gym::BuildCommandGenerator.archive_path
    ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] = absolute_dsym_path if File.exist?(absolute_dsym_path)

    return absolute_ipa_path
  ensure
    FastlaneCore::UpdateChecker.show_update_status('gym', Gym::VERSION)
  end
end