Class: Saddler::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/saddler/cli.rb', line 5

def self.exit_on_failure?
  true
end

Instance Method Details

#reportObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/saddler/cli.rb', line 24

def report
  if options[:debug]
    logger.level = Logger::DEBUG
  elsif options[:verbose]
    logger.level = Logger::INFO
  end
  logger.debug(options)

  data = fetch_data(options)
  Validator.valid?(data)
  require options[:require] if options[:require]
  reporter = add_reporter(options)

  reporter.report(data, options[:options])
rescue StandardError => e
  logger.error('options')
  logger.error(options)
  logger.error('input data')
  logger.error(data)
  logger.error('reporter')
  logger.error(reporter)
  raise e
end

#versionObject



12
13
14
# File 'lib/saddler/cli.rb', line 12

def version
  puts "Saddler version #{::Saddler::VERSION}"
end