class Playgroundbook::Linter

A linter for verifying a playground book

Attributes

contents_linter[RW]
playground_file_name[RW]

Public Class Methods

new(playground_file_name, contents_linter = ContentsLinter.new) click to toggle source
# File lib/linter/playgroundbook_lint.rb, line 12
def initialize(playground_file_name, contents_linter = ContentsLinter.new)
  @playground_file_name = playground_file_name
  @contents_linter = contents_linter
end

Public Instance Methods

contents_dir_exists?() click to toggle source
# File lib/linter/playgroundbook_lint.rb, line 27
def contents_dir_exists?
  Dir.exist?(playground_file_name + "/Contents")
end
lint() click to toggle source
# File lib/linter/playgroundbook_lint.rb, line 17
def lint
  message "Validating #{playground_file_name.yellow}..."

  fail_lint "No Contents directory" unless contents_dir_exists?

  Dir.chdir playground_file_name do
    contents_linter.lint
  end
end