Almost-minimal filesystem based blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

66 lines
1.5 KiB

#!/usr/bin/env perl
=pod
=head1 NAME
wrt-render-all - utility for rendering static HTML files from entries
=head1 USAGE
wrt render-all
wrt render-all --config ./wrt.json ...
wrt render-all --help
=head1 DESCRIPTION
Renders all entries in the current wrt archive to the C<publish_dir> specified
in the configuration file (normally F<wrt.json>). By default, this is
F<./public>.
Detailed documentation can be found in the L<App::WRT> man page or at
L<https://github.com/brennen/wrt>.
=head1 LICENSE
wrt is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
=head1 AUTHOR
Brennen Bearnes
=cut
use 5.10.0;
use strict;
use warnings;
no warnings 'uninitialized';
use Getopt::Long;
use Pod::Usage;
use App::WRT;
# Handle options, including help generated from the POD above. See:
# - http://perldoc.perl.org/Getopt/Long.html#User-defined-subroutines-to-handle-options
# - https://metacpan.org/pod/Pod::Usage
# - http://michael.thegrebs.com/2014/06/08/Pod-Usage/
my $config_file = 'wrt.json';
GetOptions(
'config=s' => \$config_file,
help => sub { pod2usage(0) },
) or pod2usage(2);
unless (-e $config_file) {
die "No wrt config file found. Tried: $config_file";
}
my $w = App::WRT::new_from_file($config_file);
# This expects a callback to handle logging output:
$w->render(sub { say $_[0]; });
exit(0);