Class: Abide::CLI::PuppetScoreModuleCommand

Inherits:
AbideCommand
  • Object
show all
Defined in:
lib/abide_dev_utils/cli/puppet.rb

Constant Summary collapse

CMD_NAME =
'score'
CMD_SHORT =
'Scores a Puppet module just like Puppet Forge'
CMD_LONG =
'Scores a Puppet module just like Puppet Forge. This is a useful quality-check before publishing a module.'

Constants included from AbideDevUtils::Config

AbideDevUtils::Config::DEFAULT_PATH

Instance Method Summary collapse

Methods inherited from AbideCommand

#deprecated?, #on_after_add

Methods included from AbideDevUtils::Config

config_section, #config_section, fetch, #fetch, to_h, #to_h

Constructor Details

#initializePuppetScoreModuleCommand

Returns a new instance of PuppetScoreModuleCommand.



225
226
227
228
229
230
231
# File 'lib/abide_dev_utils/cli/puppet.rb', line 225

def initialize
  super(CMD_NAME, CMD_SHORT, CMD_LONG, takes_commands: false)
  options.on('-o [PATH]', '--outfile [PATH]', 'Save results to a file') { |x| @data[:outfile] = x }
  options.on('-q', '--quiet', FalseClass, 'Do not print results to console') { |x| @data[:quiet] = x }
  options.on('-c', '--checks', Array, 'Comma-separated list of individual checks to run. Defaults to running all checks.') { |x| @data[:check] = x }
  options.on('-m [PATH]', '--module [PATH]', 'Path to a Puppet module to score. Defaults to using the current directory.') { |x| @data[:module] = x }
end

Instance Method Details

#executeObject



233
234
235
236
# File 'lib/abide_dev_utils/cli/puppet.rb', line 233

def execute
  module_path = @data.fetch(:module, nil)
  AbideDevUtils::Ppt.score_module(module_path, **@data)
end