App-FuguWeb

 view release on metacpan or  search on metacpan

lib/App/FuguWeb/Check.pm  view on Meta::CPAN

	my $config = $self->{config};

	return map {
		App::FuguWeb::Keys->new( config => $config, dir => $_ )
		    ->problems
	} $config->keys_dirs;
}

# $self->_check_inventory:
#	Every page and asset exists and is not empty, and the output
#	holds nothing else: no staging directory, no editor backup, no
#	stray source.
sub _check_inventory ($self)
{
	my @problems;

	unless ( -d $self->{out} ) {
		return "$self->{out}: the site is not built";
	}

	my @expected = $self->{config}->inventory;

lib/App/FuguWeb/Check.pod  view on Meta::CPAN


=item *

every page of a language tree is reachable from the entry page of that
tree, except a page that the description marks C<unlinked>. The walk
stays inside the tree, per WEB-LANGUAGE-13;

=item *

the output holds the site and nothing else, at any depth: no staging
directory, no editor backup, no stray source, no tree of a language
that the description does not declare, and no empty directory.

=back

A description with a C<keys> block adds the checks of
L<App::FuguWeb::Keys/THE CHECKS>. They read the source key directory
and not the output. A stray key file and a stale digest are therefore
found whether or not a build has run.

=head2 external

t/fuguweb/check.t  view on Meta::CPAN

	my $joined = join "\n", @problems;

	is( scalar @problems, 0, 'no problem' ) or diag $joined;
	unlike( $joined, qr/mailto/,
		'a mailto: link is not a dead local link' );
	unlike( $joined, qr/man\.openbsd\.org/,
		'a cross-reference that left for the host does not dangle' );
};

subtest 'a stray file in the output' => sub {
	my @problems = built( 'index.html~' => "an editor backup\n" )->run;
	like( join( "\n", @problems ),
		qr{index\.html~: in the output but not in the site},
		'the stray file is named' );

	# A page at the top level that the site does not name.
	@problems = built( 'other.html' => "<p>Other</p>\n" )->run;
	is_deeply( \@problems, ['other.html: in the output but not in the site'],
		'a page at the top level is named' );

	# WEB-OUTPUT-4. The tree of a language that the description



( run in 0.913 second using v1.01-cache-2.11-cpan-99fa8243a42 )