class Bookwatch::Preprocessing::LinkToSiteGenDir

Attributes

filesystem[R]
subnav_generator_factory[R]

Public Class Methods

new(filesystem, subnav_generator_factory) click to toggle source
# File lib/bookwatch/preprocessing/link_to_site_gen_dir.rb, line 7
def initialize(filesystem, subnav_generator_factory)
  @filesystem = filesystem
  @subnav_generator_factory = subnav_generator_factory
end

Public Instance Methods

applicable_to?(section) click to toggle source
# File lib/bookwatch/preprocessing/link_to_site_gen_dir.rb, line 12
def applicable_to?(section)
  filesystem.file_exist?(section.path_to_repo_dir)
end
preprocess(sections, output_locations, config: nil, options: {}, **_) click to toggle source
# File lib/bookwatch/preprocessing/link_to_site_gen_dir.rb, line 16
def preprocess(sections, output_locations, config: nil, options: {}, **_)
  sections.each do |section|
    filesystem.link_creating_intermediate_dirs(
      section.path_to_repo_dir,
      output_locations.source_for_site_generator.join(section.destination_directory)
    )
  end

  generator = subnav_generator(options[:require_valid_subnav_links])
  config.products.each do |product|
    generator.generate(product)
  end
end

Private Instance Methods

subnav_generator(require_valid_subnav_links) click to toggle source