Class: Grayskull::CLI

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

Overview

The CLI class provides an interface for the command line functions

Instance Method Summary collapse

Instance Method Details

#validate(file, schema) ⇒ Object

Creates a new Validator and validates the file



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/grayskull/cli.rb', line 10

def validate(file,schema)
  validator = Grayskull::Validator.new(file,schema)
  results = validator.validate
  
  if !results['result']
    puts 'Validation Failed with ' + results['errors'].count.to_s + ' errors';
        puts ''
        results["errors"].each{
          |error|
          puts error            
        }
  else
    puts 'Validated Successfully!'
  end
end