aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJosh Hagins2016-10-17 23:46:23 -0400
committerJosh Hagins2016-10-18 19:19:33 -0400
commitb4fc4acc09c469407db4ec41dd427f554656cc2d (patch)
treeeaa51be99b67021c7a365158c8b47c1e1a1191c9 /Library
parent63122c241ce5c46e8201fe55773632e11e7eb187 (diff)
downloadbrew-b4fc4acc09c469407db4ec41dd427f554656cc2d.tar.bz2
hbc/locations: arg is file only if absolute or .rb file
Handle the case when an argument passed to `brew cask` is both the name of a Cask and a non-Cask file in the current working directory. Fixes https://github.com/caskroom/homebrew-cask/issues/25611.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/locations.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb
index c763b974b..f1c7d138b 100644
--- a/Library/Homebrew/cask/lib/hbc/locations.rb
+++ b/Library/Homebrew/cask/lib/hbc/locations.rb
@@ -133,9 +133,8 @@ module Hbc
def path(query)
query_path = Pathname.new(query)
- if query_path.exist? || query_path.absolute?
- return query_path
- end
+ return query_path if query_path.absolute?
+ return query_path if query_path.exist? && query_path.extname == ".rb"
query_without_extension = query.sub(%r{\.rb$}i, "")