class Nanoc::CLI::Commands::Check

Public Instance Methods

run() click to toggle source
# File lib/nanoc/cli/commands/check.rb, line 13
def run
  validate_options_and_arguments
  load_site

  runner = Nanoc::Extra::Checking::Runner.new(site)

  if options[:list]
    runner.list_checks
    return
  end

  success =
    if options[:all]
      runner.run_all
    elsif options[:deploy]
      runner.run_for_deploy
    else
      runner.run_specific(arguments)
    end

  unless success
    raise Nanoc::Int::Errors::GenericTrivial, 'One or more checks failed'
  end
end

Protected Instance Methods

validate_options_and_arguments() click to toggle source
# File lib/nanoc/cli/commands/check.rb, line 40
def validate_options_and_arguments
  if arguments.empty? && !options[:all] && !options[:deploy] && !options[:list]
    raise(
      Nanoc::Int::Errors::GenericTrivial,
      'nothing to do (pass either --all, --deploy or --list or a list of checks)',
    )
  end
end