Sha256: ac16c6aae91904b1e7da25ed1109943778d691176e4082b06eccd8e6af126890

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

require 'plist'
require 'playground_book_lint/manifest_linter'
require 'playground_book_lint/chapter_linter'

module PlaygroundBookLint
  class RootManifestLinter < ManifestLinter
    attr_accessor :chapter_linter

    def initialize(chapter_linter = ChapterLinter.new())
      @chapter_linter = chapter_linter
    end
    
    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

    def chapters_directory_exist?
      return Dir.exist? 'Chapters'
    end

    def chapters_exist?
      value_defined_in_manifest?('Chapters')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
playground-book-lint-0.0.1 lib/playground_book_lint/root_manifest_linter.rb