Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions build_docs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BEGIN
$Opts, #
'all', 'push', 'update!', #
'single', 'pdf', 'doc=s', 'out=s', 'toc', 'chunk=i',
'open', 'skiplinkcheck', 'staging', 'procs=i', 'user=s', 'lang=s',
'open', 'skiplinkcheck', 'linkcheckonly', 'staging', 'procs=i', 'user=s', 'lang=s',
'lenient', 'verbose', 'reload_template', 'resource=s@'
) || exit usage();

Expand Down Expand Up @@ -180,16 +180,22 @@ sub build_all {
or die "Missing <contents> configuration section";

my $toc = ES::Toc->new( $Conf->{contents_title} || 'Guide' );
build_entries( $build_dir, $temp_dir, $toc, @$contents );
$temp_dir->rmtree;

say "Writing main TOC";
$toc->write( $build_dir, 0 );
if ( $Opts->{linkcheckonly} ){
say "Skipping documentation builds."
}
else {
build_entries( $build_dir, $temp_dir, $toc, @$contents );
$temp_dir->rmtree;

say "Writing main TOC";
$toc->write( $build_dir, 0 );

say "Writing extra HTML redirects";
for ( @{ $Conf->{redirects} } ) {
say "Writing extra HTML redirects";
for ( @{ $Conf->{redirects} } ) {
write_html_redirect( $build_dir->subdir( $_->{prefix} ),
$_->{redirect} );
}
}
if ( $Opts->{skiplinkcheck} ) {
say "Skipped Checking links";
Expand Down Expand Up @@ -383,20 +389,25 @@ sub init_repos {
);
delete $child_dirs{ $repo->git_dir->absolute };

$pm->start($name) and next;
eval {
if ( $Opts->{linkcheckonly} ){
say "Skipping fetching repo $name."
}
else {
$pm->start($name) and next;
eval {
$repo->update_from_remote();
1;
} or do {
} or do {

# If creds are invalid, explcitily reject them to try to clear the cache
# If creds are invalid, explcitily reject them to try to clear the cache
my $error = $@;
if ( $error =~ /Invalid username or password/ ) {
revoke_github_creds();
}
die $error;
};
$pm->finish;
}
}
$pm->wait_all_children;

Expand Down Expand Up @@ -629,6 +640,7 @@ sub usage {
--lang Defaults to 'en'
--resource Path to image dir - may be repeated
--skiplinkcheck Omit the step that checks for broken links
--linkcheckonly Skips the documentation builds. Checks links only.

WARNING: Anything in the `out` dir will be deleted!

Expand Down