Class: CaskDependent Private
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 ⇒ Object readonly private
Instance Method Summary collapse
- #any_version_installed? ⇒ Boolean private
- #deps ⇒ Object private
- #full_name ⇒ Object private
-
#initialize(cask) ⇒ CaskDependent
constructor
private
A new instance of CaskDependent.
- #name ⇒ Object private
- #recursive_dependencies(&block) ⇒ Object private
- #recursive_requirements(&block) ⇒ Object private
- #requirements ⇒ Object private
- #runtime_dependencies ⇒ Object private
Constructor Details
#initialize(cask) ⇒ CaskDependent
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 a new instance of CaskDependent.
17 18 19 |
# File 'cask_dependent.rb', line 17 def initialize(cask) @cask = cask end |
Instance Attribute Details
#cask ⇒ Object (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.
15 16 17 |
# File 'cask_dependent.rb', line 15 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.
75 76 77 |
# File 'cask_dependent.rb', line 75 def any_version_installed? @cask.installed? end |
#deps ⇒ Object
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.
33 34 35 36 37 |
# File 'cask_dependent.rb', line 33 def deps @deps ||= @cask.depends_on.formula.map do |f| Dependency.new f end end |
#full_name ⇒ Object
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.
25 26 27 |
# File 'cask_dependent.rb', line 25 def full_name @cask.full_name end |
#name ⇒ Object
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.
21 22 23 |
# File 'cask_dependent.rb', line 21 def name @cask.token end |
#recursive_dependencies(&block) ⇒ Object
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.
67 68 69 |
# File 'cask_dependent.rb', line 67 def recursive_dependencies(&block) Dependency.(self, &block) end |
#recursive_requirements(&block) ⇒ Object
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.
71 72 73 |
# File 'cask_dependent.rb', line 71 def recursive_requirements(&block) Requirement.(self, &block) end |
#requirements ⇒ Object
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.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'cask_dependent.rb', line 39 def requirements @requirements ||= 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.macos if dsl_reqs.macos requirements end end |
#runtime_dependencies ⇒ Object
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.
29 30 31 |
# File 'cask_dependent.rb', line 29 def runtime_dependencies deps.flat_map { |dep| [dep, *dep.to_formula.runtime_dependencies] }.uniq end |