Class: Bookbinder::Preprocessing::LinkToSiteGenDir

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/preprocessing/link_to_site_gen_dir.rb

Instance Method Summary collapse

Constructor Details

#initialize(filesystem) ⇒ LinkToSiteGenDir

Returns a new instance of LinkToSiteGenDir.



4
5
6
# File 'lib/bookbinder/preprocessing/link_to_site_gen_dir.rb', line 4

def initialize(filesystem)
  @filesystem = filesystem
end

Instance Method Details

#applicable_to?(section) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/bookbinder/preprocessing/link_to_site_gen_dir.rb', line 8

def applicable_to?(section)
  filesystem.file_exist?(section.path_to_repository)
end

#preprocess(sections, output_locations, *_) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/bookbinder/preprocessing/link_to_site_gen_dir.rb', line 12

def preprocess(sections, output_locations, *_)
  sections.each do |section|
    filesystem.link_creating_intermediate_dirs(
      section.path_to_repository,
      output_locations.source_for_site_generator.join(section.destination_directory)
    )
  end
end