module Moonshot::DoctorHelper
A series of methods for adding “doctor” checks to a mechanism.
Public Instance Methods
doctor_hook()
click to toggle source
# File lib/moonshot/doctor_helper.rb, line 10 def doctor_hook run_all_checks end
Private Instance Methods
critical(str, additional_info = nil)
click to toggle source
# File lib/moonshot/doctor_helper.rb, line 49 def critical(str, additional_info = nil) print ' ✗ '.red puts str additional_info.lines.each { |l| puts " #{l}" } if additional_info raise DoctorCritical end
run_all_checks()
click to toggle source
# File lib/moonshot/doctor_helper.rb, line 16 def run_all_checks success = true puts puts self.class.name.split('::').last private_methods.each do |meth| begin send(meth) if meth =~ /^doctor_check_/ rescue DoctorCritical # Stop running checks in this Mechanism. success = false break rescue => e success = false print ' ✗ '.red puts "Exception while running check: #{e.class}: #{e.message.lines.first}" break end end success end
success(str)
click to toggle source
# File lib/moonshot/doctor_helper.rb, line 38 def success(str) print ' ✓ '.green puts str end
warning(str, additional_info = nil)
click to toggle source
# File lib/moonshot/doctor_helper.rb, line 43 def warning(str, additional_info = nil) print ' ? '.yellow puts str additional_info.lines.each { |l| puts " #{l}" } if additional_info end