class Milestoner::Builders::Web

Builds web page output (i.e. HTML and CSS).

def call

def call
  input.build_root.tap do |path|
    stylesheet_path.copy path.make_path.join("page.css")
    write path
  end
end

def initialize(view: Views::Milestones::Show.new, enricher: Commits::Enricher.new, **)

def initialize(view: Views::Milestones::Show.new, enricher: Commits::Enricher.new, **)
  @view = view
  @enricher = enricher
  super(**)
end

def stylesheet_path

def stylesheet_path
  input.build_template_paths
       .map { |path| path.join "public/page.css.erb" }
       .find(&:exist?)
end

def write path

def write path
  enricher.call.fmap do |commits|
    path.join("index.html").write view.call commits:, layout: input.build_layout
  end
end