App-Pods2Site
view release on metacpan or search on metacpan
Make a proper guy out of us with a shiny version! (no real code changes)
0.016 2019-08-22
* A typo in the default lib location config names caused a lib location to be left out
* All files should have a version number
0.015 2019-01-08
Support the use of ':path' as an argument to --bindir in order to pick up scripts in the PATH
0.014 2017-09-02
Minor beautification
* Minor wording
* Ensures version output is slashified properly
* Defaults the title to include the Config 'myuname' value (if any).
0.013 2017-08-08
lib/App/Pods2Site.pod view on Meta::CPAN
=head1 NAME
App::Pods2Site - converting pods to HTML site
Find all pods and convert them to linked HTML pages, and add some extra parts on top to bind them together
as a simple documentation site for your Perl installation.
=head1 VERSION
Version 1.003
=head1 SYNOPSIS
# Normally run 'pods2site' from a shell prompt to create or update:
# (place a site in the perl tree)
lib/App/Pods2Site/Args.pm view on Meta::CPAN
{
my $self = shift;
return $self->{sitedir};
}
sub getBinDirs
{
my $self = shift;
return @{$self->{bindirs}};
}
sub getLibDirs
{
my $self = shift;
return @{$self->{libdirs}};
}
sub getTitle
lib/App/Pods2Site/Args.pm view on Meta::CPAN
# PRIVATE
#
# these options are persisted to the site
# and can't be used when updating
#
my @STICKYOPTS =
qw
(
bindirectory
libdirectory
group
css
style
title
mainpage
);
sub __parseArgv
{
lib/App/Pods2Site/Args.pm view on Meta::CPAN
my @specs =
(
'usage|?',
'help',
'manual',
'version',
'v|verbose+',
'workdirectory=s',
'quiet',
'bindirectory=s@',
'libdirectory=s@',
'group=s@',
'css=s',
'style=s',
'title=s',
'mainpage=s',
# hidden
#
'_help',
lib/App/Pods2Site/Args.pm view on Meta::CPAN
delete($rawOpts{$opt});
}
%rawOpts = ( %rawOpts, %$savedOpts );
}
else
{
print "Creating '$sitedir'...\n" if $self->isVerboseLevel(0);
$self->{updating} = 0;
}
# fix up any user given bindir locations or get us the standard ones
#
my @bindirs = uniq($self->__getBinLocations($rawOpts{bindirectory}));
warn("WARNING: No bin directories found\n") unless @bindirs;
$self->{bindirs} = $rawOpts{bindirectory} = \@bindirs;
# fix up any user given libdir locations or get us the standard ones
#
my @libdirs = uniq($self->__getLibLocations($rawOpts{libdirectory}));
warn("WARNING: No lib directories found\n") unless @libdirs;
$self->{libdirs} = $rawOpts{libdirectory} = \@libdirs;
my $workdir;
if ($rawOpts{workdirectory})
{
lib/App/Pods2Site/Args.pod view on Meta::CPAN
--usage | -?
|
--help
|
--manual
|
--version
]
[ -v | --verbose [ -v ... ] | --quiet]
[ --workdirectory <path> ]
[ --bindirectory <location> [ --bindirectory ... ] ]
[ --libdirectory <location> [ --libdirectory ... ] ]
[ --group name=<query> [ --group name2=<query> ... ] ]
[ --css <file> ]
[ --title <title> ]
[ --style <name> ]
{ <sitedirectory> || :std }
=head1 OPTIONS AND ARGUMENTS
All options can be abbreviated, as long as they are unambiguous. Option matching is case
lib/App/Pods2Site/Args.pod view on Meta::CPAN
=item B<--css E<lt>fileE<gt>>
If you want to provide your own CSS file, use '--css'. The file given will be copied to the site
and used as an import in the CSS generated by the system and thus may override anything defined in that.
It will be included as a stylesheet in the generated file, and also by passing the '--css' option to the pod2html command.
Note that different 'styles' may generate different things possible to tweak.
=item B<--bindirectory E<lt>locationE<gt>>
By default, the code will automatically try to ascertain where the running Perl distro places executable scripts, e.g.
generally in the vendor, site and core 'bin' locations in the tree (ascertained from L<Config> values).
In case you manually want to add to, or manipulate the order of, the locations, you may provide one or more '--bindirectory'
options and they will be searched in the given order. Any locations not existing are silently skipped.
The 'location' is generally a normal path, but some special values have special meaning:
=over
=item * :none
Since the default locations are automatically searched if no '--bindirectory' option is given, this code is provided to
completely turn off searching any locations for scripts - just give a single invocation of '--bindirectory :none'.
=item * :path
Search paths in the PATH environment variable in order to find possible scripts with pod.
=item * :std
This will insert the default locations. Useful if you want insert one or more custom paths first, and then add 'all the
default places'.
=back
=item B<--libdirectory E<lt>locationE<gt>>
This is exactly like '--bindirectory', except for lib locations (e.g. where to find core pods, pragmas and ordinary modules).
Aside from taking regular paths, this also handles some special values:
=over
=item * :none
Since the default locations are automatically searched if no '--libdirectory' option is given, this code is provided to
completely turn off searching any locations for core/pragma/module pods - just give a single invocation of '--libdirectory :none'.
t/10-makesite.t view on Meta::CPAN
use Test::More tests => 12;
my $tmpdir = tempdir("pods2site-test-makesite-XXXX", TMPDIR => 1, CLEANUP => 1) || '';
ok($tmpdir, "Created tempdir '$tmpdir'\n");
my $site1 = "$tmpdir/site1";
my $ret = App::Pods2Site::main
(
'--bindir', "$Bin/tdata/bin",
'--libdir', "$Bin/tdata/lib",
'--group', '4-script=type.eq(bin)',
'--group', '3-module=type.eq(lib) AND NOT name.eq(Bad)',
$site1
);
is($ret, 0, "Created $site1");
my @expectedSite1 =
(
"$site1/pod2html/3-module/Helloworld.html",
t/10-makesite.t view on Meta::CPAN
(
"$site1/pod2html/3-module/Bad.html",
);
ok(-e $_, "Expected '$_'") foreach (@expectedSite1);
ok(!-e $_, "Not expected '$_'") foreach (@notExpectedSite1);
my $site2 = "$tmpdir/site2";
$ret = App::Pods2Site::main
(
'--bindir', "$Bin/tdata/bin",
'--libdir', "$Bin/tdata/lib",
'--group', '4-script=type.eq(bin)',
'--group', '3-module=type.eq(lib) AND name.eq(Bad)',
$site2
);
is($ret, 0, "Created $site2");
my @expectedSite2 =
(
"$site2/pod2html/3-module/Bad.html",
( run in 0.980 second using v1.01-cache-2.11-cpan-2398b32b56e )