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:

  • cmd (Version) (defaults to: nil)

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

Returns:

  • (String, Array, Version)

    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:

  • (ArgumentError)

    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}


264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/run_loop/xctools.rb', line 264

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:

  • version (String, Version) (defaults to: instruments(:version))

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

Returns:

  • (Boolean)

    true if the version is >= 5.*



299
300
301
302
303
304
305
306
307
308
309
# File 'lib/run_loop/xctools.rb', line 299

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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

#v71RunLoop::Version

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

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:



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

def v71
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.v71
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:

  • (String)

    path to current developer directory



211
212
213
214
# File 'lib/run_loop/xctools.rb', line 211

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:

  • (Boolean)

    True if the Xcode version is beta.



221
222
223
224
# File 'lib/run_loop/xctools.rb', line 221

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:

  • (RunLoop::Version)

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



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

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:

  • (Boolean)

    true if the current Xcode version is >= 5.1



182
183
184
185
# File 'lib/run_loop/xctools.rb', line 182

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:

  • (Boolean)

    true if the current Xcode version is >= 6.1



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

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:

  • (Boolean)

    true if the current Xcode version is >= 6.2



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

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:

  • (Boolean)

    true if the current Xcode version is >= 6.3



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

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:

  • (Boolean)

    true if the current Xcode version is >= 6.4



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

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:

  • (Boolean)

    true if the current Xcode version is >= 6.0



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

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

#xcode_version_gte_71?Boolean

Deprecated.

Since 1.5.0 - replaced with RunLoop::Xcode

Are we running Xcode 7.1 or above?

Returns:

  • (Boolean)

    true if the current Xcode version is >= 7.1



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

def xcode_version_gte_71?
  RunLoop.deprecated('1.5.0', 'Replaced with RunLoop::Xcode')
  xcode.version_gte_71?
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:

  • (Boolean)

    true if the current Xcode version is >= 7.0



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

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