Sha256: 6d30347f9956f7ed86287ea05733a555762ba504a6f4bf401d21c4d6775cbe70

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

#!/usr/bin/env ruby
require 'thor'
require 'dogwatch'

module DogWatch
  ##
  # DogWatch CLI
  ##
  class CLI < Thor
    class_option :dogfile, :type => :string, :default => 'Dogfile'
    class_option :api_key, :type => :string, :default => nil
    class_option :app_key, :type => :string, :default => nil
    class_option :timeout, :type => :numeric, :default => 5
    def initialize(*args)
      super
      @cwd = Dir.getwd
      @dogfile = DogWatch::DogFile.new
    end

    desc 'create', 'Create a monitor from a Dogfile'
    def create
      @dogfile.configure(File.absolute_path(options['dogfile'], @cwd),
                         options['api_key'], options['app_key'],
                         options['timeout'])
      @dogfile.create { |c| say_status(*c.to_thor) }
    end
  end
end

DogWatch::CLI.start(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dogwatch-1.1.0 bin/dogwatch