Skip to content

Commit

Permalink
Add --out-preserve to preserve contents of output path.
Browse files Browse the repository at this point in the history
Useful for building a single set of documentation over multiple doc.pl runs.
  • Loading branch information
dwsteele committed May 16, 2019
1 parent bc30027 commit a4561dc
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 36 deletions.
21 changes: 21 additions & 0 deletions doc/doc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ =head1 SYNOPSIS
--key-var Override defined variable and use in cache key
--doc-path Document path to render (manifest.xml should be located here)
--out Output types (html, pdf, markdown)
--out-preserve Don't clean output directory
--require Require only certain sections of the document (to speed testing)
--include Include source in generation (links will reference website)
--exclude Exclude source from generation (links will reference website)
Expand All @@ -90,6 +91,7 @@ =head1 SYNOPSIS
my $rhKeyVariableOverride = {};
my $strDocPath;
my @stryOutput;
my $bOutPreserve = false;
my @stryRequire;
my @stryInclude;
my @stryExclude;
Expand All @@ -103,6 +105,7 @@ =head1 SYNOPSIS
'quiet' => \$bQuiet,
'log-level=s' => \$strLogLevel,
'out=s@' => \@stryOutput,
'out-preserve' => \$bOutPreserve,
'require=s@' => \@stryRequire,
'include=s@' => \@stryInclude,
'exclude=s@' => \@stryExclude,
Expand Down Expand Up @@ -278,6 +281,24 @@ =head1 SYNOPSIS

&log(INFO, "render ${strOutput} output");

# Clean contents of out directory
if (!$bOutPreserve)
{
my $strOutputPath = $strOutput eq 'pdf' ? "${strOutputPath}/latex" : "${strOutputPath}/$strOutput";

# Clean the current out path if it exists
if (-e $strOutputPath)
{
executeTest("rm -rf ${strOutputPath}/*");
}
# Else create the html path
else
{
mkdir($strOutputPath)
or confess &log(ERROR, "unable to create path ${strOutputPath}");
}
}

if ($strOutput eq 'markdown')
{
my $oMarkdown =
Expand Down
12 changes: 0 additions & 12 deletions doc/lib/BackRestDoc/Html/DocHtmlSite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@ sub new
{name => 'bExe'}
);

# Remove the current html path if it exists
if (-e $self->{strHtmlPath})
{
executeTest("rm -rf $self->{strHtmlPath}/*");
}
# Else create the html path
else
{
mkdir($self->{strHtmlPath})
or confess &log(ERROR, "unable to create path $self->{strHtmlPath}");
}

# Return from function and log return values if any
return logDebugReturn
(
Expand Down
12 changes: 0 additions & 12 deletions doc/lib/BackRestDoc/Latex/DocLatex.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@ sub new
{name => 'bExe'}
);

# Remove the current html path if it exists
if (-e $self->{strLatexPath})
{
executeTest("rm -rf $self->{strLatexPath}/*");
}
# Else create the html path
else
{
mkdir($self->{strLatexPath})
or confess &log(ERROR, "unable to create path $self->{strLatexPath}");
}

# Return from function and log return values if any
return logDebugReturn
(
Expand Down
12 changes: 0 additions & 12 deletions doc/lib/BackRestDoc/Markdown/DocMarkdown.pm
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,6 @@ sub new
{name => 'bExe'}
);

# Remove the current html path if it exists
if (-e $self->{strMarkdownPath})
{
executeTest("rm -rf $self->{strMarkdownPath}/*");
}
# Else create the html path
else
{
mkdir($self->{strMarkdownPath})
or confess &log(ERROR, "unable to create path $self->{strMarkdownPath}");
}

# Return from function and log return values if any
return logDebugReturn
(
Expand Down
4 changes: 4 additions & 0 deletions doc/xml/release.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@
<release-item>
<p>Automate coverage summary report generation.</p>
</release-item>

<release-item>
<p>Add <setting>--out-preserve</setting> to preserve contents of output path.</p>
</release-item>
</release-development-list>
</release-doc-list>

Expand Down

0 comments on commit a4561dc

Please sign in to comment.