Formula: handle bad tap runtime dependencies.
Also add some better exceptions for the cases that `nil`s end up getting passed around incorrectly.
This commit is contained in:
parent
a674a972a5
commit
6b817f775f
@ -10,6 +10,8 @@ class Dependency
|
|||||||
DEFAULT_ENV_PROC = proc {}
|
DEFAULT_ENV_PROC = proc {}
|
||||||
|
|
||||||
def initialize(name, tags = [], env_proc = DEFAULT_ENV_PROC, option_names = [name])
|
def initialize(name, tags = [], env_proc = DEFAULT_ENV_PROC, option_names = [name])
|
||||||
|
raise ArgumentError, "Dependency must have a name!" unless name
|
||||||
|
|
||||||
@name = name
|
@name = name
|
||||||
@tags = tags
|
@tags = tags
|
||||||
@env_proc = env_proc
|
@env_proc = env_proc
|
||||||
|
|||||||
@ -1522,7 +1522,10 @@ class Formula
|
|||||||
if read_from_tab &&
|
if read_from_tab &&
|
||||||
(keg = opt_or_installed_prefix_keg) &&
|
(keg = opt_or_installed_prefix_keg) &&
|
||||||
(tab_deps = keg.runtime_dependencies)
|
(tab_deps = keg.runtime_dependencies)
|
||||||
return tab_deps.map { |d| Dependency.new d["full_name"] }.compact
|
return tab_deps.map do |d|
|
||||||
|
next unless d["full_name"]
|
||||||
|
Dependency.new d["full_name"]
|
||||||
|
end.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
declared_runtime_dependencies | undeclared_runtime_dependencies
|
declared_runtime_dependencies | undeclared_runtime_dependencies
|
||||||
|
|||||||
@ -277,6 +277,7 @@ module Formulary
|
|||||||
# * a formula URL
|
# * a formula URL
|
||||||
# * a local bottle reference
|
# * a local bottle reference
|
||||||
def self.factory(ref, spec = :stable, alias_path: nil, from: nil)
|
def self.factory(ref, spec = :stable, alias_path: nil, from: nil)
|
||||||
|
raise ArgumentError, "Formulae must have a ref!" unless ref
|
||||||
loader_for(ref, from: from).get_formula(spec, alias_path: alias_path)
|
loader_for(ref, from: from).get_formula(spec, alias_path: alias_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user