Sha256: 67fa16421cf3436d6a1d8ad58d9d233d3c2f8413a714527393a192e9656d6b7b
Contents?: true
Size: 989 Bytes
Versions: 18
Compression:
Stored size: 989 Bytes
Contents
module Tlapse module Doctor CHECKS = %i(gphoto2 camera) def doctor CHECKS.each do |check| print "Checking #{check}..." send "check_#{check}!" puts "ok!" end puts "Looks good!" end def status CHECKS.each { |check| send "check_#{check}!" } "OK" rescue StandardError => e e.message end def okay? status == "OK" end private ################################################################### def check_gphoto2! raise "Could not find gphoto2 :(" if `which gphoto2`.empty? end def check_camera! cameras = `gphoto2 --auto-detect` # Output looks like this: # # Model Port # -------------------- # Camera :usb # # If there is a third line, a camera was detected unless cameras.split("\n").length > 2 raise "gphoto2 couldn't find a camera :(" end end end # Doctor end # Tlapse
Version data entries
18 entries across 18 versions & 1 rubygems