Class: Abide::CLI::PuppetAuditClassNamesCommand
- Inherits:
-
AbideCommand
- Object
- CmdParse::Command
- AbideCommand
- Abide::CLI::PuppetAuditClassNamesCommand
- Defined in:
- lib/abide_dev_utils/cli/puppet.rb
Constant Summary collapse
- CMD_NAME =
'audit-class-names'
- CMD_SHORT =
'Finds Puppet classes in a directory that have names that do not match their path'
- CMD_LONG =
'Finds Puppet classes in a directory that have names that do not match their path. This is helpful because class names that do not match their path structure break Puppet autoloading.'
- CMD_DIR_ARG =
'The directory containing the Puppet class files'
Constants included from AbideDevUtils::Config
AbideDevUtils::Config::DEFAULT_PATH
Instance Method Summary collapse
- #execute(dir) ⇒ Object
-
#initialize ⇒ PuppetAuditClassNamesCommand
constructor
A new instance of PuppetAuditClassNamesCommand.
Methods included from AbideDevUtils::Config
config_section, #config_section, fetch, #fetch, to_h, #to_h
Constructor Details
#initialize ⇒ PuppetAuditClassNamesCommand
Returns a new instance of PuppetAuditClassNamesCommand.
187 188 189 190 191 192 |
# File 'lib/abide_dev_utils/cli/puppet.rb', line 187 def initialize super(CMD_NAME, CMD_SHORT, CMD_LONG, takes_commands: false) argument_desc(DIR: CMD_DIR_ARG) .on('-o [FILE]', '--out-file [FILE]', 'Save results to a file') { |f| @data[:file] = f } .on('-q', '--quiet', 'Do not print results to console') { @data[:quiet] = true } end |
Instance Method Details
#execute(dir) ⇒ Object
194 195 196 197 198 199 200 201 |
# File 'lib/abide_dev_utils/cli/puppet.rb', line 194 def execute(dir) if @data.fetch(:quiet, false) && !@data.key?(:file) AbideDevUtils::Output.simple('ERROR: Specifying --quiet without --out-file is useless.', stream: $stderr) exit 1 end AbideDevUtils::Ppt.audit_class_names(dir, **@data) end |