svn: /pear/peardoc/trunk/scripts/ pearwebbuild.php

[email protected] (Christian Weiske)
Newsgroups php.pear.doc
Message-ID <[email protected]>
cweiske                                  Mon, 07 Dec 2009 21:16:10 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=291836

Log:
- make --norender not delete generated files
- restore old chunked directory name
- fix pearweb directory name when moving

Changed paths:
    U   pear/peardoc/trunk/scripts/pearwebbuild.php

Modified: pear/peardoc/trunk/scripts/pearwebbuild.php
===================================================================
--- pear/peardoc/trunk/scripts/pearwebbuild.php	2009-12-07 21:12:08 UTC (rev 291835)
+++ pear/peardoc/trunk/scripts/pearwebbuild.php	2009-12-07 21:16:10 UTC (rev 291836)
@@ -80,19 +80,22 @@
 function logAndEcho($message)
 {
     echo $message . PHP_EOL;
-    file_put_contents(dirname(__FILE__) . '/../build/build.log',
+    file_put_contents(
+        dirname(__FILE__) . '/../build/build.log',
         '[pearwebbuild] ' . $message . PHP_EOL,
         FILE_APPEND
     );
 }

+$render = !$cmdline->options['norender'];

 chdir(dirname(dirname(__FILE__)));

-passthru('rm -rf build/ && mkdir build');
+//only clean old cruft if we are rendering
+$render && passthru('rm -rf build/ && mkdir build');
+
 logAndEcho("Starting Build\n".date('Y-m-d H:i:s'));

-$render = !$cmdline->options['norender'];
 $langs = glob('??{,_??}', GLOB_ONLYDIR | GLOB_BRACE);
 $langs = array('en');
 foreach ($langs as $lang) {
@@ -119,14 +122,16 @@

         // bzip2
         logAndEcho(' Bzipping pearbightml downloadable file');
-        passthru('bzip2'
+        passthru(
+            'bzip2'
             . ' ' . escapeshellarg("build/$lang/pear-bigxhtml.html")
             . ' --stdout'
             . ' > ' . escapeshellarg("build/$lang/pear_manual_$lang.html.bz2")
         );

         // gz
-        passthru('gzip'
+        passthru(
+            'gzip'
             . ' ' . escapeshellarg("build/$lang/pear-bigxhtml.html")
             . ' --stdout'
             . ' > ' . escapeshellarg("build/$lang/pear_manual_$lang.html.gz")
@@ -146,22 +151,23 @@

         // tar.bz2
         passthru(
-            "cd build/$lang/ && mv pear-chunked-xhtml pear_manual_$lang && "
-            . 'tar cj --to-stdout'
+            "cd build/$lang/ &&"
+            . " mv pear-chunked-xhtml pear_manual_$lang &&"
+            . ' tar cj --to-stdout'
             . ' ' . escapeshellarg("pear_manual_$lang")
             . ' > '
             . 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/ && "
+            "cd build/$lang/ &&"
             . 'zip -r'
             . ' ' . escapeshellarg("pear_manual_$lang.zip")
             . ' '
@@ -169,6 +175,13 @@
             . $tobuildlog
         );

+        //restore old directory name for re-runs without recompilation
+        passthru(
+            "cd build/$lang/ &&"
+            . " mv pear_manual_$lang pear-chunked-xhtml"
+        );
+
+
         //pearweb package tocs
         if ($lang == 'en') {
             if ($render) {
@@ -189,7 +202,7 @@
             if (!file_exists($cmdline->options['phpdir'])) {
                 mkdir($cmdline->options['phpdir'], 0755, true);
             }
-            shell_exec("mv build/$lang/php " . escapeshellarg($phplangdir) . $tobuildlog);
+            shell_exec("mv build/$lang/pear-web " . escapeshellarg($phplangdir) . $tobuildlog);

             //move packagetoc over, too
             if (file_exists("build/$lang/packagetocs")) {
@@ -203,8 +216,8 @@
             if ($render) {
                 logAndEcho(' Compiling chm manual');
                 passthru(
-                    "chmod og+w build/$lang/pear-chm && "
-                    . "cd build/$lang/pear-chm && "
+                    "chmod og+w build/$lang/pear-chm &&"
+                    . " cd build/$lang/pear-chm && "
                     . $cmdline->options['hhc']
                     . ' pear_manual_' . $lang . '.hhp'
                     . $tobuildlog
@@ -225,9 +238,12 @@
         // 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'
+                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")
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.