NAME

App::FuguWeb::Check - what a built site must be true of

SYNOPSIS

use App::FuguWeb::Check;

my $check = App::FuguWeb::Check->new(
    config => $config,
    out    => 'web/build',
);

my @problems = $check->run;
warn "$_\n" for @problems;
note("external link: $_") for $check->external;

DESCRIPTION

The checks are generic, so every project that uses the tool gets them. A project keeps only the assertions that are about its own content.

The class never fetches a link. It collects the external ones and reports them, because the build and its checks touch no network.

METHODS

new

App::FuguWeb::Check->new(
    config => $config,      # required
    out    => $dir,         # required: the built site
)

pages

Every page that the site must hold, in a stable order: the pages of the description, then one page for each manual of each group. The full expectation, assets included, comes from "inventory" in App::FuguWeb::Config, so the build and the checks can never disagree about what the site is.

run

Check the site and return the problems, each one a sentence that names the page. An empty list means the site is good.

The checks are:

  • every expected page and asset exists and is not empty;

  • every page has a title;

  • every page carries the whole navigation;

  • no reference starts with /, because the host may serve the site from a path below the root;

  • no reference uses a file: URL;

  • every relative reference resolves to a file in the output, a manual cross-reference included;

  • every fragment resolves to an id on the target page;

  • no relative href reads as a URL scheme, so every local link keeps its ./;

  • every page is reachable from the entry page, except a page that the description marks unlinked;

  • the output holds the site and nothing else: no staging directory, no editor backup, no stray source.

external

The external links that the last run collected, sorted.

SEE ALSO

App::FuguWeb, App::FuguWeb::Config, App::FuguWeb::Site, fuguweb(1)

AUTHOR

Dick Olsson <hi@senzilla.io>