aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib
diff options
context:
space:
mode:
authorL. E. Segovia2017-11-03 19:09:53 -0300
committerL. E. Segovia2017-11-30 13:07:58 +0000
commit84e41194cb20c2a88d6c3cfcf51575fce6eb4f02 (patch)
treec85d6eb6f94e3a82689e2168b4f65ee5aea64d15 /Library/Homebrew/cask/lib
parent3d96cd156a0a6560b60bebe3b286af4aafbe5851 (diff)
downloadbrew-84e41194cb20c2a88d6c3cfcf51575fce6eb4f02.tar.bz2
Let Cask doctor exit with 1 via a CaskError
Diffstat (limited to 'Library/Homebrew/cask/lib')
-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