From a517e25acde6033e06ce7c779ec202812d2bc6f0 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 10:11:31 -0400 Subject: [PATCH 01/16] abstract none_string in doctor --- lib/cask/cli/doctor.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 125a0a8946..35ebea86a4 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -34,7 +34,7 @@ class Cask::CLI::Doctor :stderr => :silence).strip end if homebrew_origin !~ %r{\S} - homebrew_origin = " #{Tty.red}(Error)#{Tty.reset}" + homebrew_origin = "#{none_string} #{Tty.red}(Error)#{Tty.reset}" elsif homebrew_origin !~ %r{(mxcl|Homebrew)/homebrew(\.git)?\Z} homebrew_origin.concat " #{Tty.red}(warning: nonstandard origin)#{Tty.reset}" end @@ -66,6 +66,10 @@ class Cask::CLI::Doctor ohai 'Running As Privileged User:', privileged_uid end + def self.none_string + '' + end + def self.help "checks for configuration issues" end From 1400b61acf7657cc0a9d2ae977a4d2c8b93aa227 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 10:20:56 -0400 Subject: [PATCH 02/16] abstract error_string in doctor --- lib/cask/cli/doctor.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 35ebea86a4..a1e778ab4f 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -8,7 +8,7 @@ class Cask::CLI::Doctor homebrew_origin = notfound_msg begin - privileged_uid = Process.euid == 0 ? "Yes #{Tty.red}(warning: not recommended)#{Tty.reset}" : 'No' + privileged_uid = Process.euid == 0 ? "Yes #{error_string 'warning: not recommended'}" : 'No' rescue StandardError; end begin @@ -24,7 +24,7 @@ class Cask::CLI::Doctor begin default_cask_count = HOMEBREW_REPOSITORY.join(fq_default_tap, 'Casks').children.count(&:file?) rescue StandardError - default_cask_count = "0 #{Tty.red}(Error reading #{fq_default_tap})#{Tty.reset}" + default_cask_count = "0 #{error_string %Q{Error reading #{fq_default_tap}}}" end begin @@ -34,12 +34,12 @@ class Cask::CLI::Doctor :stderr => :silence).strip end if homebrew_origin !~ %r{\S} - homebrew_origin = "#{none_string} #{Tty.red}(Error)#{Tty.reset}" + homebrew_origin = "#{none_string} #{error_string}" elsif homebrew_origin !~ %r{(mxcl|Homebrew)/homebrew(\.git)?\Z} - homebrew_origin.concat " #{Tty.red}(warning: nonstandard origin)#{Tty.reset}" + homebrew_origin.concat " #{error_string 'warning: nonstandard origin'}" end rescue StandardError - homebrew_origin = "#{Tty.red}Not Found - Error running git#{Tty.reset}" + homebrew_origin = error_string 'Not Found - Error running git' end ohai 'OS X Version:', MACOS_FULL_VERSION @@ -70,6 +70,10 @@ class Cask::CLI::Doctor '' end + def self.error_string(string='Error') + "#{Tty.red}(#{string})#{Tty.reset}" + end + def self.help "checks for configuration issues" end From f6011c85c9d3996f3ad9efbaa62170cb8817127a Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 10:36:26 -0400 Subject: [PATCH 03/16] render empty doctor values with --- lib/cask/cli/doctor.rb | 56 +++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index a1e778ab4f..ba0b3cb0d9 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -42,28 +42,28 @@ class Cask::CLI::Doctor homebrew_origin = error_string 'Not Found - Error running git' end - ohai 'OS X Version:', MACOS_FULL_VERSION - ohai "Hardware Architecture:", "#{Hardware::CPU.type}-#{Hardware::CPU.bits}" - ohai 'Ruby Version:', "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" - ohai 'Ruby Path:', RUBY_PATH - ohai 'Homebrew Version:', HOMEBREW_VERSION - ohai 'Homebrew Executable Path:', HOMEBREW_BREW_FILE - ohai 'Homebrew Cellar Path:', HOMEBREW_CELLAR - ohai 'Homebrew Repository Path:', HOMEBREW_REPOSITORY - ohai 'Homebrew Origin:', homebrew_origin - ohai 'Homebrew-cask Version:', HOMEBREW_CASK_VERSION - ohai 'Homebrew-cask Default Tap Path:', fq_default_tap - ohai 'Homebrew-cask Alternate Cask Taps:', alt_taps - ohai 'Homebrew-cask Default Tap Cask Count:', default_cask_count - ohai 'Contents of $LOAD_PATH:', $LOAD_PATH - ohai 'Contents of $RUBYLIB Environment Variable:', ENV['RUBYLIB'] - ohai 'Contents of $RUBYOPT Environment Variable:', ENV['RUBYOPT'] - ohai 'Contents of $RUBYPATH Environment Variable:', ENV['RUBYPATH'] - ohai 'Contents of $RBENV_VERSION Environment Variable:', ENV['RBENV_VERSION'] - ohai 'Contents of $GEM_HOME Environment Variable:', ENV['GEM_HOME'] - ohai 'Contents of $GEM_PATH Environment Variable:', ENV['GEM_PATH'] - ohai 'Contents of $BUNDLE_PATH Environment Variable:', ENV['BUNDLE_PATH'] - ohai 'Running As Privileged User:', privileged_uid + ohai 'OS X Version:', render_with_none_as_error( MACOS_FULL_VERSION ) + ohai "Hardware Architecture:", render_with_none_as_error( "#{Hardware::CPU.type}-#{Hardware::CPU.bits}" ) + ohai 'Ruby Version:', render_with_none_as_error( "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" ) + ohai 'Ruby Path:', render_with_none_as_error( RUBY_PATH ) + ohai 'Homebrew Version:', render_with_none_as_error( HOMEBREW_VERSION ) + ohai 'Homebrew Executable Path:', render_with_none_as_error( HOMEBREW_BREW_FILE ) + ohai 'Homebrew Cellar Path:', render_with_none_as_error( HOMEBREW_CELLAR ) + ohai 'Homebrew Repository Path:', render_with_none_as_error( HOMEBREW_REPOSITORY ) + 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 Default Tap Path:', render_with_none_as_error( fq_default_tap ) + ohai 'Homebrew-cask Alternate Cask Taps:', render_with_none( alt_taps ) + ohai 'Homebrew-cask Default Tap Cask Count:', render_with_none_as_error( default_cask_count ) + ohai 'Contents of $LOAD_PATH:', render_with_none_as_error( $LOAD_PATH ) + ohai 'Contents of $RUBYLIB Environment Variable:', render_with_none( ENV['RUBYLIB'] ) + ohai 'Contents of $RUBYOPT Environment Variable:', render_with_none( ENV['RUBYOPT'] ) + ohai 'Contents of $RUBYPATH Environment Variable:', render_with_none( ENV['RUBYPATH'] ) + ohai 'Contents of $RBENV_VERSION Environment Variable:', render_with_none( ENV['RBENV_VERSION'] ) + ohai 'Contents of $GEM_HOME Environment Variable:', render_with_none( ENV['GEM_HOME'] ) + ohai 'Contents of $GEM_PATH Environment Variable:', render_with_none( ENV['GEM_PATH'] ) + ohai 'Contents of $BUNDLE_PATH Environment Variable:', render_with_none( ENV['BUNDLE_PATH'] ) + ohai 'Running As Privileged User:', render_with_none_as_error( privileged_uid ) end def self.none_string @@ -74,6 +74,18 @@ class Cask::CLI::Doctor "#{Tty.red}(#{string})#{Tty.reset}" end + def self.render_with_none(string) + (string.nil? or not string.respond_to?(:to_s) or string.to_s.length == 0) ? + none_string : + string + end + + def self.render_with_none_as_error(string) + (string.nil? or not string.respond_to?(:to_s) or string.to_s.length == 0) ? + "#{none_string} #{error_string}" : + string + end + def self.help "checks for configuration issues" end From fc9e7299edda90c87e287f60e732bc43326a9db4 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 10:49:59 -0400 Subject: [PATCH 04/16] add locale variables to doctor references: #4677 --- lib/cask/cli/doctor.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index ba0b3cb0d9..aa2d9fed96 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -63,9 +63,14 @@ class Cask::CLI::Doctor ohai 'Contents of $GEM_HOME Environment Variable:', render_with_none( ENV['GEM_HOME'] ) ohai 'Contents of $GEM_PATH Environment Variable:', render_with_none( ENV['GEM_PATH'] ) ohai 'Contents of $BUNDLE_PATH Environment Variable:', render_with_none( ENV['BUNDLE_PATH'] ) + ohai 'Contents of Locale Environment Variables:', render_with_none( locale_variables ) ohai 'Running As Privileged User:', render_with_none_as_error( privileged_uid ) end + def self.locale_variables + ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect_concat { |v| %Q{#{v}="#{ENV[v]}"} }.sort + end + def self.none_string '' end From 9f2c773ed650000a7d1c4023c7bd6ac5e5624b68 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 10:51:32 -0400 Subject: [PATCH 05/16] move notfound_string to method --- lib/cask/cli/doctor.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index aa2d9fed96..6d775dad7a 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -1,11 +1,10 @@ class Cask::CLI::Doctor def self.run - notfound_msg = "#{Tty.red}Not Found - Unknown Error#{Tty.reset}" - fq_default_tap = notfound_msg - alt_taps = notfound_msg - default_cask_count = notfound_msg - privileged_uid = notfound_msg - homebrew_origin = notfound_msg + fq_default_tap = notfound_string + alt_taps = notfound_string + default_cask_count = notfound_string + privileged_uid = notfound_string + homebrew_origin = notfound_string begin privileged_uid = Process.euid == 0 ? "Yes #{error_string 'warning: not recommended'}" : 'No' @@ -75,6 +74,10 @@ class Cask::CLI::Doctor '' end + def self.notfound_string + "#{Tty.red}Not Found - Unknown Error#{Tty.reset}" + end + def self.error_string(string='Error') "#{Tty.red}(#{string})#{Tty.reset}" end From 8a5ad08dc8292057294784b55ce763fc7c66b57a Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 10:54:10 -0400 Subject: [PATCH 06/16] move privledged_uid to method in doctor --- lib/cask/cli/doctor.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 6d775dad7a..34ee21d735 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -3,13 +3,8 @@ class Cask::CLI::Doctor fq_default_tap = notfound_string alt_taps = notfound_string default_cask_count = notfound_string - privileged_uid = notfound_string homebrew_origin = notfound_string - begin - privileged_uid = Process.euid == 0 ? "Yes #{error_string 'warning: not recommended'}" : 'No' - rescue StandardError; end - begin fq_default_tap = HOMEBREW_REPOSITORY.join 'Library', 'Taps', Cask.default_tap rescue StandardError; end @@ -70,6 +65,14 @@ class Cask::CLI::Doctor ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect_concat { |v| %Q{#{v}="#{ENV[v]}"} }.sort end + def self.privileged_uid + privileged_uid = notfound_string + begin + privileged_uid = Process.euid == 0 ? "Yes #{error_string 'warning: not recommended'}" : 'No' + rescue StandardError; end + privileged_uid + end + def self.none_string '' end From c354e53cc3cd900db28a2feed425a115c1a2e70b Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 10:56:43 -0400 Subject: [PATCH 07/16] move fq_default_tap to method in doctor --- lib/cask/cli/doctor.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 34ee21d735..50534ecb85 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -1,14 +1,9 @@ class Cask::CLI::Doctor def self.run - fq_default_tap = notfound_string alt_taps = notfound_string default_cask_count = notfound_string homebrew_origin = notfound_string - begin - fq_default_tap = HOMEBREW_REPOSITORY.join 'Library', 'Taps', Cask.default_tap - rescue StandardError; end - begin alt_taps = Pathname.glob(HOMEBREW_REPOSITORY.join 'Library', 'Taps', '*', '*', 'Casks').map(&:dirname) - [fq_default_tap] @@ -61,6 +56,15 @@ class Cask::CLI::Doctor ohai 'Running As Privileged User:', render_with_none_as_error( privileged_uid ) end + def self.fq_default_tap + return @fq_default_tap if @fq_default_tap + @fq_default_tap = notfound_string + begin + @fq_default_tap = HOMEBREW_REPOSITORY.join 'Library', 'Taps', Cask.default_tap + rescue StandardError; end + @fq_default_tap + end + def self.locale_variables ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect_concat { |v| %Q{#{v}="#{ENV[v]}"} }.sort end From 8388d1c3ac12b608053ce06dde3f64fcb815528d Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 10:59:41 -0400 Subject: [PATCH 08/16] move alt_taps to method in doctor --- lib/cask/cli/doctor.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 50534ecb85..ed228e7ffc 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -1,15 +1,8 @@ class Cask::CLI::Doctor def self.run - alt_taps = notfound_string default_cask_count = notfound_string homebrew_origin = notfound_string - begin - alt_taps = Pathname.glob(HOMEBREW_REPOSITORY.join 'Library', 'Taps', '*', '*', 'Casks').map(&:dirname) - - [fq_default_tap] - alt_taps = nil unless alt_taps.length > 0 - rescue StandardError; end - begin default_cask_count = HOMEBREW_REPOSITORY.join(fq_default_tap, 'Casks').children.count(&:file?) rescue StandardError @@ -65,6 +58,16 @@ class Cask::CLI::Doctor @fq_default_tap end + def self.alt_taps + alt_taps = notfound_string + begin + alt_taps = Pathname.glob(HOMEBREW_REPOSITORY.join 'Library', 'Taps', '*', '*', 'Casks').map(&:dirname) - + [fq_default_tap] + alt_taps = nil unless alt_taps.length > 0 + rescue StandardError; end + alt_taps + end + def self.locale_variables ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect_concat { |v| %Q{#{v}="#{ENV[v]}"} }.sort end From 6a7cda5c24704717c00755ff4743969e91d1a68d Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 11:03:11 -0400 Subject: [PATCH 09/16] move default_cask_count to method in doctor --- lib/cask/cli/doctor.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index ed228e7ffc..aa1da054b6 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -1,14 +1,7 @@ class Cask::CLI::Doctor def self.run - default_cask_count = notfound_string homebrew_origin = notfound_string - begin - default_cask_count = HOMEBREW_REPOSITORY.join(fq_default_tap, 'Casks').children.count(&:file?) - rescue StandardError - default_cask_count = "0 #{error_string %Q{Error reading #{fq_default_tap}}}" - end - begin HOMEBREW_REPOSITORY.cd do homebrew_origin = Cask::SystemCommand.run('git', @@ -68,6 +61,16 @@ class Cask::CLI::Doctor alt_taps end + def self.default_cask_count + default_cask_count = notfound_string + begin + default_cask_count = HOMEBREW_REPOSITORY.join(fq_default_tap, 'Casks').children.count(&:file?) + rescue StandardError + default_cask_count = "0 #{error_string %Q{Error reading #{fq_default_tap}}}" + end + default_cask_count + end + def self.locale_variables ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect_concat { |v| %Q{#{v}="#{ENV[v]}"} }.sort end From 796104b78656935c407dcbfce89886323e12604b Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 11:05:15 -0400 Subject: [PATCH 10/16] move homebrew_origin to method in doctor --- lib/cask/cli/doctor.rb | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index aa1da054b6..eab294ab5b 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -1,21 +1,5 @@ class Cask::CLI::Doctor def self.run - homebrew_origin = notfound_string - - begin - HOMEBREW_REPOSITORY.cd do - homebrew_origin = Cask::SystemCommand.run('git', - :args => %w{config --get remote.origin.url}, - :stderr => :silence).strip - end - if homebrew_origin !~ %r{\S} - homebrew_origin = "#{none_string} #{error_string}" - elsif homebrew_origin !~ %r{(mxcl|Homebrew)/homebrew(\.git)?\Z} - homebrew_origin.concat " #{error_string 'warning: nonstandard origin'}" - end - rescue StandardError - homebrew_origin = error_string 'Not Found - Error running git' - end ohai 'OS X Version:', render_with_none_as_error( MACOS_FULL_VERSION ) ohai "Hardware Architecture:", render_with_none_as_error( "#{Hardware::CPU.type}-#{Hardware::CPU.bits}" ) @@ -71,6 +55,25 @@ class Cask::CLI::Doctor default_cask_count end + def self.homebrew_origin + homebrew_origin = notfound_string + begin + HOMEBREW_REPOSITORY.cd do + homebrew_origin = Cask::SystemCommand.run('git', + :args => %w{config --get remote.origin.url}, + :stderr => :silence).strip + end + if homebrew_origin !~ %r{\S} + homebrew_origin = "#{none_string} #{error_string}" + elsif homebrew_origin !~ %r{(mxcl|Homebrew)/homebrew(\.git)?\Z} + homebrew_origin.concat " #{error_string 'warning: nonstandard origin'}" + end + rescue StandardError + homebrew_origin = error_string 'Not Found - Error running git' + end + homebrew_origin + end + def self.locale_variables ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect_concat { |v| %Q{#{v}="#{ENV[v]}"} }.sort end From e6e5626bbc79e3de51e3bf588157671cc2ea0224 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 11:25:35 -0400 Subject: [PATCH 11/16] warning on old-style tap paths in doctor --- lib/cask/cli/doctor.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index eab294ab5b..3544e325b6 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -11,8 +11,8 @@ class Cask::CLI::Doctor ohai 'Homebrew Repository Path:', render_with_none_as_error( HOMEBREW_REPOSITORY ) 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 Default Tap Path:', render_with_none_as_error( fq_default_tap ) - ohai 'Homebrew-cask Alternate Cask Taps:', render_with_none( alt_taps ) + ohai 'Homebrew-cask Default Tap Path:', render_tap_paths( fq_default_tap ) + ohai 'Homebrew-cask Alternate Cask Taps:', render_tap_paths( alt_taps ) ohai 'Homebrew-cask Default Tap Cask Count:', render_with_none_as_error( default_cask_count ) ohai 'Contents of $LOAD_PATH:', render_with_none_as_error( $LOAD_PATH ) ohai 'Contents of $RUBYLIB Environment Variable:', render_with_none( ENV['RUBYLIB'] ) @@ -90,6 +90,10 @@ class Cask::CLI::Doctor '' end + def self.legacy_tap_pattern + %r{phinze} + end + def self.notfound_string "#{Tty.red}Not Found - Unknown Error#{Tty.reset}" end @@ -110,6 +114,19 @@ class Cask::CLI::Doctor string end + def self.render_tap_paths(paths) + paths = [ paths ] unless paths.respond_to?(:each) + paths.collect do |dir| + if (dir.nil? or dir.to_s.length == 0) then + none_string + elsif dir.to_s.match(legacy_tap_pattern) + dir.to_s.concat(" #{error_string 'Warning: legacy tap path'}") + else + dir.to_s + end + end + end + def self.help "checks for configuration issues" end From a9121320f86cbf01ad706c9f30b45e985dfdfaa5 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 11:32:15 -0400 Subject: [PATCH 12/16] add render_env_var in doctor add quoting --- lib/cask/cli/doctor.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 3544e325b6..6c82df9ca0 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -15,13 +15,13 @@ class Cask::CLI::Doctor ohai 'Homebrew-cask Alternate Cask Taps:', render_tap_paths( alt_taps ) ohai 'Homebrew-cask Default Tap Cask Count:', render_with_none_as_error( default_cask_count ) ohai 'Contents of $LOAD_PATH:', render_with_none_as_error( $LOAD_PATH ) - ohai 'Contents of $RUBYLIB Environment Variable:', render_with_none( ENV['RUBYLIB'] ) - ohai 'Contents of $RUBYOPT Environment Variable:', render_with_none( ENV['RUBYOPT'] ) - ohai 'Contents of $RUBYPATH Environment Variable:', render_with_none( ENV['RUBYPATH'] ) - ohai 'Contents of $RBENV_VERSION Environment Variable:', render_with_none( ENV['RBENV_VERSION'] ) - ohai 'Contents of $GEM_HOME Environment Variable:', render_with_none( ENV['GEM_HOME'] ) - ohai 'Contents of $GEM_PATH Environment Variable:', render_with_none( ENV['GEM_PATH'] ) - ohai 'Contents of $BUNDLE_PATH Environment Variable:', render_with_none( ENV['BUNDLE_PATH'] ) + ohai 'Contents of $RUBYLIB Environment Variable:', render_env_var( 'RUBYLIB' ) + ohai 'Contents of $RUBYOPT Environment Variable:', render_env_var( 'RUBYOPT' ) + ohai 'Contents of $RUBYPATH Environment Variable:', render_env_var( 'RUBYPATH' ) + ohai 'Contents of $RBENV_VERSION Environment Variable:', render_env_var( 'RBENV_VERSION' ) + ohai 'Contents of $GEM_HOME Environment Variable:', render_env_var( 'GEM_HOME' ) + ohai 'Contents of $GEM_PATH Environment Variable:', render_env_var( 'GEM_PATH' ) + ohai 'Contents of $BUNDLE_PATH Environment Variable:', render_env_var( 'BUNDLE_PATH' ) ohai 'Contents of Locale Environment Variables:', render_with_none( locale_variables ) ohai 'Running As Privileged User:', render_with_none_as_error( privileged_uid ) end @@ -127,6 +127,14 @@ class Cask::CLI::Doctor end end + def self.render_env_var(var) + if ENV.key?(var) + %Q{#{var}="#{ENV[var]}"} + else + none_string + end + end + def self.help "checks for configuration issues" end From c857f11965e2d83ddcfdb287033e12c7538be6f1 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 11:33:15 -0400 Subject: [PATCH 13/16] add PATH to doctor --- lib/cask/cli/doctor.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 6c82df9ca0..c7e075bc6a 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -22,6 +22,7 @@ class Cask::CLI::Doctor ohai 'Contents of $GEM_HOME Environment Variable:', render_env_var( 'GEM_HOME' ) ohai 'Contents of $GEM_PATH Environment Variable:', render_env_var( 'GEM_PATH' ) ohai 'Contents of $BUNDLE_PATH Environment Variable:', render_env_var( 'BUNDLE_PATH' ) + ohai 'Contents of $PATH Environment Variable:', render_env_var( 'PATH' ) ohai 'Contents of Locale Environment Variables:', render_with_none( locale_variables ) ohai 'Running As Privileged User:', render_with_none_as_error( privileged_uid ) end From 50841d3f865d19c67c76e97dbdc7fda8a8faffd1 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 11:34:45 -0400 Subject: [PATCH 14/16] whitespace --- lib/cask/cli/doctor.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index c7e075bc6a..43e8512177 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -1,6 +1,5 @@ class Cask::CLI::Doctor def self.run - ohai 'OS X Version:', render_with_none_as_error( MACOS_FULL_VERSION ) ohai "Hardware Architecture:", render_with_none_as_error( "#{Hardware::CPU.type}-#{Hardware::CPU.bits}" ) ohai 'Ruby Version:', render_with_none_as_error( "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" ) From 40215968ef7da2a625fe797040f8ac6d5583b67a Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 14:15:34 -0400 Subject: [PATCH 15/16] add $CHRUBY_VERSION to doctor --- lib/cask/cli/doctor.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 43e8512177..8e013b4eb9 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -18,6 +18,7 @@ class Cask::CLI::Doctor ohai 'Contents of $RUBYOPT Environment Variable:', render_env_var( 'RUBYOPT' ) ohai 'Contents of $RUBYPATH Environment Variable:', render_env_var( 'RUBYPATH' ) ohai 'Contents of $RBENV_VERSION Environment Variable:', render_env_var( 'RBENV_VERSION' ) + ohai 'Contents of $CHRUBY_VERSION Environment Variable:', render_env_var( 'CHRUBY_VERSION' ) ohai 'Contents of $GEM_HOME Environment Variable:', render_env_var( 'GEM_HOME' ) ohai 'Contents of $GEM_PATH Environment Variable:', render_env_var( 'GEM_PATH' ) ohai 'Contents of $BUNDLE_PATH Environment Variable:', render_env_var( 'BUNDLE_PATH' ) From abe4428cb6126cf217615091b0ee17eab7967abc Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 6 Jun 2014 14:15:48 -0400 Subject: [PATCH 16/16] add $SHELL to doctor --- lib/cask/cli/doctor.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cask/cli/doctor.rb b/lib/cask/cli/doctor.rb index 8e013b4eb9..a4d7c6a650 100644 --- a/lib/cask/cli/doctor.rb +++ b/lib/cask/cli/doctor.rb @@ -23,6 +23,7 @@ class Cask::CLI::Doctor ohai 'Contents of $GEM_PATH Environment Variable:', render_env_var( 'GEM_PATH' ) ohai 'Contents of $BUNDLE_PATH Environment Variable:', render_env_var( 'BUNDLE_PATH' ) ohai 'Contents of $PATH Environment Variable:', render_env_var( 'PATH' ) + ohai 'Contents of $SHELL Environment Variable:', render_env_var( 'SHELL' ) ohai 'Contents of Locale Environment Variables:', render_with_none( locale_variables ) ohai 'Running As Privileged User:', render_with_none_as_error( privileged_uid ) end