aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/doctor.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
index d7bcf1537..e439c871b 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -3,6 +3,8 @@ require "system_config"
module Hbc
class CLI
class Doctor < AbstractCommand
+ attr_accessor :failed
+
def initialize(*)
super
return if args.empty?
@@ -35,6 +37,8 @@ module Hbc
]
(self.class.locale_variables + environment_variables).sort.each(&self.class.method(:render_env_var))
+
+ raise CaskError, "One or more checks failed." if @failed
end
def self.locale_variables
@@ -61,6 +65,7 @@ module Hbc
def self.cask_count_for_tap(tap)
Formatter.pluralize(tap.cask_files.count, "cask")
rescue StandardError
+ @failed = true
"0 #{error_string "error reading #{tap.path}"}"
end
@@ -92,6 +97,7 @@ module Hbc
if locations.empty?
none_string
else
+ @failed = true
locations.collect do |l|
"#{l} #{error_string 'error: legacy install. Run "brew uninstall --force brew-cask".'}"
end
@@ -101,8 +107,10 @@ module Hbc
def self.render_staging_location(path)
path = Pathname.new(user_tilde(path.to_s))
if !path.exist?
+ @failed = true
"#{path} #{error_string "error: path does not exist"}"
elsif !path.writable?
+ @failed = true
"#{path} #{error_string "error: not writable by current user"}"
else
path