Class: CaskDependent

Inherits:
Object
  • Object
show all
Defined in:
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.



6
7
8
# File 'cask_dependent.rb', line 6

def initialize(cask)
  @cask = cask
end

Instance Method Details

#any_version_installed?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'cask_dependent.rb', line 57

def any_version_installed?
  @cask.installed?
end

#depsObject



25
26
27
28
29
# File 'cask_dependent.rb', line 25

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

#full_nameObject



14
15
16
# File 'cask_dependent.rb', line 14

def full_name
  @cask.full_name
end

#nameObject



10
11
12
# File 'cask_dependent.rb', line 10

def name
  @cask.token
end

#recursive_dependencies(ignore_missing: false, &block) ⇒ Object



49
50
51
# File 'cask_dependent.rb', line 49

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

#recursive_requirements(&block) ⇒ Object



53
54
55
# File 'cask_dependent.rb', line 53

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

#requirementsObject



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

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
  end
end

#runtime_dependencies(ignore_missing: false) ⇒ Object



18
19
20
21
22
23
# File 'cask_dependent.rb', line 18

def runtime_dependencies(ignore_missing: false)
  recursive_dependencies(ignore_missing: ignore_missing).reject do |dependency|
    tags = dependency.tags
    tags.include?(:build) || tags.include?(:test)
  end
end