lib/run_loop/xcode.rb in run_loop-4.3.0 vs lib/run_loop/xcode.rb in run_loop-4.4.1
- old
+ new
@@ -32,10 +32,18 @@
# @return [RunLoop::Version] 11.0
def v110
fetch_version(:v110)
end
+ # Returns a version instance for Xcode 10.3; used to check for the
+ # availability of features and paths to various items on the filesystem
+ #
+ # @return [RunLoop::Version] 10.3
+ def v103
+ fetch_version(:v103)
+ end
+
# Returns a version instance for Xcode 10.2; used to check for the
# availability of features and paths to various items on the filesystem
#
# @return [RunLoop::Version] 10.2
def v102
@@ -127,10 +135,17 @@
# @return [Boolean] `true` if the current Xcode version is >= 11.0
def version_gte_110?
version >= v110
end
+ # Is the active Xcode version 10.3 or above?
+ #
+ # @return [Boolean] `true` if the current Xcode version is >= 10.3
+ def version_gte_103?
+ version >= v103
+ end
+
# Is the active Xcode version 10.2 or above?
#
# @return [Boolean] `true` if the current Xcode version is >= 10.2
def version_gte_102?
version >= v102
@@ -295,9 +310,51 @@
$ man xcode-select
}
end
path
end
+ end
+
+ def core_simulator_dir
+ if version_gte_110?
+ core_simulator_dir = File.join(developer_dir,
+ 'Platforms', 'iPhoneOS.platform', 'Library',
+ 'Developer', 'CoreSimulator')
+ else
+ core_simulator_dir = File.join(developer_dir,
+ 'Platforms', 'iPhoneOS.platform', 'Developer',
+ 'Library', 'CoreSimulator')
+ end
+ File.expand_path(core_simulator_dir)
+ end
+
+ def ios_version
+ xcode_version = version
+ sim_major = xcode_version.major + 2
+ sim_minor = xcode_version.minor
+ if xcode_version == v103
+ sim_minor = 4
+ end
+
+ return RunLoop::Version.new("#{sim_major}.#{sim_minor}")
+ end
+
+ def default_device
+ xcode_version = version
+ if xcode_version.major == 11
+ return "iPhone 11"
+ end
+
+ if xcode_version.major == 10
+ if xcode_version.minor >= 2
+ return "iPhone Xs"
+ else
+ return "iPhone XS"
+ end
+ end
+
+ # Xcode < 10
+ return "iPhone #{xcode_version.major - 1}"
end
private
attr_reader :xcode_versions