Class: RunLoop::Xcode
Overview
All command line tools are run in the context of ‘xcrun`.
A model of the active Xcode version.
Throughout this class’s documentation, there are references to the _active version of Xcode_. The active Xcode version is the one returned by ‘xcrun xcodebuild`. The current Xcode version can be set using `xcode-select` or overridden using the `DEVELOPER_DIR`.
Constant Summary
Constants included from Shell
Instance Method Summary collapse
-
#beta? ⇒ Boolean
Is this a beta version of Xcode?.
-
#developer_dir ⇒ String
Returns the path to the current developer directory.
-
#inspect ⇒ Object
Returns debug String representation.
-
#to_s ⇒ Object
Returns a String representation.
-
#v50 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 5.0`; used to check for the availability of features and paths to various items on the filesystem.
-
#v51 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 5.1`; used to check for the availability of features and paths to various items on the filesystem.
-
#v60 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.0`; used to check for the availability of features and paths to various items on the filesystem.
-
#v61 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.1`; used to check for the availability of features and paths to various items on the filesystem.
-
#v62 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.2`; used to check for the availability of features and paths to various items on the filesystem.
-
#v63 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.3`; used to check for the availability of features and paths to various items on the filesystem.
-
#v64 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.4`; used to check for the availability of features and paths to various items on the filesystem.
-
#v70 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 7.0`; used to check for the availability of features and paths to various items on the filesystem.
-
#v71 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 7.1`; used to check for the availability of features and paths to various items on the filesystem.
-
#v72 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 7.2`; used to check for the availability of features and paths to various items on the filesystem.
-
#v73 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 7.3`; used to check for the availability of features and paths to various items on the filesystem.
-
#v80 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 8.0`; used to check for the availability of features and paths to various items on the filesystem.
-
#v81 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 8.1`; used to check for the availability of features and paths to various items on the filesystem.
-
#v82 ⇒ RunLoop::Version
Returns a version instance for Xcode 8.2; used to check for the availability of features and paths to various items on the filesystem.
-
#v83 ⇒ RunLoop::Version
Returns a version instance for Xcode 8.3; used to check for the availability of features and paths to various items on the filesystem.
-
#v90 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.0; used to check for the availability of features and paths to various items on the filesystem.
-
#v91 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.1; used to check for the availability of features and paths to various items on the filesystem.
-
#v92 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.2; used to check for the availability of features and paths to various items on the filesystem.
-
#v93 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.3; used to check for the availability of features and paths to various items on the filesystem.
-
#v94 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.4; used to check for the availability of features and paths to various items on the filesystem.
-
#version ⇒ RunLoop::Version
Returns the current version of Xcode.
-
#version_gte_51? ⇒ Boolean
deprecated
Deprecated.
2.1.0
-
#version_gte_61? ⇒ Boolean
Is the active Xcode version 6.1 or above?.
-
#version_gte_62? ⇒ Boolean
Is the active Xcode version 6.2 or above?.
-
#version_gte_63? ⇒ Boolean
Is the active Xcode version 6.3 or above?.
-
#version_gte_64? ⇒ Boolean
Is the active Xcode version 6.4 or above?.
-
#version_gte_6? ⇒ Boolean
Is the active Xcode version 6 or above?.
-
#version_gte_71? ⇒ Boolean
Is the active Xcode version 7.1 or above?.
-
#version_gte_72? ⇒ Boolean
Is the active Xcode version 7.2 or above?.
-
#version_gte_73? ⇒ Boolean
Is the active Xcode version 7.3 or above?.
-
#version_gte_7? ⇒ Boolean
Is the active Xcode version 7 or above?.
-
#version_gte_81? ⇒ Boolean
Is the active Xcode version 8.1 or above?.
-
#version_gte_82? ⇒ Boolean
Is the active Xcode version 8.2 or above?.
-
#version_gte_83? ⇒ Boolean
Is the active Xcode version 8.3 or above?.
-
#version_gte_8? ⇒ Boolean
Is the active Xcode version 8.0 or above?.
-
#version_gte_90? ⇒ Boolean
Is the active Xcode version 9.0 or above?.
-
#version_gte_91? ⇒ Boolean
Is the active Xcode version 9.1 or above?.
-
#version_gte_92? ⇒ Boolean
Is the active Xcode version 9.2 or above?.
-
#version_gte_93? ⇒ Boolean
Is the active Xcode version 9.3 or above?.
-
#version_gte_94? ⇒ Boolean
Is the active Xcode version 9.3 or above?.
Methods included from Shell
run_shell_command, #run_shell_command
Methods included from Encoding
Instance Method Details
#beta? ⇒ Boolean
Relies on Xcode beta versions having and app bundle named Xcode-Beta.app
Is this a beta version of Xcode?
360 361 362 |
# File 'lib/run_loop/xcode.rb', line 360 def beta? developer_dir[/Xcode-[Bb]eta.app/, 0] end |
#developer_dir ⇒ String
Returns the path to the current developer directory.
From the man pages:
“‘ $ man xcode-select DEVELOPER_DIR Overrides the active developer directory. When DEVELOPER_DIR is set, its value will be used instead of the system-wide active developer directory. “`
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/run_loop/xcode.rb', line 380 def developer_dir @xcode_developer_dir ||= begin if RunLoop::Environment.developer_dir path = RunLoop::Environment.developer_dir else path = xcode_select_path end if !File.directory?(path) raise RuntimeError, %Q{Cannot determine the active Xcode. Expected an Xcode here: #{path} Check the value of xcode-select: # Does this resolve to a valid Xcode.app/Contents/Developer path? $ xcode-select --print-path Is the DEVELOPER_DIR variable set in your environment? You would only use this if you have multiple Xcode's installed. $ echo $DEVELOPER_DIR See the man pages for xcrun and xcode-select for details. $ man xcrun $ man xcode-select } end path end end |
#inspect ⇒ Object
Returns debug String representation
25 26 27 |
# File 'lib/run_loop/xcode.rb', line 25 def inspect to_s end |
#to_s ⇒ Object
Returns a String representation.
20 21 22 |
# File 'lib/run_loop/xcode.rb', line 20 def to_s "#<Xcode #{version.to_s}>" end |
#v50 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 5.0`; used to check for the availability of features and paths to various items on the filesystem.
185 186 187 |
# File 'lib/run_loop/xcode.rb', line 185 def v50 fetch_version(:v50) end |
#v51 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 5.1`; used to check for the availability of features and paths to various items on the filesystem.
177 178 179 |
# File 'lib/run_loop/xcode.rb', line 177 def v51 fetch_version(:v51) end |
#v60 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.0`; used to check for the availability of features and paths to various items on the filesystem.
169 170 171 |
# File 'lib/run_loop/xcode.rb', line 169 def v60 fetch_version(:v60) end |
#v61 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.1`; used to check for the availability of features and paths to various items on the filesystem.
161 162 163 |
# File 'lib/run_loop/xcode.rb', line 161 def v61 fetch_version(:v61) end |
#v62 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.2`; used to check for the availability of features and paths to various items on the filesystem.
153 154 155 |
# File 'lib/run_loop/xcode.rb', line 153 def v62 fetch_version(:v62) end |
#v63 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.3`; used to check for the availability of features and paths to various items on the filesystem.
145 146 147 |
# File 'lib/run_loop/xcode.rb', line 145 def v63 fetch_version(:v63) end |
#v64 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 6.4`; used to check for the availability of features and paths to various items on the filesystem.
137 138 139 |
# File 'lib/run_loop/xcode.rb', line 137 def v64 fetch_version(:v64) end |
#v70 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 7.0`; used to check for the availability of features and paths to various items on the filesystem.
129 130 131 |
# File 'lib/run_loop/xcode.rb', line 129 def v70 fetch_version(:v70) end |
#v71 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 7.1`; used to check for the availability of features and paths to various items on the filesystem.
121 122 123 |
# File 'lib/run_loop/xcode.rb', line 121 def v71 fetch_version(:v71) end |
#v72 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 7.2`; used to check for the availability of features and paths to various items on the filesystem.
113 114 115 |
# File 'lib/run_loop/xcode.rb', line 113 def v72 fetch_version(:v72) end |
#v73 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 7.3`; used to check for the availability of features and paths to various items on the filesystem.
105 106 107 |
# File 'lib/run_loop/xcode.rb', line 105 def v73 fetch_version(:v73) end |
#v80 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 8.0`; used to check for the availability of features and paths to various items on the filesystem.
97 98 99 |
# File 'lib/run_loop/xcode.rb', line 97 def v80 fetch_version(:v80) end |
#v81 ⇒ RunLoop::Version
Returns a version instance for ‘Xcode 8.1`; used to check for the availability of features and paths to various items on the filesystem.
89 90 91 |
# File 'lib/run_loop/xcode.rb', line 89 def v81 fetch_version(:v81) end |
#v82 ⇒ RunLoop::Version
Returns a version instance for Xcode 8.2; used to check for the availability of features and paths to various items on the filesystem
81 82 83 |
# File 'lib/run_loop/xcode.rb', line 81 def v82 fetch_version(:v82) end |
#v83 ⇒ RunLoop::Version
Returns a version instance for Xcode 8.3; used to check for the availability of features and paths to various items on the filesystem
73 74 75 |
# File 'lib/run_loop/xcode.rb', line 73 def v83 fetch_version(:v83) end |
#v90 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.0; used to check for the availability of features and paths to various items on the filesystem
65 66 67 |
# File 'lib/run_loop/xcode.rb', line 65 def v90 fetch_version(:v90) end |
#v91 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.1; used to check for the availability of features and paths to various items on the filesystem
57 58 59 |
# File 'lib/run_loop/xcode.rb', line 57 def v91 fetch_version(:v91) end |
#v92 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.2; used to check for the availability of features and paths to various items on the filesystem
49 50 51 |
# File 'lib/run_loop/xcode.rb', line 49 def v92 fetch_version(:v92) end |
#v93 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.3; used to check for the availability of features and paths to various items on the filesystem
41 42 43 |
# File 'lib/run_loop/xcode.rb', line 41 def v93 fetch_version(:v93) end |
#v94 ⇒ RunLoop::Version
Returns a version instance for Xcode 9.4; used to check for the availability of features and paths to various items on the filesystem
33 34 35 |
# File 'lib/run_loop/xcode.rb', line 33 def v94 fetch_version(:v94) end |
#version ⇒ RunLoop::Version
Returns the current version of Xcode.
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/run_loop/xcode.rb', line 328 def version @xcode_version ||= begin if RunLoop::Environment.xtc? RunLoop::Version.new("0.0.0") else version = RunLoop::Version.new("0.0.0") begin args = ["xcrun", "xcodebuild", "-version"] hash = run_shell_command(args) if hash[:exit_status] != 0 RunLoop.log_error("xcrun xcodebuild -version exited non-zero") else out = hash[:out] version_string = out.chomp[VERSION_REGEX, 0] version = RunLoop::Version.new(version_string) end rescue RuntimeError => e RunLoop.log_error(%Q[ Could not find Xcode version: #{e.class}: #{e.} ]) end version end end end |
#version_gte_51? ⇒ Boolean
2.1.0
Is the active Xcode version 5.1 or above?
319 320 321 322 |
# File 'lib/run_loop/xcode.rb', line 319 def version_gte_51? #RunLoop.deprecated("2.1.0", "No replacement") version >= v51 end |
#version_gte_61? ⇒ Boolean
Is the active Xcode version 6.1 or above?
304 305 306 |
# File 'lib/run_loop/xcode.rb', line 304 def version_gte_61? version >= v61 end |
#version_gte_62? ⇒ Boolean
Is the active Xcode version 6.2 or above?
297 298 299 |
# File 'lib/run_loop/xcode.rb', line 297 def version_gte_62? version >= v62 end |
#version_gte_63? ⇒ Boolean
Is the active Xcode version 6.3 or above?
290 291 292 |
# File 'lib/run_loop/xcode.rb', line 290 def version_gte_63? version >= v63 end |
#version_gte_64? ⇒ Boolean
Is the active Xcode version 6.4 or above?
283 284 285 |
# File 'lib/run_loop/xcode.rb', line 283 def version_gte_64? version >= v64 end |
#version_gte_6? ⇒ Boolean
Is the active Xcode version 6 or above?
311 312 313 |
# File 'lib/run_loop/xcode.rb', line 311 def version_gte_6? version >= v60 end |
#version_gte_71? ⇒ Boolean
Is the active Xcode version 7.1 or above?
269 270 271 |
# File 'lib/run_loop/xcode.rb', line 269 def version_gte_71? version >= v71 end |
#version_gte_72? ⇒ Boolean
Is the active Xcode version 7.2 or above?
262 263 264 |
# File 'lib/run_loop/xcode.rb', line 262 def version_gte_72? version >= v72 end |
#version_gte_73? ⇒ Boolean
Is the active Xcode version 7.3 or above?
255 256 257 |
# File 'lib/run_loop/xcode.rb', line 255 def version_gte_73? version >= v73 end |
#version_gte_7? ⇒ Boolean
Is the active Xcode version 7 or above?
276 277 278 |
# File 'lib/run_loop/xcode.rb', line 276 def version_gte_7? version >= v70 end |
#version_gte_81? ⇒ Boolean
Is the active Xcode version 8.1 or above?
241 242 243 |
# File 'lib/run_loop/xcode.rb', line 241 def version_gte_81? version >= v81 end |
#version_gte_82? ⇒ Boolean
Is the active Xcode version 8.2 or above?
234 235 236 |
# File 'lib/run_loop/xcode.rb', line 234 def version_gte_82? version >= v82 end |
#version_gte_83? ⇒ Boolean
Is the active Xcode version 8.3 or above?
227 228 229 |
# File 'lib/run_loop/xcode.rb', line 227 def version_gte_83? version >= v83 end |
#version_gte_8? ⇒ Boolean
Is the active Xcode version 8.0 or above?
248 249 250 |
# File 'lib/run_loop/xcode.rb', line 248 def version_gte_8? version >= v80 end |
#version_gte_90? ⇒ Boolean
Is the active Xcode version 9.0 or above?
220 221 222 |
# File 'lib/run_loop/xcode.rb', line 220 def version_gte_90? version >= v90 end |
#version_gte_91? ⇒ Boolean
Is the active Xcode version 9.1 or above?
213 214 215 |
# File 'lib/run_loop/xcode.rb', line 213 def version_gte_91? version >= v91 end |
#version_gte_92? ⇒ Boolean
Is the active Xcode version 9.2 or above?
206 207 208 |
# File 'lib/run_loop/xcode.rb', line 206 def version_gte_92? version >= v92 end |
#version_gte_93? ⇒ Boolean
Is the active Xcode version 9.3 or above?
199 200 201 |
# File 'lib/run_loop/xcode.rb', line 199 def version_gte_93? version >= v93 end |
#version_gte_94? ⇒ Boolean
Is the active Xcode version 9.3 or above?
192 193 194 |
# File 'lib/run_loop/xcode.rb', line 192 def version_gte_94? version >= v94 end |