Class: Fastlane::Actions::XcversionAction

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

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, details, method_missing, other_action, output, return_value, sh, step_text

Class Method Details

.authorObject



19
20
21
# File 'lib/fastlane/actions/xcversion.rb', line 19

def self.author
  "oysta"
end

.available_optionsObject



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

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :version,
                                 env_name: "FL_XCODE_VERSION",
                                 description: "The version of Xcode to select specified as a Gem::Version requirement string (e.g. '~> 7.1.0')",
                                 optional: false,
                                 verify_block: Helper::XcversionHelper::Verify.method(:requirement)
                                )
  ]
end

.descriptionObject



15
16
17
# File 'lib/fastlane/actions/xcversion.rb', line 15

def self.description
  "Select an Xcode to use by version specifier"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fastlane/actions/xcversion.rb', line 34

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

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/fastlane/actions/xcversion.rb', line 4

def self.run(params)
  version = params[:version]
  xcode = Helper::XcversionHelper.find_xcode(version)
  UI.user_error!("Cannot find an installed Xcode satisfying '#{version}'") if xcode.nil?

  UI.verbose("Found Xcode version #{xcode.version} at #{xcode.path} satisfying requirement #{version}")
  UI.message("Setting Xcode version to #{xcode.path} for all build steps")

  ENV["DEVELOPER_DIR"] = File.join(xcode.path, "/Contents/Developer")
end