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



36
37
38
39
40
41
# File 'lib/compliance_engine/cli.rb', line 36

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

#hieraObject



23
24
25
26
# File 'lib/compliance_engine/cli.rb', line 23

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

#inspectObject



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

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



30
31
32
33
# File 'lib/compliance_engine/cli.rb', line 30

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

#profilesObject



44
45
46
47
# File 'lib/compliance_engine/cli.rb', line 44

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

#versionObject



17
18
19
# File 'lib/compliance_engine/cli.rb', line 17

def version
  puts ComplianceEngine::VERSION
end