1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Add --out-preserve to preserve contents of output path.

Useful for building a single set of documentation over multiple doc.pl runs.
This commit is contained in:
David Steele 2019-05-16 07:29:17 -04:00
parent bc30027d73
commit a4561dc087
5 changed files with 25 additions and 36 deletions

View File

@ -67,6 +67,7 @@ doc.pl [options]
--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)
@ -90,6 +91,7 @@ my $rhVariableOverride = {};
my $rhKeyVariableOverride = {};
my $strDocPath;
my @stryOutput;
my $bOutPreserve = false;
my @stryRequire;
my @stryInclude;
my @stryExclude;
@ -103,6 +105,7 @@ GetOptions ('help' => \$bHelp,
'quiet' => \$bQuiet,
'log-level=s' => \$strLogLevel,
'out=s@' => \@stryOutput,
'out-preserve' => \$bOutPreserve,
'require=s@' => \@stryRequire,
'include=s@' => \@stryInclude,
'exclude=s@' => \@stryExclude,
@ -278,6 +281,24 @@ eval
&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 =

View File

@ -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
(

View File

@ -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
(

View File

@ -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
(

View File

@ -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>