Class: FastlaneCore::Simulator
- Inherits:
-
Object
- Object
- FastlaneCore::Simulator
show all
- Defined in:
- fastlane_core/lib/fastlane_core/device_manager.rb
Class Method Summary
collapse
Class Method Details
.all ⇒ Object
219
220
221
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 219
def all
return DeviceManager.simulators('iOS')
end
|
.clear_cache ⇒ Object
250
251
252
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 250
def clear_cache
@devices = nil
end
|
.copy_logs(device, log_identity, logs_destination_dir) ⇒ Object
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 264
def copy_logs(device, log_identity, logs_destination_dir)
logs_destination_dir = File.expand_path(logs_destination_dir)
os_version = FastlaneCore::CommandExecutor.execute(command: 'sw_vers -productVersion', print_all: false, print_command: false)
host_computer_supports_logarchives = Gem::Version.new(os_version) >= Gem::Version.new('10.12.0')
device_supports_logarchives = Gem::Version.new(device.os_version) >= Gem::Version.new('10.0')
are_logarchives_supported = device_supports_logarchives && host_computer_supports_logarchives
if are_logarchives_supported
copy_logarchive(device, log_identity, logs_destination_dir)
else
copy_logfile(device, log_identity, logs_destination_dir)
end
end
|
.delete_all ⇒ Object
Delete all simulators of this type
241
242
243
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 241
def delete_all
all.each(&:delete)
end
|
.delete_all_by_version(os_version: nil) ⇒ Object
245
246
247
248
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 245
def delete_all_by_version(os_version: nil)
return false unless os_version
all.select { |device| device.os_version == os_version }.each(&:delete)
end
|
.launch(device) ⇒ Object
254
255
256
257
258
259
260
261
262
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 254
def launch(device)
return unless device.is_simulator
simulator_path = File.join(Helper.xcode_path, 'Applications', 'Simulator.app')
UI.verbose("Launching #{simulator_path} for device: #{device.name} (#{device.udid})")
Helper.backticks("open -a #{simulator_path} --args -CurrentDeviceUDID #{device.udid}", print: FastlaneCore::Globals.verbose?)
end
|
.reset(udid: nil, name: nil, os_version: nil) ⇒ Object
Reset simulator by UDID or name and OS version Latter is useful when combined with -destination option of xcodebuild
235
236
237
238
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 235
def reset(udid: nil, name: nil, os_version: nil)
match = all.detect { |device| device.udid == udid || device.name == name && device.os_version == os_version }
match.reset if match
end
|
.reset_all ⇒ Object
Reset all simulators of this type
224
225
226
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 224
def reset_all
all.each(&:reset)
end
|
.reset_all_by_version(os_version: nil) ⇒ Object
228
229
230
231
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 228
def reset_all_by_version(os_version: nil)
return false unless os_version
all.select { |device| device.os_version == os_version }.each(&:reset)
end
|
.uninstall_app(app_identifier, device_type, device_udid) ⇒ Object
279
280
281
282
283
284
285
286
287
|
# File 'fastlane_core/lib/fastlane_core/device_manager.rb', line 279
def uninstall_app(app_identifier, device_type, device_udid)
UI.verbose("Uninstalling app '#{app_identifier}' from #{device_type}...")
UI.message("Launch Simulator #{device_type}")
Helper.backticks("xcrun instruments -w #{device_udid} &> /dev/null")
UI.message("Uninstall application #{app_identifier}")
Helper.backticks("xcrun simctl uninstall #{device_udid} #{app_identifier} &> /dev/null")
end
|