Sha256: cc9df510728f95db0e6240b6f5047103ec5591f020c2d7e5c02d7e8718b1e87f

Contents?: true

Size: 795 Bytes

Versions: 1

Compression:

Stored size: 795 Bytes

Contents

module Tlapse
  module Doctor
    def doctor
      print "Checking gphoto2..."
      check_gphoto2!
      puts "ok!"

      print "Checking camera..."
      check_camera!
      puts "ok!"

      puts "Looks good!"
    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

1 entries across 1 versions & 1 rubygems

Version Path
tlapse-0.1.0 lib/tlapse/doctor.rb