aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/exceptions.rb
diff options
context:
space:
mode:
authorXu Cheng2015-07-14 21:33:29 +0800
committerXu Cheng2015-07-19 12:10:33 +0800
commit140f8e3df780cee9d69c7d314d62ca0abe4a42de (patch)
tree7466661f52822a0d218ddbb0bca5cd0f9e740d30 /Library/Homebrew/exceptions.rb
parent86d04e94e9caacf4aba766dd31c1707749fb5f2b (diff)
downloadbrew-140f8e3df780cee9d69c7d314d62ca0abe4a42de.tar.bz2
improve TapLoader and TapFormulaUnavailableError
* Restore the ability to load formula by `user/homebrew-repo/foo`. * Only suggest to install tap when tap isn't installed. Closes Homebrew/homebrew#41705. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/exceptions.rb')
-rw-r--r--Library/Homebrew/exceptions.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index bad8d2c2d..5b3081767 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -51,17 +51,17 @@ class FormulaUnavailableError < RuntimeError
end
class TapFormulaUnavailableError < FormulaUnavailableError
- attr_reader :user, :repo, :shortname
+ attr_reader :tap
- def initialize name
- super
- @user, @repo, @shortname = name.split("/", 3)
+ def initialize tap, name
+ @tap = tap
+ super "#{tap}/#{name}"
end
- def to_s; <<-EOS.undent
- No available formula for #{shortname} #{dependent_s}
- Please tap it and then try again: brew tap #{user}/#{repo}
- EOS
+ def to_s
+ s = super
+ s += "\nPlease tap it and then try again: brew tap #{tap}" unless tap.installed?
+ s
end
end