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



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/rsmp/cli.rb', line 116

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