Class: RunLoop::Xcode

Inherits:
Object
  • Object
show all
Defined in:
lib/run_loop/xcode.rb

Overview

Note:

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

Instance Method Details

#beta?Boolean

Note:

Relies on Xcode beta versions having and app bundle named Xcode-Beta.app

Is this a beta version of Xcode?

Returns:

  • (Boolean)

    True if the Xcode version is beta.



172
173
174
# File 'lib/run_loop/xcode.rb', line 172

def beta?
  developer_dir[/Xcode-[Bb]eta.app/, 0]
end

#developer_dirString

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.

Returns:

  • (String)

    path to current developer directory



189
190
191
192
193
194
195
196
# File 'lib/run_loop/xcode.rb', line 189

def developer_dir
  @xcode_developer_dir ||=
        if RunLoop::Environment.developer_dir
          RunLoop::Environment.developer_dir
        else
          xcode_select_path
        end
end

#inspectObject

Returns debug String representation



23
24
25
# File 'lib/run_loop/xcode.rb', line 23

def inspect
  to_s
end

#to_sObject

Returns a String representation.



18
19
20
# File 'lib/run_loop/xcode.rb', line 18

def to_s
  "#<Xcode #{version.to_s}>"
end

#v50RunLoop::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.

Returns:



95
96
97
# File 'lib/run_loop/xcode.rb', line 95

def v50
  fetch_version(:v50)
end

#v51RunLoop::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.

Returns:



87
88
89
# File 'lib/run_loop/xcode.rb', line 87

def v51
  fetch_version(:v51)
end

#v60RunLoop::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.

Returns:



79
80
81
# File 'lib/run_loop/xcode.rb', line 79

def v60
  fetch_version(:v60)
end

#v61RunLoop::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.

Returns:



71
72
73
# File 'lib/run_loop/xcode.rb', line 71

def v61
  fetch_version(:v61)
end

#v62RunLoop::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.

Returns:



63
64
65
# File 'lib/run_loop/xcode.rb', line 63

def v62
  fetch_version(:v62)
end

#v63RunLoop::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.

Returns:



55
56
57
# File 'lib/run_loop/xcode.rb', line 55

def v63
  fetch_version(:v63)
end

#v64RunLoop::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.

Returns:



47
48
49
# File 'lib/run_loop/xcode.rb', line 47

def v64
  fetch_version(:v64)
end

#v70RunLoop::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.

Returns:



39
40
41
# File 'lib/run_loop/xcode.rb', line 39

def v70
  fetch_version(:v70)
end

#v71RunLoop::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.

Returns:



31
32
33
# File 'lib/run_loop/xcode.rb', line 31

def v71
  fetch_version(:v71)
end

#versionRunLoop::Version

Returns the current version of Xcode.

Returns:

  • (RunLoop::Version)

    The current version of Xcode as reported by xcrun xcodebuild -version.



159
160
161
162
163
164
165
166
# File 'lib/run_loop/xcode.rb', line 159

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

Is the active Xcode version 5.1 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 5.1



151
152
153
# File 'lib/run_loop/xcode.rb', line 151

def version_gte_51?
  version >= v51
end

#version_gte_61?Boolean

Is the active Xcode version 6.1 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 6.1



137
138
139
# File 'lib/run_loop/xcode.rb', line 137

def version_gte_61?
  version >= v61
end

#version_gte_62?Boolean

Is the active Xcode version 6.2 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 6.2



130
131
132
# File 'lib/run_loop/xcode.rb', line 130

def version_gte_62?
  version >= v62
end

#version_gte_63?Boolean

Is the active Xcode version 6.3 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 6.3



123
124
125
# File 'lib/run_loop/xcode.rb', line 123

def version_gte_63?
  version >= v63
end

#version_gte_64?Boolean

Is the active Xcode version 6.4 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 6.4



116
117
118
# File 'lib/run_loop/xcode.rb', line 116

def version_gte_64?
  version >= v64
end

#version_gte_6?Boolean

Is the active Xcode version 6 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 6.0



144
145
146
# File 'lib/run_loop/xcode.rb', line 144

def version_gte_6?
  version >= v60
end

#version_gte_71?Boolean

Is the active Xcode version 7.1 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 7.1



102
103
104
# File 'lib/run_loop/xcode.rb', line 102

def version_gte_71?
  version >= v71
end

#version_gte_7?Boolean

Is the active Xcode version 7 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 7.0



109
110
111
# File 'lib/run_loop/xcode.rb', line 109

def version_gte_7?
  version >= v70
end