Skip to content

Instantly share code, notes, and snippets.

@wendorf
Created July 20, 2017 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wendorf/10619660bcba7c8450f91bce7df32809 to your computer and use it in GitHub Desktop.
Save wendorf/10619660bcba7c8450f91bce7df32809 to your computer and use it in GitHub Desktop.
diff --git a/Library/Homebrew/cask/lib/hbc/scopes.rb b/Library/Homebrew/cask/lib/hbc/scopes.rb
index a469ae0fa6..342ae86dee 100644
--- a/Library/Homebrew/cask/lib/hbc/scopes.rb
+++ b/Library/Homebrew/cask/lib/hbc/scopes.rb
@@ -9,8 +9,12 @@ module Hbc
all_tokens.map(&CaskLoader.public_method(:load))
end
+ def all_tapped_cask_taps
+ Tap.select { |t| t.cask_dir.directory? }
+ end
+
def all_tapped_cask_dirs
- Tap.map(&:cask_dir).select(&:directory?)
+ all_tapped_cask_taps.map(&:cask_dir)
end
def all_tokens
@@ -31,12 +35,12 @@ module Hbc
.map do |caskroom_path|
token = caskroom_path.basename.to_s
- path_to_cask = all_tapped_cask_dirs.find do |tap_dir|
- tap_dir.join("#{token}.rb").exist?
+ tap = all_tapped_cask_taps.find do |tap|
+ tap.cask_dir.join("#{token}.rb").exist?
end
- if path_to_cask
- CaskLoader.load(path_to_cask.join("#{token}.rb"))
+ if tap
+ CaskLoader.load("#{tap.name}/#{token}")
else
CaskLoader.load(token)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment