2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-11-03 08:37:06 +10:00
|
|
|
require "system_config"
|
2020-07-10 10:36:59 -04:00
|
|
|
require "diagnostic"
|
2017-11-03 08:37:06 +10:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
module Cask
|
2018-09-04 08:45:48 +01:00
|
|
|
class Cmd
|
2017-05-20 19:08:03 +02:00
|
|
|
class Doctor < AbstractCommand
|
2017-05-21 00:15:56 +02:00
|
|
|
def initialize(*)
|
|
|
|
super
|
|
|
|
return if args.empty?
|
2018-09-17 02:45:00 +02:00
|
|
|
|
2017-05-21 00:15:56 +02:00
|
|
|
raise ArgumentError, "#{self.class.command_name} does not take arguments."
|
|
|
|
end
|
|
|
|
|
2017-12-02 00:53:54 +00:00
|
|
|
def summary_header
|
2018-01-29 13:43:21 +00:00
|
|
|
"Cask's Doctor Checkup"
|
2017-12-02 00:53:54 +00:00
|
|
|
end
|
|
|
|
|
2017-05-21 00:15:56 +02:00
|
|
|
def run
|
2020-07-10 10:36:59 -04:00
|
|
|
success = true
|
2017-12-02 00:53:54 +00:00
|
|
|
|
2020-07-10 10:36:59 -04:00
|
|
|
checks = Homebrew::Diagnostic::Checks.new true
|
|
|
|
checks.cask_checks.each do |check|
|
|
|
|
out = checks.send(check)
|
2019-10-01 11:17:27 +00:00
|
|
|
|
2020-07-10 10:36:59 -04:00
|
|
|
if out.present?
|
|
|
|
success = false
|
|
|
|
puts out
|
2019-10-01 11:17:27 +00:00
|
|
|
end
|
2018-09-17 20:11:11 +02:00
|
|
|
end
|
|
|
|
|
2020-07-10 10:36:59 -04:00
|
|
|
raise CaskError, "There are some problems with your setup." unless success
|
2017-02-04 21:52:04 +01:00
|
|
|
end
|
|
|
|
|
2016-09-24 13:52:43 +02:00
|
|
|
def self.help
|
|
|
|
"checks for configuration issues"
|
|
|
|
end
|
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|