Class: RunLoop::Xcode
- Inherits:
-
Object
- Object
- RunLoop::Xcode
- Defined in:
- lib/run_loop/xcode.rb
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`.
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.
-
#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_8? ⇒ Boolean
Is the active Xcode version 8.0 or above?.
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?
219 220 221 |
# File 'lib/run_loop/xcode.rb', line 219 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. “`
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/run_loop/xcode.rb', line 239 def developer_dir @xcode_developer_dir ||= lambda do 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.call end |
#inspect ⇒ Object
Returns debug String representation
23 24 25 |
# File 'lib/run_loop/xcode.rb', line 23 def inspect to_s end |
#to_s ⇒ Object
Returns a String representation.
18 19 20 |
# File 'lib/run_loop/xcode.rb', line 18 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.
119 120 121 |
# File 'lib/run_loop/xcode.rb', line 119 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.
111 112 113 |
# File 'lib/run_loop/xcode.rb', line 111 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.
103 104 105 |
# File 'lib/run_loop/xcode.rb', line 103 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.
95 96 97 |
# File 'lib/run_loop/xcode.rb', line 95 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.
87 88 89 |
# File 'lib/run_loop/xcode.rb', line 87 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.
79 80 81 |
# File 'lib/run_loop/xcode.rb', line 79 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.
71 72 73 |
# File 'lib/run_loop/xcode.rb', line 71 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.
63 64 65 |
# File 'lib/run_loop/xcode.rb', line 63 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.
55 56 57 |
# File 'lib/run_loop/xcode.rb', line 55 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.
47 48 49 |
# File 'lib/run_loop/xcode.rb', line 47 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.
39 40 41 |
# File 'lib/run_loop/xcode.rb', line 39 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.
31 32 33 |
# File 'lib/run_loop/xcode.rb', line 31 def v80 fetch_version(:v80) end |
#version ⇒ RunLoop::Version
Returns the current version of Xcode.
206 207 208 209 210 211 212 213 |
# File 'lib/run_loop/xcode.rb', line 206 def version @xcode_version ||= lambda do execute_command(['-version']) do |stdout, _, _| version_string = stdout.read.chomp[VERSION_REGEX, 0] RunLoop::Version.new(version_string) end end.call end |
#version_gte_51? ⇒ Boolean
2.1.0
Is the active Xcode version 5.1 or above?
197 198 199 200 |
# File 'lib/run_loop/xcode.rb', line 197 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?
182 183 184 |
# File 'lib/run_loop/xcode.rb', line 182 def version_gte_61? version >= v61 end |
#version_gte_62? ⇒ Boolean
Is the active Xcode version 6.2 or above?
175 176 177 |
# File 'lib/run_loop/xcode.rb', line 175 def version_gte_62? version >= v62 end |
#version_gte_63? ⇒ Boolean
Is the active Xcode version 6.3 or above?
168 169 170 |
# File 'lib/run_loop/xcode.rb', line 168 def version_gte_63? version >= v63 end |
#version_gte_64? ⇒ Boolean
Is the active Xcode version 6.4 or above?
161 162 163 |
# File 'lib/run_loop/xcode.rb', line 161 def version_gte_64? version >= v64 end |
#version_gte_6? ⇒ Boolean
Is the active Xcode version 6 or above?
189 190 191 |
# File 'lib/run_loop/xcode.rb', line 189 def version_gte_6? version >= v60 end |
#version_gte_71? ⇒ Boolean
Is the active Xcode version 7.1 or above?
147 148 149 |
# File 'lib/run_loop/xcode.rb', line 147 def version_gte_71? version >= v71 end |
#version_gte_72? ⇒ Boolean
Is the active Xcode version 7.2 or above?
140 141 142 |
# File 'lib/run_loop/xcode.rb', line 140 def version_gte_72? version >= v72 end |
#version_gte_73? ⇒ Boolean
Is the active Xcode version 7.3 or above?
133 134 135 |
# File 'lib/run_loop/xcode.rb', line 133 def version_gte_73? version >= v73 end |
#version_gte_7? ⇒ Boolean
Is the active Xcode version 7 or above?
154 155 156 |
# File 'lib/run_loop/xcode.rb', line 154 def version_gte_7? version >= v70 end |
#version_gte_8? ⇒ Boolean
Is the active Xcode version 8.0 or above?
126 127 128 |
# File 'lib/run_loop/xcode.rb', line 126 def version_gte_8? version >= v80 end |