aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-12 06:18:55 +0200
committerMarkus Reiter2016-09-12 06:21:16 +0200
commit3b6d80913a36d7db64aa3aa11766c6ee72b0aa29 (patch)
tree22ef40d1560af15d30f027282eab4a2d488a29fa /Library
parent2b45ae483199d846b84fea4826b2a20fe74d1dbe (diff)
downloadbrew-3b6d80913a36d7db64aa3aa11766c6ee72b0aa29.tar.bz2
Fix cask installation from untapped Tap not working.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb14
-rw-r--r--Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb9
2 files changed, 16 insertions, 7 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb b/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb
index 48f8501e5..1da013db2 100644
--- a/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb
+++ b/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb
@@ -2,11 +2,21 @@ require "hbc/source/tapped"
class Hbc::Source::TappedQualified < Hbc::Source::Tapped
def self.me?(query)
- !Hbc::QualifiedToken.parse(query).nil? && path_for_query(query).exist?
+ return if (tap = tap_for_query(query)).nil?
+
+ tap.installed? && path_for_query(query).exist?
+ end
+
+ def self.tap_for_query(query)
+ qualified_token = Hbc::QualifiedToken.parse(query)
+ return if qualified_token.nil?
+
+ user, repo, token = qualified_token
+ Tap.fetch(user, repo)
end
def self.path_for_query(query)
user, repo, token = Hbc::QualifiedToken.parse(query)
- Tap.new(user, repo).cask_dir.join(token.sub(%r{(\.rb)?$}i, ".rb"))
+ Tap.fetch(user, repo).cask_dir.join(token.sub(%r{(\.rb)?$}i, ".rb"))
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb b/Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb
index 361919bb3..7188d34ce 100644
--- a/Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb
+++ b/Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb
@@ -1,11 +1,10 @@
require "hbc/source/tapped_qualified"
class Hbc::Source::UntappedQualified < Hbc::Source::TappedQualified
- def self.path_for_query(query)
- user, repo, token = Hbc::QualifiedToken.parse(query)
+ def self.me?(query)
+ return if (tap = tap_for_query(query)).nil?
- tap = Tap.fetch(user, repo)
- tap.install unless tap.installed?
- tap.cask_dir.join(token.sub(%r{(\.rb)?$}i, ".rb"))
+ tap.install
+ tap.installed? && path_for_query(query).exist?
end
end