Class: RunLoop::XCTools Deprecated

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

Overview

Deprecated.

Since 1.5.0

TODO:

Refactor instruments related code to instruments class.

Note:

All command line tools are run in the context of xcrun.

The behaviors of this class are in the process of being refactored to other classes. Please do not implement any new behaviors in this class.

Callers should be updated ASAP.

A class for interacting with the Xcode tools.

Throughout this class’s documentation, there are references to the _current version of Xcode_. The current 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

#instruments(cmd = nil) ⇒ String, ...

Deprecated.

Since 1.5.0 - replaced with RunLoop::Instruments.

Method for interacting with instruments.

Examples:

Getting a runnable command for instruments

instruments #=> 'xcrun instruments'

Getting a the version of instruments.

instruments(:version) #=> 5.1.1 - a Version object

Getting list of known simulators.

instruments(:sims) #=> < list of known simulators >

Getting list of physical devices.

instruments(:devices) #> < list of physical devices >

Parameters:

  • (defaults to: nil)

    controls the return value. currently accepts nil, :sims, :templates, and :version as valid parameters

Returns:

  • based on the value of cmd version, a list known simulators, the version of current instruments tool, or the path to the instruments binary.

Raises:

  • if invalid cmd is passed

See Also:

  • RunLoop::XCTools.{RunLoop{RunLoop::Instruments{RunLoop::Instruments#version}
  • RunLoop::XCTools.{RunLoop{RunLoop::Instruments{RunLoop::Instruments#templates}
  • RunLoop::XCTools.{RunLoop{RunLoop::Instruments{RunLoop::Instruments#physical_devices}
  • RunLoop::XCTools.{RunLoop{RunLoop::Instruments{RunLoop::Instruments#simulators}


245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/run_loop/xctools.rb', line 245

def instruments(cmd=nil)
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Instruments')
  instruments = 'xcrun instruments'
  return instruments if cmd == nil

  case cmd
    when :version
      instruments_instance.version
    when :sims
      instruments_instance.simulators
    when :templates
      instruments_instance.templates
    when :devices
      instruments_instance.physical_devices
    else
      candidates = [:version, :sims, :devices]
      raise(ArgumentError, "expected '#{cmd}' to be one of '#{candidates}'")
  end
end

#instruments_supports_hyphen_s?(version = instruments(:version)) ⇒ Boolean

Deprecated.

Since 1.5.0 - no replacement.

All supported Xcode versions accept -s flag.

Does the instruments version accept the -s flag?

Examples:

instruments_supports_hyphen_s?('4.6.3') => false
instruments_supports_hyphen_s?('5.0.2') => true
instruments_supports_hyphen_s?('5.1')   => true

Parameters:

  • (defaults to: instruments(:version))

    (instruments(:version)) a major.minor version string or a Version object

Returns:

  • true if the version is >= 5.*



280
281
282
283
284
285
286
287
288
289
290
# File 'lib/run_loop/xctools.rb', line 280

def instruments_supports_hyphen_s?(version=instruments(:version))
  RunLoop.deprecated('1.5.0', 'Not replaced.')
  @instruments_supports_hyphen_s ||= lambda {
    if version.is_a? String
      _version = RunLoop::Version.new(version)
    else
      _version = version
    end
    _version >= RunLoop::Version.new('5.1')
  }.call
end

#v50RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • 5.0



100
101
102
103
# File 'lib/run_loop/xctools.rb', line 100

def v50
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v50
end

#v51RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • 5.1



90
91
92
93
# File 'lib/run_loop/xctools.rb', line 90

def v51
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v51
end

#v60RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • 6.0



80
81
82
83
# File 'lib/run_loop/xctools.rb', line 80

def v60
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v60
end

#v61RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • 6.1



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

def v61
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v61
end

#v62RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • 6.2



60
61
62
63
# File 'lib/run_loop/xctools.rb', line 60

def v62
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v62
end

#v63RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • 6.3



50
51
52
53
# File 'lib/run_loop/xctools.rb', line 50

def v63
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v63
end

#v64RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • 6.4



40
41
42
43
# File 'lib/run_loop/xctools.rb', line 40

def v64
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v64
end

#v70RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • 7.0



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

def v70
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v70
end

#xcode_developer_dirString Also known as: developer_dir

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:

  • path to current developer directory



192
193
194
195
# File 'lib/run_loop/xctools.rb', line 192

def xcode_developer_dir
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.developer_dir
end

#xcode_is_beta?Boolean Also known as: beta?

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Note:

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

Is this a beta version of Xcode?

Returns:

  • True if the Xcode version is beta.



202
203
204
205
# File 'lib/run_loop/xctools.rb', line 202

def xcode_is_beta?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.beta?
end

#xcode_versionRunLoop::Version Also known as: version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Returns the current version of Xcode.

Returns:

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



173
174
175
176
# File 'lib/run_loop/xctools.rb', line 173

def xcode_version
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version
end

#xcode_version_gte_51?Boolean Also known as: version_gte_51?

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Are we running Xcode 5.1 or above?

Returns:

  • true if the current Xcode version is >= 5.1



163
164
165
166
# File 'lib/run_loop/xctools.rb', line 163

def xcode_version_gte_51?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version_gte_51?
end

#xcode_version_gte_61?Boolean Also known as: version_gte_61?

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Are we running Xcode 6.1 or above?

Returns:

  • true if the current Xcode version is >= 6.1



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

def xcode_version_gte_61?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version_gte_61?
end

#xcode_version_gte_62?Boolean Also known as: version_gte_62?

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Are we running Xcode 6.2 or above?

Returns:

  • true if the current Xcode version is >= 6.2



127
128
129
130
# File 'lib/run_loop/xctools.rb', line 127

def xcode_version_gte_62?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version_gte_62?
end

#xcode_version_gte_63?Boolean Also known as: version_gte_63?

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Are we running Xcode 6.3 or above?

Returns:

  • true if the current Xcode version is >= 6.3



118
119
120
121
# File 'lib/run_loop/xctools.rb', line 118

def xcode_version_gte_63?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version_gte_63?
end

#xcode_version_gte_64?Boolean Also known as: version_gte_64?

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Are we running Xcode 6.4 or above?

Returns:

  • true if the current Xcode version is >= 6.4



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

def xcode_version_gte_64?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version_gte_64?
end

#xcode_version_gte_6?Boolean Also known as: version_gte_6?

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Are we running Xcode 6 or above?

Returns:

  • true if the current Xcode version is >= 6.0



145
146
147
148
# File 'lib/run_loop/xctools.rb', line 145

def xcode_version_gte_6?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version_gte_6?
end

#xcode_version_gte_7?Boolean Also known as: version_gte_7?

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Are we running Xcode 7 or above?

Returns:

  • true if the current Xcode version is >= 7.0



154
155
156
157
# File 'lib/run_loop/xctools.rb', line 154

def xcode_version_gte_7?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version_gte_7?
end