Class: ComplianceEngine::CLI

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

Overview

Compliance Engine CLI

Instance Method Summary collapse

Instance Method Details

#dumpObject



34
35
36
37
38
39
# File 'lib/compliance_engine/cli.rb', line 34

def dump
  require 'yaml'
  data.files.each do |file|
    puts({ file => data.get(file) }.to_yaml)
  end
end

#hieraObject



21
22
23
24
# File 'lib/compliance_engine/cli.rb', line 21

def hiera
  require 'yaml'
  puts data.hiera(options[:profile]).to_yaml
end

#inspectObject



48
49
50
51
52
53
54
# File 'lib/compliance_engine/cli.rb', line 48

def inspect
  # Run the CLI with `data` as the object containing the compliance data.
  require 'irb'
  # rubocop:disable Lint/Debugger
  binding.irb
  # rubocop:enable Lint/Debugger
end

#lookup(key) ⇒ Object



28
29
30
31
# File 'lib/compliance_engine/cli.rb', line 28

def lookup(key)
  require 'yaml'
  puts data.hiera(options[:profile]).select { |k, _| k == key }.to_yaml
end

#profilesObject



42
43
44
45
# File 'lib/compliance_engine/cli.rb', line 42

def profiles
  require 'yaml'
  puts data.profiles.select { |_, value| value.ces&.count&.positive? || value.controls&.count&.positive? }.keys.to_yaml
end

#versionObject



15
16
17
# File 'lib/compliance_engine/cli.rb', line 15

def version
  puts ComplianceEngine::VERSION
end