Skip to content

Commit

Permalink
[DOCS] Added --linkcheckonly parameter for build_docs.pl (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Nov 22, 2017
1 parent 603cc0b commit ff56570
Showing 1 changed file with 23 additions and 11 deletions.
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

0 comments on commit ff56570

Please sign in to comment.