aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-14 01:54:52 +0200
committerGitHub2016-09-14 01:54:52 +0200
commitb1746de260a92bf45aeaf4879fade750e731e67f (patch)
tree1cc662248b21120f325176e8c6274e9758c637a9 /Library
parentb505ee3fedc7309a4c1ba43ea304d7a0d3b70d80 (diff)
parent3b6d80913a36d7db64aa3aa11766c6ee72b0aa29 (diff)
downloadbrew-b1746de260a92bf45aeaf4879fade750e731e67f.tar.bz2
Merge pull request #940 from reitermarkus/fix-untapped-installation
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