Class: Nanoc::Extra::Checking::Runner Private

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/extra/checking/runner.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Runner is reponsible for running issue checks.

Constant Summary

CHECKS_FILENAMES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

['Checks', 'Checks.rb', 'checks', 'checks.rb']

Instance Method Summary (collapse)

Constructor Details

- (Runner) initialize(site)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Runner

Parameters:

  • site (Nanoc::Site)

    The nanoc site this runner is for



13
14
15
# File 'lib/nanoc/extra/checking/runner.rb', line 13

def initialize(site)
  @site = site
end

Instance Method Details

- (Object) checks_filename

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • The (String)

    name of the Checks file



18
19
20
# File 'lib/nanoc/extra/checking/runner.rb', line 18

def checks_filename
  @_checks_filename ||= CHECKS_FILENAMES.find { |f| File.file?(f) }
end

- (Boolean) has_dsl?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns true if a Checks file exists, false otherwise

Returns:

  • (Boolean)

    true if a Checks file exists, false otherwise



23
24
25
# File 'lib/nanoc/extra/checking/runner.rb', line 23

def has_dsl?
  checks_filename && File.file?(checks_filename)
end

- (void) list_checks

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Lists all available checks on stdout.



30
31
32
33
34
35
36
# File 'lib/nanoc/extra/checking/runner.rb', line 30

def list_checks
  load_dsl_if_available

  puts 'Available checks:'
  puts
  puts all_check_classes.map { |i| '  ' + i.identifier.to_s }.sort.join("\n")
end

- (Boolean) run_all

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs all checks.

Returns:

  • (Boolean)

    true if successful, false otherwise



41
42
43
44
45
# File 'lib/nanoc/extra/checking/runner.rb', line 41

def run_all
  load_dsl_if_available

  run_check_classes(all_check_classes)
end

- (Boolean) run_for_deploy

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the checks marked for deployment.

Returns:

  • (Boolean)

    true if successful, false otherwise



50
51
52
53
54
55
# File 'lib/nanoc/extra/checking/runner.rb', line 50

def run_for_deploy
  require_dsl

  return true if dsl.nil?
  run_check_classes(check_classes_named(dsl.deploy_checks))
end

- (Boolean) run_specific(check_class_names)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the checks with the given names.

Parameters:

  • check_class_names (Array<Symbol>)

    The names of the checks

Returns:

  • (Boolean)

    true if successful, false otherwise



62
63
64
65
66
# File 'lib/nanoc/extra/checking/runner.rb', line 62

def run_specific(check_class_names)
  load_dsl_if_available

  run_check_classes(check_classes_named(check_class_names))
end