refactor `brew cask doctor`

Output remains the same (except in the case of error).
Wrap all calculations in begin blocks for safety, provide fallback
values for all variables, don't use ohai+puts when ohai is
sufficient
Merge pull request #4405 from rolandwalker/doctor_refactor

refactor `brew cask doctor`