class Bookwatch::Config::Checkers::ArchiveMenuChecker

Constants

ArchiveMenuNotDefinedError
EmptyArchiveItemsError
MissingArchiveMenuPartialError

Attributes

file_system_accessor[R]

Public Class Methods

new(file_system_accessor) click to toggle source
# File lib/bookwatch/config/checkers/archive_menu_checker.rb, line 9
def initialize(file_system_accessor)
  @file_system_accessor = file_system_accessor
end

Public Instance Methods

check(config) click to toggle source
# File lib/bookwatch/config/checkers/archive_menu_checker.rb, line 13
def check(config)
  partial_location = './master_middleman/source/archive_menus/_default.erb'
  if config.archive_menu && config.archive_menu.include?(nil)
    EmptyArchiveItemsError.new 'Did you forget to add a value to the archive_menu?'
  elsif config.archive_menu && !file_system_accessor.file_exist?(partial_location)
    MissingArchiveMenuPartialError.new "You must provide a template partial named at #{partial_location}"
  end
end