Class: Playgroundbook::RootManifestLinter
- Inherits:
-
ManifestLinter
- Object
- AbstractLinter
- ManifestLinter
- Playgroundbook::RootManifestLinter
- Defined in:
- lib/linter/root_manifest_linter.rb
Overview
A linter for verifying the contents of a playground book’s root manifest
Instance Attribute Summary collapse
-
#chapter_linter ⇒ Object
Returns the value of attribute chapter_linter.
Instance Method Summary collapse
- #chapters_directory_exist? ⇒ Boolean
- #chapters_exist? ⇒ Boolean
-
#initialize(chapter_linter = ChapterLinter.new) ⇒ RootManifestLinter
constructor
A new instance of RootManifestLinter.
- #lint ⇒ Object
Methods inherited from ManifestLinter
#manifest_file_exists?, #manifest_plist_contents, #name?, #value_defined_in_manifest?
Methods inherited from AbstractLinter
Constructor Details
#initialize(chapter_linter = ChapterLinter.new) ⇒ RootManifestLinter
Returns a new instance of RootManifestLinter.
10 11 12 |
# File 'lib/linter/root_manifest_linter.rb', line 10 def initialize(chapter_linter = ChapterLinter.new) @chapter_linter = chapter_linter end |
Instance Attribute Details
#chapter_linter ⇒ Object
Returns the value of attribute chapter_linter.
8 9 10 |
# File 'lib/linter/root_manifest_linter.rb', line 8 def chapter_linter @chapter_linter end |
Instance Method Details
#chapters_directory_exist? ⇒ Boolean
28 29 30 |
# File 'lib/linter/root_manifest_linter.rb', line 28 def chapters_directory_exist? Dir.exist? "Chapters" end |
#chapters_exist? ⇒ Boolean
32 33 34 |
# File 'lib/linter/root_manifest_linter.rb', line 32 def chapters_exist? value_defined_in_manifest?("Chapters") end |
#lint ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/linter/root_manifest_linter.rb', line 14 def lint super() fail_lint "No Chapters directory" unless chapters_directory_exist? fail_lint "No Chapters specified" unless chapters_exist? # Go into Chapters/ and then each chapter directory, then lint it. Dir.chdir "Chapters" do manifest_plist_contents["Chapters"].each do |chapter_directory_name| chapter_linter.lint(chapter_directory_name) end end end |