diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index e5e140d361f248cfca69f4ebeafe9839184d6058..5f6611dfc5093f3bab70cac9e36f36bd80397797 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -57,6 +57,12 @@ module Homebrew elsif dep.build? Dependency.prune unless includes.include?("build?") end + + # If a tap isn't installed, we can't find the dependencies of one + # its formulae, and an exception will be thrown if we try. + if dep.is_a?(TapDependency) && !dep.tap.installed? + Dependency.keep_but_prune_recursive_deps + end end dep_formulae = deps.map do |dep| diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index 253ba4bee7683d3b9b57f5e160866c5ce0df0545..4a452440a7783428c4b49489cbe8ed7f31a88ffc 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -175,7 +175,7 @@ class TapDependency < Dependency attr_reader :tap def initialize(name, tags = [], env_proc = DEFAULT_ENV_PROC, option_names = [name.split("/").last]) - @tap = name.rpartition("/").first + @tap = Tap.fetch(name.rpartition("/").first) super(name, tags, env_proc, option_names) end diff --git a/Library/Homebrew/test/dependency_test.rb b/Library/Homebrew/test/dependency_test.rb index 65255995ec0460ccd2cc0707d43336e19557d024..134e91d1306edc5d6b04b5ed6a9d931846328db7 100644 --- a/Library/Homebrew/test/dependency_test.rb +++ b/Library/Homebrew/test/dependency_test.rb @@ -118,6 +118,11 @@ class DependencyTests < Homebrew::TestCase end class TapDependencyTests < Homebrew::TestCase + def test_tap + dep = TapDependency.new("foo/bar/dog") + assert_equal Tap.new("foo", "bar"), dep.tap + end + def test_option_names dep = TapDependency.new("foo/bar/dog") assert_equal %w[dog], dep.option_names