Class: Nanoc::Extra::Checking::Check Private

Inherits:
Int::Context show all
Extended by:
Int::PluginRegistry::PluginMethods
Defined in:
lib/nanoc/extra/checking/check.rb

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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Int::PluginRegistry::PluginMethods

all, identifier, identifiers, named, register

Methods inherited from Int::Context

#get_binding

Constructor Details

#initialize(context) ⇒ Check

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 Check.



35
36
37
38
39
# File 'lib/nanoc/extra/checking/check.rb', line 35

def initialize(context)
  super(context)

  @issues = Set.new
end

Instance Attribute Details

#issuesObject (readonly)

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.



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

def issues
  @issues
end

Class Method Details

.create(site) ⇒ Object

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.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/nanoc/extra/checking/check.rb', line 15

def self.create(site)
  output_dir = site.config[:output_dir]
  unless File.exist?(output_dir)
    raise Nanoc::Extra::Checking::OutputDirNotFoundError.new(output_dir)
  end
  output_filenames = Dir[output_dir + '/**/*'].select { |f| File.file?(f) }

  # FIXME: ugly
  view_context = site.compiler.create_view_context(Nanoc::Int::DependencyTracker::Null.new)

  context = {
    items: Nanoc::ItemCollectionWithRepsView.new(site.items, view_context),
    layouts: Nanoc::LayoutCollectionView.new(site.layouts, view_context),
    config: Nanoc::ConfigView.new(site.config, view_context),
    output_filenames: output_filenames,
  }

  new(context)
end

Instance Method Details

#add_issue(desc, subject: nil) ⇒ Object

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.



45
46
47
# File 'lib/nanoc/extra/checking/check.rb', line 45

def add_issue(desc, subject: nil)
  @issues << Issue.new(desc, subject, self.class)
end

#runObject

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.

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/nanoc/extra/checking/check.rb', line 41

def run
  raise NotImplementedError.new('Nanoc::Extra::Checking::Check subclasses must implement #run')
end