Class: Fastlane::Actions::InstallIosRuntimeAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::InstallIosRuntimeAction
- Defined in:
- lib/fastlane/plugin/stream_actions/actions/install_ios_runtime.rb
Documentation collapse
Class Method Summary collapse
Class Method Details
.available_options ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fastlane/plugin/stream_actions/actions/install_ios_runtime.rb', line 32 def self. [ FastlaneCore::ConfigItem.new( key: :version, description: 'iOS Version' ), FastlaneCore::ConfigItem.new( key: :tool, description: 'Which tool to use to install the runtime: ipsw or xcodes', default_value: 'ipsw', verify_block: proc do |tool| UI.user_error!('Available options are `ipsw` and `xcodes`') unless ['xcodes', 'ipsw'].include?(tool) end ), FastlaneCore::ConfigItem.new( key: :custom_script, description: 'Path to custom script to install the runtime (might be required for ipsw)', optional: true ) ] end |
.description ⇒ Object
28 29 30 |
# File 'lib/fastlane/plugin/stream_actions/actions/install_ios_runtime.rb', line 28 def self.description 'Install iOS Runtime' end |
.is_supported?(platform) ⇒ Boolean
54 55 56 |
# File 'lib/fastlane/plugin/stream_actions/actions/install_ios_runtime.rb', line 54 def self.is_supported?(platform) [:ios].include?(platform) end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fastlane/plugin/stream_actions/actions/install_ios_runtime.rb', line 4 def self.run(params) runtimes = `xcrun simctl runtime list -j` UI.("👉 Runtime list:\n#{runtimes}") simulators = JSON.parse(runtimes).select do |_, sim| sim['platformIdentifier'].end_with?('iphonesimulator') && sim['version'] == params[:version] && sim['state'] == 'Ready' end if simulators.empty? if params[:tool] == 'ipsw' sh("echo 'iOS #{params[:version]} Simulator' | ipsw download xcode --sim") if Dir['*.dmg'].first.nil? sh("#{params[:custom_script]} #{Dir['*.dmg'].first}") if params[:custom_script] else sh("sudo xcodes runtimes install 'iOS #{params[:version]}'") end UI.success("iOS #{params[:version]} Runtime successfuly installed") else UI.important("iOS #{params[:version]} Runtime already exists") end end |