Class: CaskDependent

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/cask_dependent.rb

Overview

An adapter for casks to provide dependency information in a formula-like interface

Instance Method Summary collapse

Constructor Details

#initialize(cask) ⇒ CaskDependent

Returns a new instance of CaskDependent.


5
6
7
# File 'Library/Homebrew/cask_dependent.rb', line 5

def initialize(cask)
  @cask = cask
end

Instance Method Details

#any_version_installed?Boolean

Returns:

  • (Boolean)

56
57
58
# File 'Library/Homebrew/cask_dependent.rb', line 56

def any_version_installed?
  @cask.installed?
end

#depsObject


21
22
23
24
25
26
27
# File 'Library/Homebrew/cask_dependent.rb', line 21

def deps
  @deps ||= begin
    @cask.depends_on.formula.map do |f|
      Dependency.new f
    end
  end
end

#full_nameObject


13
14
15
# File 'Library/Homebrew/cask_dependent.rb', line 13

def full_name
  @cask.full_name
end

#nameObject


9
10
11
# File 'Library/Homebrew/cask_dependent.rb', line 9

def name
  @cask.token
end

#recursive_dependencies(&block) ⇒ Object


48
49
50
# File 'Library/Homebrew/cask_dependent.rb', line 48

def recursive_dependencies(&block)
  Dependency.expand(self, &block)
end

#recursive_requirements(&block) ⇒ Object


52
53
54
# File 'Library/Homebrew/cask_dependent.rb', line 52

def recursive_requirements(&block)
  Requirement.expand(self, &block)
end

#requirementsObject


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'Library/Homebrew/cask_dependent.rb', line 29

def requirements
  @requirements ||= begin
    requirements = []
    dsl_reqs = @cask.depends_on

    dsl_reqs.arch&.each do |arch|
      requirements << ArchRequirement.new([:x86_64]) if arch[:bits] == 64
      requirements << ArchRequirement.new([arch[:type]])
    end
    dsl_reqs.cask.each do |cask_ref|
      requirements << Requirement.new([{ cask: cask_ref }])
    end
    requirements << dsl_reqs.macos if dsl_reqs.macos
    requirements << X11Requirement.new if dsl_reqs.x11

    requirements
  end
end

#runtime_dependenciesObject


17
18
19
# File 'Library/Homebrew/cask_dependent.rb', line 17

def runtime_dependencies
  recursive_dependencies
end