Class: Nanoc::CLI::Commands::Check

Inherits:
Nanoc::CLI::CommandRunner
  • Object
show all
Defined in:
lib/nanoc/cli/commands/check.rb

Instance Method Summary collapse

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/nanoc/cli/commands/check.rb', line 13

def run
  validate_options_and_arguments
  load_site
  site.compiler.action_provider.preprocess(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