lib/tlapse/doctor.rb in tlapse-0.1.0 vs lib/tlapse/doctor.rb in tlapse-0.1.1
- old
+ new
@@ -1,16 +1,23 @@
module Tlapse
module Doctor
+ CHECKS = %i(gphoto2 camera)
+
def doctor
- print "Checking gphoto2..."
- check_gphoto2!
- puts "ok!"
+ CHECKS.each do |check|
+ print "Checking #{check}..."
+ send "check_#{check}!"
+ puts "ok!"
+ end
- print "Checking camera..."
- check_camera!
- puts "ok!"
-
puts "Looks good!"
+ end
+
+ def okay?
+ CHECKS.each { |check| send "check_#{check}!" }
+ true
+ rescue StandardError
+ false
end
private ###################################################################
def check_gphoto2!