fastlane-plugin-create_simulator_devices 0.0.20 → 0.0.22

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: 90a9e367b6c4f8fdebf950f90e2c8a5132e84f70b8e29e7f1fd9f7e0d35ff844
4
- data.tar.gz: 1798f2157c42c4c0d127205b911f5bc8b4ed11216c68385d7f22156f6a1253e9
3
+ metadata.gz: b4410fa9346d92eab68b23096d387f834ddc638213659e22c82f89cf48e5d2e6
4
+ data.tar.gz: 50dc75916b8bd131ca05d0d4a196b9bbed36958e734c5bdda3ee2ebf74074548
5
5
  SHA512:
6
- metadata.gz: d9ef8d640a6385c091b2a4829bd45f8826bdf4ad142f496a2b19a5d18c4e878a4427d3e02f452a975ae2b63dc38dca89cf78ee6c34140fa56172597e145eb556
7
- data.tar.gz: b2af15e0226b095f38b6af3c8c77be9453756c816db65980fb0abf20fcc0c0793e8b30302ceb8f848c6a4390eee09e87230565323a914fedfc7b01a8eacd6104
6
+ metadata.gz: ebd3eaf035bbe0efc376b17ecd5bd963fe82e5d1bd51c7d47291a0e742dd215159e5ce689dafd937bb099ca655339b0e596fbb1474b03d3b745dedb62f11d9af
7
+ data.tar.gz: d8f8c6d6efed26e64185ca87ee68a1b04390a2fed40da2ca3a8d56779e6ac99cac5238a99114d90f898643dd532bffc024ac3cc920f8b2ea0788ff79b9865b68
@@ -108,7 +108,7 @@ module Fastlane
108
108
  default_value: CreateSimulatorDevices::DeviceNamingStyle::SCAN.to_s,
109
109
  verify_block: proc do |value|
110
110
  allowed_values = CreateSimulatorDevices::DeviceNamingStyle::ALL
111
- UI.user_error!("Invalid device naming style: #{value}. Allowed values: #{allowed_values.map(&:to_s).join(', ')}") unless allowed_values.include?(value.to_sym)
111
+ UI.user_error!("Invalid device naming style: #{value}. Allowed values: #{allowed_values.join(', ')}") unless allowed_values.include?(value.to_sym)
112
112
  end),
113
113
  ::FastlaneCore::ConfigItem.new(key: :remove_cached_runtimes,
114
114
  env_name: 'CREATE_SIMULATOR_DEVICES_REMOVE_CACHED_RUNTIMES',
@@ -110,7 +110,7 @@ module Fastlane
110
110
  default_value: CreateSimulatorDevices::DeviceNamingStyle::SCAN.to_s,
111
111
  verify_block: proc do |value|
112
112
  allowed_values = CreateSimulatorDevices::DeviceNamingStyle::ALL
113
- UI.user_error!("Invalid device naming style: #{value}. Allowed values: #{allowed_values.map(&:to_s).join(', ')}") unless allowed_values.include?(value.to_sym)
113
+ UI.user_error!("Invalid device naming style: #{value}. Allowed values: #{allowed_values.join(', ')}") unless allowed_values.include?(value.to_sym)
114
114
  end),
115
115
  ::FastlaneCore::ConfigItem.new(key: :timeout,
116
116
  env_name: 'GATHER_SIMCTL_DIAGNOSE_TIMEOUT',
@@ -83,7 +83,7 @@ module Fastlane
83
83
  UI.message('Deleting unused runtimes...')
84
84
  available_simctl_runtimes = shell_helper.simctl_runtimes
85
85
 
86
- needed_simctl_runtimes = needed_runtimes.map do |needed_runtime|
86
+ needed_simctl_runtimes = needed_runtimes.filter_map do |needed_runtime|
87
87
  # Check if available runtimes contain the needed runtime.
88
88
  simctl_runtime_matching_needed_runtime?(needed_runtime)
89
89
  end
@@ -100,15 +100,17 @@ module Fastlane
100
100
  end
101
101
  end
102
102
 
103
+ unused_simctl_runtimes.uniq!(&:identifier)
104
+
103
105
  return if unused_simctl_runtimes.empty?
104
106
 
105
107
  unused_simctl_runtimes.each do |unused_simctl_runtime|
106
- puts "Deleting unused runtime #{unused_simctl_runtime.runtime_identifier} (#{unused_simctl_runtime.identifier})..."
108
+ UI.message("Deleting unused runtime #{unused_simctl_runtime.runtime_identifier} (#{unused_simctl_runtime.identifier})...")
107
109
  shell_helper.simctl_delete_runtime(identifier: unused_simctl_runtime.identifier)
108
110
  end
109
111
 
110
112
  shell_helper.stop_core_simulator_services
111
- shell_helper.installed_runtimes_with_state
113
+ shell_helper.installed_runtimes_with_state(retry_count: 3, retry_delay: 60)
112
114
  shell_helper.simctl_runtimes(force: true)
113
115
  shell_helper.simctl_devices_for_runtimes(force: true)
114
116
  end
@@ -7,7 +7,7 @@ module Fastlane
7
7
  # Create simulator devices.
8
8
  module CreateSimulatorDevices
9
9
  # Shell helper
10
- class ShellHelper
10
+ class ShellHelper # rubocop:disable Metrics/ClassLength
11
11
  UI = ::Fastlane::UI unless defined?(UI)
12
12
 
13
13
  # Proprty verbose
@@ -20,7 +20,7 @@ module Fastlane
20
20
  self.action_context = action_context
21
21
  end
22
22
 
23
- def sh(command:, print_command: self.print_command, print_command_output: self.print_command_output)
23
+ def _sh(command:, print_command: self.print_command, print_command_output: self.print_command_output)
24
24
  if action_context
25
25
  action_context.sh(command, print_command: print_command, print_command_output: print_command_output)
26
26
  else
@@ -41,6 +41,18 @@ module Fastlane
41
41
  end
42
42
  end
43
43
 
44
+ def sh(command:, print_command: self.print_command, print_command_output: self.print_command_output, retry_count: 0, retry_delay: nil)
45
+ _sh(command: command, print_command: print_command, print_command_output: print_command_output)
46
+ rescue StandardError => e
47
+ raise e unless retry_count.positive?
48
+
49
+ retry_delay ||= 60
50
+ retry_count -= 1
51
+ UI.important("Retrying command #{command} in #{retry_delay} seconds (remaining retries: #{retry_count})...")
52
+ sleep retry_delay
53
+ sh(command: command, print_command: true, print_command_output: true, retry_count: retry_count, retry_delay: retry_delay)
54
+ end
55
+
44
56
  def stop_core_simulator_services
45
57
  UI.message('Stop CoreSimulator')
46
58
  services_to_stop = [
@@ -120,9 +132,13 @@ module Fastlane
120
132
  .map { |identifier, runtime| SimCTL::MatchedRuntime.from_hash(runtime, identifier: identifier) }
121
133
  end
122
134
 
123
- def installed_runtimes_with_state
135
+ def installed_runtimes_with_state(retry_count: 0, retry_delay: nil)
124
136
  UI.message('Fetching runtimes with state...')
125
- json = sh(command: 'xcrun simctl runtime list --json')
137
+ json = sh(
138
+ command: 'xcrun simctl runtime list --json',
139
+ retry_count: retry_count,
140
+ retry_delay: retry_delay
141
+ )
126
142
 
127
143
  JSON
128
144
  .parse(json, symbolize_names: true)
@@ -93,9 +93,7 @@ module Fastlane
93
93
  def copy_data_containers_and_logs(matched_simctl_devices, output_dir)
94
94
  matched_simctl_devices
95
95
  .reject { |simctl_device| simctl_device.state == 'Booted' }
96
- .each do |simctl_device|
97
- copy_data_container_and_logs(simctl_device, output_dir)
98
- end
96
+ .each { |simctl_device| copy_data_container_and_logs(simctl_device, output_dir) }
99
97
  end
100
98
 
101
99
  def copy_data_container_and_logs(simctl_device, output_dir)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module CreateSimulatorDevices
5
- VERSION = '0.0.20'
5
+ VERSION = '0.0.22'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-create_simulator_devices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitalii Budnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-09 00:00:00.000000000 Z
11
+ date: 2026-03-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: developers@setapp.com
@@ -53,16 +53,16 @@ require_paths:
53
53
  - lib
54
54
  required_ruby_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - ">="
56
+ - - "~>"
57
57
  - !ruby/object:Gem::Version
58
- version: 3.1.1
58
+ version: '3.3'
59
59
  required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubygems_version: 3.3.7
65
+ rubygems_version: 3.5.22
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: Fastlane plugin to create simulator devices