incubator-zeta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jero...@apache.org
Subject [zeta-commits] svn commit: r1094112 - /incubator/zetacomponents/website/Pakefile
Date Sun, 17 Apr 2011 07:38:33 GMT
Author: jeromer
Date: Sun Apr 17 07:38:32 2011
New Revision: 1094112

URL: http://svn.apache.org/viewvc?rev=1094112&view=rev
Log:
- Added "docs" task

Modified:
    incubator/zetacomponents/website/Pakefile

Modified: incubator/zetacomponents/website/Pakefile
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/website/Pakefile?rev=1094112&r1=1094111&r2=1094112&view=diff
==============================================================================
--- incubator/zetacomponents/website/Pakefile (original)
+++ incubator/zetacomponents/website/Pakefile Sun Apr 17 07:38:32 2011
@@ -287,6 +287,64 @@ function run_extractphpdoc( $task, $args
     }
 }
 
+pake_desc(
+    'Build all docs for the release specified by the environment variable zeta.base'
+);
+pake_task( 'docs', 'extractphpdoc' );
+
+function run_docs( $task, $args )
+{
+    $options = pakeYaml::loadFile( CONFIG_FILE );
+
+    pake_echo_comment( 'Generating index and overview files' );
+
+    $rule = pakeFinder::type( 'dir' )
+                        ->name( '*' )
+                        ->discard( 'phpdoc', 'design' )
+                        ->maxdepth( 0 );
+
+    $componentsRootDir = 'content/documentation/' . $options['build.name'];
+    $components = $rule->in( $componentsRootDir );
+
+    $overviewFile = "${componentsRootDir}/overview.txt";
+
+    pake_copy(
+        'content/documentation/teaser.txt',
+        $overviewFile,
+        array( 'override' => true )
+    );
+
+    $overviewTxt    = pake_read_file( $overviewFile );
+    $componentLinks = '';
+
+    $xmlContents  = '<?xml version="1.0" encoding="utf-8"?>';
+    $xmlContents .= "<index>";
+
+    foreach( $components as $component )
+    {
+        $componentName = basename( $component );
+
+        $xmlContents .= "<directory><name>${componentName}</name><path>${componentName}/</path></directory>";
+
+        // for overview.txt
+        $overviewTxt    .= "- ${componentName}__\n";
+        $componentLinks .= '__ /zetacomponents/documentation/'
+                            . $options['build.name']
+                            . "/${componentName}/tutorial.html\n";
+    }
+
+    $xmlContents .= "</index>";
+
+    pake_write_file(
+        "${componentsRootDir}/.index.xml", $xmlContents, $overwrite = true
+    );
+
+    $overviewTxt = $overviewTxt . "\n" . $componentLinks;
+
+    pake_write_file(
+        $overviewFile, $overviewTxt, $overwrite = true
+    );
+}
 /* ------ "Private" functions ----------- */
 
 function gen_tutorial_index_file( $tutorialRootDir )



Mime
View raw message