Sha256: bf0297ec77f8448b4bee05e39631ab01e84ccc216e34fa5576112274051e03ce

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 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
    class_option :verbose, :type => :boolean, :default => false
    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 do |c|
        results = c.to_thor
        next if results.first == :none && options['verbose'] == false

        say_status(*results)
      end
    end
  end
end

DogWatch::CLI.start(ARGV)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dogwatch-1.2.0 bin/dogwatch
dogwatch-1.1.1 bin/dogwatch