class Fastlane::Actions::EnsureSwiftVersionAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/ensure_swift_version/actions/ensure_swift_version_action.rb, line 34 def self.available_options [ FastlaneCore::ConfigItem.new(key: :version, env_name: "FL_ENSURE_SWIFT_VERSION", description: "Swift version to verify that is selected", is_string: true, optional: false) ] end
category()
click to toggle source
# File lib/fastlane/plugin/ensure_swift_version/actions/ensure_swift_version_action.rb, line 44 def self.category :building end
description()
click to toggle source
# File lib/fastlane/plugin/ensure_swift_version/actions/ensure_swift_version_action.rb, line 17 def self.description "This plugin ensure version of Swift language used for project" end
details()
click to toggle source
# File lib/fastlane/plugin/ensure_swift_version/actions/ensure_swift_version_action.rb, line 29 def self.details # Optional: "This plugin can be used in before_all lane to check if version of Swift is correct before building app" end
example_code()
click to toggle source
# File lib/fastlane/plugin/ensure_swift_version/actions/ensure_swift_version_action.rb, line 48 def self.example_code ['check_swift_version(version: "Apple Swift version 3.0.2")'] end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/ensure_swift_version/actions/ensure_swift_version_action.rb, line 52 def self.is_supported?(platform) [:ios, :mac].include?(platform) end
return_value()
click to toggle source
# File lib/fastlane/plugin/ensure_swift_version/actions/ensure_swift_version_action.rb, line 25 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/ensure_swift_version/actions/ensure_swift_version_action.rb, line 4 def self.run(params) UI.message("The ensure_swift_version plugin is working!") required_version = params[:version] selected_version = sh("swift -version") if selected_version.include?(required_version) UI.success("Selected Swift version is correct: #{selected_version}") else UI.message("Selected Swift version is not correct: #{selected_version}. You expected #{required_version}.") UI.message("To correct this, make sure you are using right Swift toolchain Or Xcode version") UI.user_error!("Selected Swift version doesn't match your requirement.\nExpected: #{required_version}\nActual: #{selected_version}\n") end end