cvs: peardoc /scripts pearwebbuild.php
[email protected] ("David JEAN LOUIS")
| Newsgroups | php.pear.doc |
|---|---|
| Message-ID | <cvsizi1233158178@cvsserver> |
izi Wed Jan 28 15:56:18 2009 UTC
Modified files:
/peardoc/scripts pearwebbuild.php
Log:
- fixed pathes to build.log,
- added gz and tar.gz downloadables formats for pearweb,
- added a downloaddir option that allows to move downloadable files to the
specified directory.
http://cvs.php.net/viewvc.cgi/peardoc/scripts/pearwebbuild.php?r1=1.13&r2=1.14&diff_format=u
Index: peardoc/scripts/pearwebbuild.php
diff -u peardoc/scripts/pearwebbuild.php:1.13 peardoc/scripts/pearwebbuild.php:1.14
--- peardoc/scripts/pearwebbuild.php:1.13 Fri Jan 2 14:24:15 2009
+++ peardoc/scripts/pearwebbuild.php Wed Jan 28 15:56:17 2009
@@ -12,7 +12,7 @@
$php_executable = 'php';
$phd_executable = 'phd';
$pear_executable = 'pear';
-$tobuildlog = ' >> build/build.log 2>&1';
+$tobuildlog = ' >> ' . dirname(__FILE__) . '/../build/build.log 2>&1';
$fails = 0;
if (isset($_SERVER['_'])) {
@@ -22,7 +22,7 @@
require_once 'Console/CommandLine.php';
$parser = new Console_CommandLine();
$parser->description = 'Builds the full manual';
-$parser->version = '$Id: pearwebbuild.php,v 1.13 2009/01/02 14:24:15 cweiske Exp $';
+$parser->version = '$Id: pearwebbuild.php,v 1.14 2009/01/28 15:56:17 izi Exp $';
$parser->addOption('updatecvs', array(
'long_name' => '--updatecvs',
'description' => 'Update peardoc from CVS',
@@ -38,6 +38,11 @@
'description' => 'Directory to copy php manual to',
'action' => 'StoreString'
));
+$parser->addOption('downloaddir', array(
+ 'long_name' => '--downloaddir',
+ 'description' => 'Directory to copy the downloadable manuals to',
+ 'action' => 'StoreString'
+));
try {
$cmdline = $parser->parse();
@@ -65,7 +70,7 @@
function logAndEcho($message)
{
echo $message . PHP_EOL;
- file_put_contents('build/build.log',
+ file_put_contents(dirname(__FILE__) . '/../build/build.log',
'[pearwebbuild] ' . $message . PHP_EOL,
FILE_APPEND
);
@@ -90,23 +95,34 @@
logAndEcho(' Rendering and bzipping pearbightml downloadable file');
shell_exec("$phd_executable -f xhtml -t pearbightml -o build/$lang -d giant.xml" . $tobuildlog);
+ // bzip2
passthru('bzip2'
. ' ' . escapeshellarg("build/$lang/pear_manual_en.html")
. ' --stdout'
- . ' > '
- . escapeshellarg("build/$lang/pear_manual_$lang.html.bz2")
+ . ' > ' . escapeshellarg("build/$lang/pear_manual_$lang.html.bz2")
);
+
+ // gz
+ passthru('gzip'
+ . ' ' . escapeshellarg("build/$lang/pear_manual_en.html")
+ . ' --stdout'
+ . ' > ' . escapeshellarg("build/$lang/pear_manual_$lang.html.gz")
+ );
+
+ // zip
passthru(
"cd build/$lang/ &&"
. 'zip -q'
. ' ' . escapeshellarg("pear_manual_$lang.html.zip")
. ' ' . escapeshellarg("pear_manual_en.html")
- . ' >> build/build.log'
+ . $tobuildlog
);
//chunkedhtml
logAndEcho(' Rendering and bzipping pearchunked downloadable zip');
shell_exec("$phd_executable -f xhtml -t pearchunkedhtml -o build/$lang -d giant.xml" . $tobuildlog);
+
+ // tar.bz2
passthru(
"cd build/$lang/ && mv html pear_manual_$lang && "
. 'tar cj --to-stdout'
@@ -114,8 +130,16 @@
. ' > '
. escapeshellarg("pear_manual_$lang.tar.bz2")
);
+ // tar.gz
passthru(
- "cd build/$lang/ &&"
+ "cd build/$lang/ && "
+ . ' tar cfz ' . escapeshellarg("pear_manual_$lang.tar.gz")
+ . ' ' . escapeshellarg("pear_manual_$lang")
+ . $tobuildlog
+ );
+ // zip
+ passthru(
+ "cd build/$lang/ && "
. 'zip -r'
. ' ' . escapeshellarg("pear_manual_$lang.zip")
. ' '
@@ -151,6 +175,24 @@
}
}
+ // move compressed downloadable files to downloaddir
+ if ($cmdline->options['downloaddir'] !== null) {
+ if (is_writeable($cmdline->options['downloaddir'])) {
+ logAndEcho(' Moving downloadable file to '
+ . escapeshellarg($cmdline->options['downloaddir']));
+ shell_exec('mv'
+ . ' ' . escapeshellarg("build/$lang/pear_manual_$lang.html.bz2")
+ . ' ' . escapeshellarg("build/$lang/pear_manual_$lang.html.gz")
+ . ' ' . escapeshellarg("build/$lang/pear_manual_$lang.html.zip")
+ . ' ' . escapeshellarg("build/$lang/pear_manual_$lang.tar.bz2")
+ . ' ' . escapeshellarg("build/$lang/pear_manual_$lang.tar.gz")
+ . ' ' . escapeshellarg("build/$lang/pear_manual_$lang.zip")
+ . ' ' . escapeshellarg($cmdline->options['downloaddir'])
+ . $tobuildlog
+ );
+ }
+ }
+
// Remove chm build until we can get a chm compiler going.
//shell_exec("$phd_executable -f xhtml -t pearchm -o build/$lang -d giant.xml" . $tobuildlog);
@@ -167,4 +209,4 @@
$fails && logAndEcho($fails . ' failed builds');
exit($fails);
-?>
\ No newline at end of file
+?>