Class: RSMP::ConfigCLI

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

Overview

CLI subcommands for RSMP configuration validation.

Instance Method Summary collapse

Instance Method Details

#check(*paths) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rsmp/cli.rb', line 30

def check(*paths)
  if paths.empty?
    puts 'Error: config check requires at least one path'
    exit 1
  end

  valid = true
  paths.each do |path|
    RSMP::Config.load_file(path, type: options[:type])
    puts 'OK'
  rescue RSMP::ConfigurationError => e
    valid = false
    puts "Error: #{e.message}"
  end

  exit 1 unless valid
end