Class: XcodeRequirement

Inherits:
Requirement show all
Defined in:
Library/Homebrew/requirements/xcode_requirement.rb

Constant Summary

Constants included from Dependable

Dependable::RESERVED_TAGS

Instance Attribute Summary

Attributes inherited from Requirement

#cask, #download, #name, #tags

Instance Method Summary collapse

Methods inherited from Requirement

#==, default_formula, #display_s, #env, env, #env_proc, expand, #fatal?, #hash, #modify_build_environment, #option_names, prune, prune?, #satisfied?, #satisfied_result_parent, satisfy

Methods included from BuildEnvironment::DSL

#env

Methods included from Dependable

#build?, #option_tags, #optional?, #options, #recommended?, #required?, #run?

Constructor Details

#initialize(tags = []) ⇒ XcodeRequirement

Returns a new instance of XcodeRequirement



8
9
10
11
# File 'Library/Homebrew/requirements/xcode_requirement.rb', line 8

def initialize(tags = [])
  @version = tags.find { |tag| tags.delete(tag) if tag =~ /(\d\.)+\d/ }
  super
end

Instance Method Details

#inspectObject



41
42
43
# File 'Library/Homebrew/requirements/xcode_requirement.rb', line 41

def inspect
  "#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end

#messageObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'Library/Homebrew/requirements/xcode_requirement.rb', line 19

def message
  version = " #{@version}" if @version
  message = <<~EOS
    A full installation of Xcode.app#{version} is required to compile this software.
    Installing just the Command Line Tools is not sufficient.
  EOS
  if @version && Version.new(MacOS::Xcode.latest_version) < Version.new(@version)
    message + <<~EOS
      Xcode#{version} cannot be installed on macOS #{MacOS.version}.
      You must upgrade your version of macOS.
    EOS
  elsif MacOS.version >= :lion
    message + <<~EOS
      Xcode can be installed from the App Store.
    EOS
  else
    message + <<~EOS
      Xcode can be installed from #{Formatter.url("https://developer.apple.com/download/more/")}.
    EOS
  end
end

#xcode_installed_versionObject



13
14
15
16
17
# File 'Library/Homebrew/requirements/xcode_requirement.rb', line 13

def xcode_installed_version
  return false unless MacOS::Xcode.installed?
  return true unless @version
  MacOS::Xcode.version >= @version
end