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



11
12
13
# File 'lib/nanoc/extra/checking/runner.rb', line 11

def initialize(site)
  @site = site
end

Instance Method Details

- (String) 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.

Returns The name of the Checks file

Returns:

  • (String)

    The name of the Checks file



16
17
18
# File 'lib/nanoc/extra/checking/runner.rb', line 16

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

- (Boolean) dsl_present? Also known as: 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



21
22
23
# File 'lib/nanoc/extra/checking/runner.rb', line 21

def dsl_present?
  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.



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

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



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

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



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

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



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

def run_specific(check_class_names)
  load_dsl_if_available

  run_check_classes(check_classes_named(check_class_names))
end