Class: PlaygroundBookLint::ChapterLinter

Inherits:
AbstractLinter show all
Defined in:
lib/playground_book_lint/chapter_linter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractLinter

#fail_lint, #message, ui=

Constructor Details

#initialize(chapter_manifest_linter = ChapterManifestLinter.new()) ⇒ ChapterLinter

Returns a new instance of ChapterLinter.



11
12
13
# File 'lib/playground_book_lint/chapter_linter.rb', line 11

def initialize(chapter_manifest_linter = ChapterManifestLinter.new())
  @chapter_manifest_linter = chapter_manifest_linter
end

Instance Attribute Details

#chapter_manifest_linterObject

Returns the value of attribute chapter_manifest_linter.



9
10
11
# File 'lib/playground_book_lint/chapter_linter.rb', line 9

def chapter_manifest_linter
  @chapter_manifest_linter
end

Instance Method Details

#chapter_directory_exists?(chapter_directory_name) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/playground_book_lint/chapter_linter.rb', line 25

def chapter_directory_exists?(chapter_directory_name)
  return Dir.exist? chapter_directory_name
end

#lint(chapter_directory_name) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/playground_book_lint/chapter_linter.rb', line 15

def lint(chapter_directory_name)
  fail_lint "Chapter specified in manifest does not exist: #{chapter_directory_name}." unless chapter_directory_exists?(chapter_directory_name)
  
  Dir.chdir chapter_directory_name do
    fail_lint "Pages directory in chapter does not exist: #{chapter_directory_name}." unless pages_directory_exists?

    chapter_manifest_linter.lint()
  end
end

#pages_directory_exists?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/playground_book_lint/chapter_linter.rb', line 29

def pages_directory_exists?
  return Dir.exist? PAGES_DIRECTORY_NAME
end