Class: Lifer::Builder::HTML

Inherits:
Object
  • Object
show all
Defined in:
lib/lifer/builder/html.rb

Constant Summary collapse

DEFAULT_OUTPUT_DIRECTORY_NAME =
"_build"
FALLBACK_URI_STRATEGY =
"simple"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.execute(root:) ⇒ Object



8
9
10
# File 'lib/lifer/builder/html.rb', line 8

def execute(root:)
  new(root: root).execute
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lifer/builder/html.rb', line 13

def execute
  # Remove any existing output directory.
  #
  FileUtils.rm_r(output_directory)

  # Go into the fresh build directory and generate each HTML file from the
  # given directory.
  #
  Dir.chdir(output_directory) do
    Lifer.collections.each do |collection|
      collection.entries.each do |entry|
        generate_output_directories_for entry, current_collection: collection
        generate_output_file_for entry, current_collection: collection
      end
    end
  end
end