Sha256: 7b157160ee0ee33ec1b28ee249003216fdb5b96c56914e2352c648c1420a5bd9

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require "thor"
require 'praegustator'

module Praegustator
  class CLI < Thor

    desc "taste", "test an check against a chef query"
    long_desc <<-LONGDESC
    `praeg taste query check` will execute check against node returned by query
    > $ praeg taste role:web nginx
    LONGDESC
    def taste(query,check)
      config_file_path = Dir.pwd+"/.praegustator.yml"
      Praegustator.configure_with config_file_path
      recipes_dir = Praegustator.config['spec']['recipes_dir']
      recipes = Dir[Dir.pwd+"/#{recipes_dir}/**/*_recipe.rb"] if recipes.empty?
      Praegustator::Executor.new.execute(recipes)
    end

    desc "validate", "validate infrastructure by executing checks defined in recipe files"
    def validate(*recipes)
      config_file_path = Dir.pwd+"/.praegustator.yml"
      Praegustator.configure_with config_file_path
      recipes_dir = Praegustator.config['spec']['recipes_dir']
      recipes = Dir[Dir.pwd+"/#{recipes_dir}/**/*_recipe.rb"] if recipes.empty?
      Praegustator::Executor.new.execute(recipes)
    end

    desc "init" , "setup praegustator"
    long_desc " > $ praeg setup spec_dir"
    def init(spec_dir ='spec')
      Praegustator::Setup.new.init(spec_dir)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
praegustator-0.2.0 lib/praegustator/cli.rb
praegustator-0.1.0 lib/praegustator/cli.rb