diff --git a/lib/cask.rb b/lib/cask.rb index fe926891c..2c02a84c1 100644 --- a/lib/cask.rb +++ b/lib/cask.rb @@ -47,6 +47,9 @@ class Cask def self.init set_up_taps + # todo: Creating directories should be deferred until needed. + # Currently this fire and even asks for sudo password + # if a first-time user simply runs "brew cask --help". odebug 'Creating directories' HOMEBREW_CACHE.mkpath unless HOMEBREW_CACHE.exist? HOMEBREW_CACHE_CASKS.mkpath unless HOMEBREW_CACHE_CASKS.exist? diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 0604da3da..f12057ae1 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -11,6 +11,7 @@ class Cask::CLI::Doctor < Cask::CLI::Base ohai 'Homebrew Origin:', render_with_none_as_error( homebrew_origin ) ohai 'Homebrew-cask Version:', render_with_none_as_error( HOMEBREW_CASK_VERSION ) ohai 'Homebrew-cask Install Location:', render_install_location( HOMEBREW_CASK_VERSION ) + ohai 'Homebrew-cask Staging Location:', render_staging_location( Cask.caskroom ) ohai 'Homebrew-cask Cached Downloads:', render_cached_downloads ohai 'Homebrew-cask Default Tap Path:', render_tap_paths( fq_default_tap ) ohai 'Homebrew-cask Alternate Cask Taps:', render_tap_paths( alt_taps ) @@ -150,6 +151,17 @@ class Cask::CLI::Doctor < Cask::CLI::Base end end + def self.render_staging_location(path) + path = Pathname.new(path) + if !path.exist? + %Q{#{path} #{error_string %Q{error: path does not exist}}} + elsif !path.writable? + %Q{#{path} #{error_string %Q{error: not writable by current user}}} + else + path + end + end + def self.render_load_path(paths) if paths.nil? or paths.size == 0 return "#{none_string} #{error_string}"