App-FuguWeb

 view release on metacpan or  search on metacpan

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

sub keys_expires ($self) { return $self->{keys_expires}; }
sub keys_url     ($self) { return $self->{keys_url}; }

# $self->keys_path($name):
#	The path of a file in the source key directory, or of the
#	directory itself when the caller names nothing. The method
#	answers undef when the description holds no keys block.
sub keys_path ( $self, $name = undef )
{
	return unless defined $self->{keys_dir};

	my $dir = $self->source_path( $self->{keys_dir} );

	return defined $name ? "$dir/$name" : $dir;
}

# $self->site_keys:
#	The key blocks, in file order. Each entry is a hash reference
#	with name, stem, type, serial, purpose, status, since, until,
#	email and fingerprint. The name is the key file, and the stem
#	is the block name.
#
#	The list is named site_keys and not keys, because a method
#	named keys in this package makes every call of the builtin
#	ambiguous.
sub site_keys ($self)
{
	return @{ $self->{key} };
}

# $self->source_path($name):
#	The path of a file in the source directory, or of the
#	directory itself when the caller names nothing.
sub source_path ( $self, $name = undef )
{
	my $dir = "$self->{root}/$self->{source_dir}";

	return defined $name ? "$dir/$name" : $dir;
}

# $self->nav:
#	The navigation, in file order. Each entry is a hashref with
#	href and label.
sub nav ($self)
{
	return @{ $self->{nav} };
}

# $self->pages:
#	The pages, in file order. Each entry is a hashref with file,
#	title, source, value and unlinked. The source is one of body,
#	markdown or index, and the value is what that source names.
sub pages ($self)
{
	return @{ $self->{page} };
}

# $self->assets:
#	The names of the files in the source directory that the build
#	copies as they stand, sorted. An asset is any file there that
#	the build does not render: not a body fragment, not Markdown,
#	and not a dot file.
#
#	Thus robots.txt and CNAME need no entry in the description, and
#	a CLAUDE.md beside them is not published. Markdown in the
#	source directory is either a page source, which a page block
#	names and lowdown renders, or notes for the maintainers.
#	Neither belongs in the output as it stands.
#
#	The build and the checks read the same list, so the two can
#	never disagree about what the site holds.
sub assets ($self)
{
	my $dir = $self->source_path;
	return () unless -d $dir;

	my $names = App::FuguWeb::list_dir($dir) or return ();

	return
	    grep { !/^\./ && !/\.body\.html$/ && !/\.md$/ && -f "$dir/$_" }
	    @$names;
}

# $self->inventory:
#	Every name that the output directory must hold after a build:
#	the pages of the description, one page for each manual of each
#	group, the stylesheet, the assets, and every path of the key
#	directory. The build and the checks read the same list, so the
#	two can never disagree about what the site holds.
#
#	Every name but the key paths is one segment. The key directory
#	is the one part of a site that is not one flat directory.
sub inventory ($self)
{
	return ( map { $_->{file} } $self->pages ),
	    ( map { $_->page } map { $_->manuals } $self->groups ),
	    App::FuguWeb::STYLESHEET, $self->assets, $self->key_paths;
}

# $self->key_paths:
#	Every path of the key directory in the output, relative to the
#	output directory, or the empty list when the description holds
#	no keys block. The paths hold a solidus: the key directory is
#	the one part of a site that is not one flat directory.
sub key_paths ($self)
{
	my @paths =
	    defined $self->{keys_dir}
	    ? App::FuguWeb::Keys->new( config => $self )->paths
	    : ();

	return @paths;
}

# $self->groups:
#	The manual groups, in file order. Each entry is an
#	App::FuguWeb::Config::Group.
sub groups ($self)
{
	return @{ $self->{group} };
}



( run in 1.522 second using v1.01-cache-2.11-cpan-364913b4093 )