Class: Nanoc::Checking::Runner Private

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/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 collapse

NUM_THREADS =

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.

Number of threads to use for running checks.

5

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ Runner

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::Core::Site)

    The Nanoc site this runner is for



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

def initialize(site)
  @site = site

  @log_mutex = Thread::Mutex.new
end

Instance Method Details

#any_enabled_checks?Boolean

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:

  • (Boolean)


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

def any_enabled_checks?
  !enabled_checks.empty?
end

#list_checksvoid

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.



26
27
28
29
30
31
32
# File 'lib/nanoc/checking/runner.rb', line 26

def list_checks
  load_all

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

#run_allBoolean

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



37
38
39
40
# File 'lib/nanoc/checking/runner.rb', line 37

def run_all
  load_all
  run_check_classes(all_check_classes)
end

#run_for_deployBoolean

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



45
46
47
48
49
# File 'lib/nanoc/checking/runner.rb', line 45

def run_for_deploy
  # TODO: rename to #run_enabled
  load_all
  run_check_classes(check_classes_named(enabled_checks))
end

#run_specific(check_class_names) ⇒ Boolean

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



56
57
58
59
# File 'lib/nanoc/checking/runner.rb', line 56

def run_specific(check_class_names)
  load_all
  run_check_classes(check_classes_named(check_class_names))
end