From 1f18a74056c0c9e3a842564d2d15c87351f2f998 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 4 Oct 2014 08:23:28 -0400 Subject: [PATCH 1/2] comment/todo re: directory creation --- lib/cask.rb | 3 +++ 1 file changed, 3 insertions(+) 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? From f86ea4c7a4b2a1c7d0945f6ebf162aa721bc96fa Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 4 Oct 2014 08:24:21 -0400 Subject: [PATCH 2/2] show staging directory (caskroom) in doctor refs #6471 --- lib/cask/cli/doctor.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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}"