fastlane-plugin-stream_actions 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd3a8bb84374fa2dabfec452d061c770a0914634d0a50a3fe61ca6f45bf7de1d
4
- data.tar.gz: e6ff6403ce64a6883bbf12656e1f96075dd323416368c5ec5693e3c28612ce1d
3
+ metadata.gz: 51515d694ad7ffe607e7ac905bec535762ce45e2864182a584c13be2f5f03407
4
+ data.tar.gz: '0966ff481d55fd371210ea3a91eaaa93d2b152925adf89f378dde406228a40e4'
5
5
  SHA512:
6
- metadata.gz: b33bbb15853a3890ca9871e7b4dbc5417a08476932816e69cf89063599e4bb7d40d065a8d00f643654981d9cd7494b86087f4f395f31a3be68f8d17f2687ff7d
7
- data.tar.gz: 656fdb0fab34a8c6d4d5783415d5f942313fb1ea47aebc0fef97d52e308006f4cc9c8289a38bffbe3d548b6b54a0219f99a10660090adfe52cb93bc61b100eb5
6
+ metadata.gz: 65485c117986f0a5e59e6a99b01b47a6eddcd026e00572d7128c8e4eefc05f8d2495620e161f61122e0b2d0484a247e3230a9cdef5d291ec7aa7bb972d7edadb
7
+ data.tar.gz: 707a89dba5ba744b4e78cea21484094ce9ed2c776c6a47a28197867c09881d97bef4053365aaffb132ca72bfefa11d0e67d85164d5e928fe24fa6a490652469e
@@ -2,12 +2,29 @@ module Fastlane
2
2
  module Actions
3
3
  class PrepareSimulatorAction < Action
4
4
  def self.run(params)
5
- version_set = params[:device].include?('(')
6
- sim = FastlaneCore::Simulator.all.detect do |d|
7
- params[:device] == (version_set ? "#{d.name} (#{d.os_version})" : d.name)
5
+ simulators = FastlaneCore::Simulator.all
6
+ version_regex = /\((\d+\.)?(\d+\.)?(\*|\d+)\)/
7
+ ios_version = params[:device][version_regex]
8
+
9
+ if ios_version.nil?
10
+ sim = simulators.filter { |d| d.name == params[:device] }.max_by(&:os_version)
11
+ else
12
+ sim = simulators.detect { |d| "#{d.name} (#{d.os_version})" == params[:device] }
13
+ if sim.nil?
14
+ device_name = params[:device].sub(version_regex, '').strip
15
+ sh("xcrun simctl create '#{device_name}' '#{device_name}' 'iOS#{ios_version.delete('()')}'")
16
+ sim = simulators.detect { |d| "#{d.name} (#{d.os_version})" == params[:device] }
17
+ end
18
+ end
19
+
20
+ if sim.nil?
21
+ simulators.map! { |d| "#{d.name} (#{d.os_version})" }.join("\n")
22
+ UI.user_error!("Simulator #{params[:device]} not found \nAvailable simulators: \n#{simulators}")
8
23
  end
24
+
9
25
  sim.reset if params[:reset]
10
26
  sh("xcrun simctl bootstatus #{sim.udid} -b")
27
+ UI.success("Simulator #{sim.name} (#{sim.os_version}) is ready")
11
28
  end
12
29
 
13
30
  #####################################################
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-stream_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-03 00:00:00.000000000 Z
11
+ date: 2023-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler