snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb in fastlane-2.74.0.beta.20180106010004 vs snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb in fastlane-2.74.0.beta.20180107010004
- old
+ new
@@ -1,8 +1,34 @@
-require 'snapshot/simulator_launchers/simulator_launcher_base'
+require 'fastlane_core/test_parser'
+require_relative 'simulator_launcher_base'
module Snapshot
+ class CPUInspector
+ def self.hwprefs_available?
+ `which hwprefs` != ''
+ end
+
+ def self.cpu_count
+ @cpu_count ||=
+ case RUBY_PLATFORM
+ when /darwin9/
+ `hwprefs cpu_count`.to_i
+ when /darwin10/
+ (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.physicalcpu_max`).to_i
+ when /linux/
+ UI.user_error!("We detected that you are running snapshot on Linux, but snapshot is only supported on macOS")
+ when /freebsd/
+ UI.user_error!("We detected that you are running snapshot on FreeBSD, but snapshot is only supported on macOS")
+ else
+ if RbConfig::CONFIG['host_os'] =~ /darwin/
+ (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.physicalcpu_max`).to_i
+ else
+ UI.crash!("Cannot find the machine's processor count.")
+ end
+ end
+ end
+ end
class SimulatorLauncher < SimulatorLauncherBase
# With Xcode 9's ability to run tests on multiple concurrent simulators,
# this method sets the maximum number of simulators to run simultaneously
# to avoid overloading your machine.
def default_number_of_simultaneous_simulators
@@ -173,34 +199,8 @@
containing = File.expand_path(Snapshot.config[:buildlog_path])
FileUtils.mkdir_p(containing)
return File.join(containing, file_name)
- end
- end
-
- class CPUInspector
- def self.hwprefs_available?
- `which hwprefs` != ''
- end
-
- def self.cpu_count
- @cpu_count ||=
- case RUBY_PLATFORM
- when /darwin9/
- `hwprefs cpu_count`.to_i
- when /darwin10/
- (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.physicalcpu_max`).to_i
- when /linux/
- UI.user_error!("We detected that you are running snapshot on Linux, but snapshot is only supported on macOS")
- when /freebsd/
- UI.user_error!("We detected that you are running snapshot on FreeBSD, but snapshot is only supported on macOS")
- else
- if RbConfig::CONFIG['host_os'] =~ /darwin/
- (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.physicalcpu_max`).to_i
- else
- UI.crash!("Cannot find the machine's processor count.")
- end
- end
end
end
end