Class: Praegustator::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/praegustator/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/praegustator/cli.rb', line 6

def self.exit_on_failure?
  true
end

Instance Method Details

#init(spec_dir = 'spec') ⇒ Object



36
37
38
# File 'lib/praegustator/cli.rb', line 36

def init(spec_dir ='spec')
  Praegustator::Setup.new.init(spec_dir)
end

#taste(query, check) ⇒ Object



15
16
17
18
19
20
# File 'lib/praegustator/cli.rb', line 15

def taste(query,check)
  config_file_path = Dir.pwd+"/.praegustator.yml"
  Praegustator.configure_with config_file_path
  Praegustator::Executor.new.execute_check(query,check)
  exit 1 if Praegustator.reporter.status == 'failed'
end

#validate(*recipes) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/praegustator/cli.rb', line 23

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)

  Praegustator.reporter.status
  exit 1 if Praegustator.reporter.status == 'failed'
end