Spec-Zone.ru › Homebrew

Class: CaskDependent Private

Inherits:
Object
  • Object
  • CaskDependent
show all
Defined in:
cask_dependent.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

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

Defined Under Namespace

Classes: Requirement

Instance Attribute Summary collapse

  • #cask ⇒ Cask::Cask readonly private

Instance Method Summary collapse

  • #any_version_installed? ⇒ Boolean private
  • #deps ⇒ Array<Dependency> private
  • #full_name ⇒ String private
  • #initialize(cask) ⇒ void constructor private
  • #name ⇒ String private
  • #recursive_dependencies(&block) ⇒ Array<::Dependency> private
  • #recursive_requirements(&block) ⇒ Requirements private
  • #requirements ⇒ Array<::Requirement> private
  • #runtime_dependencies(read_from_tab: true, undeclared: true) ⇒ Array<Dependency> private

Constructor Details

#initialize(cask) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • cask (Cask::Cask)


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

def initialize(cask)
  @cask = cask
end

Instance Attribute Details

#cask ⇒ Cask::Cask (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Cask::Cask)


24
25
26
# File 'cask_dependent.rb', line 24

def cask
  @cask
end

Instance Method Details

#any_version_installed? ⇒ Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


113
114
115
# File 'cask_dependent.rb', line 113

def any_version_installed?
  @cask.installed?
end

#deps ⇒ Array<Dependency>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Array<Dependency>)


49
50
51
52
53
54
55
56
# File 'cask_dependent.rb', line 49

def deps
  @deps ||= T.let(
    @cask.depends_on.formula.map do |f|
      Dependency.new f
    end,
    T.nilable(T::Array[Dependency]),
  )
end

#full_name ⇒ String

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (String)


37
38
39
# File 'cask_dependent.rb', line 37

def full_name
  @cask.full_name
end

#name ⇒ String

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (String)


32
33
34
# File 'cask_dependent.rb', line 32

def name
  @cask.token
end

#recursive_dependencies(&block) ⇒ Array<::Dependency>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • block (T.proc.params(arg0: T.any(Formula, CaskDependent, SoftwareSpec), arg1: ::Dependency).returns(T.nilable(Symbol)), nil)

Returns:

  • (Array<::Dependency>)


98
99
100
# File 'cask_dependent.rb', line 98

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

#recursive_requirements(&block) ⇒ Requirements

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • block (T.proc.params(arg0: T.any(Formula, CaskDependent, SoftwareSpec), arg1: ::Requirement).returns(T.nilable(Symbol)), nil)

Returns:

  • (Requirements)


108
109
110
# File 'cask_dependent.rb', line 108

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

#requirements ⇒ Array<::Requirement>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Array<::Requirement>)


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'cask_dependent.rb', line 59

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

      dsl_reqs.arch&.each do |arch|
        arch = if arch[:bits] == 64
          if arch[:type] == :intel
            :x86_64
          else
            :"#{arch[:type]}64"
          end
        elsif arch[:type] == :intel && arch[:bits] == 32
          :i386
        else
          arch[:type]
        end
        requirements << ArchRequirement.new([arch])
      end
      dsl_reqs.cask.each do |cask_ref|
        requirements << CaskDependent::Requirement.new([{ cask: cask_ref }])
      end
      requirements << dsl_reqs.linux if dsl_reqs.linux
      requirements << dsl_reqs.macos if dsl_reqs.macos
      requirements << dsl_reqs.maximum_macos if dsl_reqs.maximum_macos

      requirements
    end,
    T.nilable(T::Array[::Requirement]),
  )
end

#runtime_dependencies(read_from_tab: true, undeclared: true) ⇒ Array<Dependency>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • read_from_tab (Boolean) (defaults to: true)
  • undeclared (Boolean) (defaults to: true)

Returns:

  • (Array<Dependency>)


42
43
44
45
46
# File 'cask_dependent.rb', line 42

def runtime_dependencies(read_from_tab: true, undeclared: true)
  deps.flat_map do |dep|
    [dep, *dep.to_installed_formula.runtime_dependencies(read_from_tab:, undeclared:)]
  end.uniq
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/CaskDependent.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API