From zeta-commits-return-311-apmail-incubator-zeta-commits-archive=incubator.apache.org@incubator.apache.org Sat Apr 16 07:29:54 2011 Return-Path: Delivered-To: apmail-incubator-zeta-commits-archive@minotaur.apache.org Received: (qmail 57803 invoked from network); 16 Apr 2011 07:29:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Apr 2011 07:29:54 -0000 Received: (qmail 85336 invoked by uid 500); 16 Apr 2011 07:29:53 -0000 Delivered-To: apmail-incubator-zeta-commits-archive@incubator.apache.org Received: (qmail 85286 invoked by uid 500); 16 Apr 2011 07:29:51 -0000 Mailing-List: contact zeta-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zeta-dev@incubator.apache.org Delivered-To: mailing list zeta-commits@incubator.apache.org Received: (qmail 85278 invoked by uid 99); 16 Apr 2011 07:29:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Apr 2011 07:29:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Apr 2011 07:29:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C229523889ED; Sat, 16 Apr 2011 07:29:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Sat, 16 Apr 2011 07:29:26 -0000 To: zeta-commits@incubator.apache.org From: jeromer@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110416072926.C229523889ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Subject: [zeta-commits] svn commit: r1093942 - /incubator/zetacomponents/website/Pakefile Author: jeromer Date: Sat Apr 16 07:29:26 2011 New Revision: 1093942 URL: http://svn.apache.org/viewvc?rev=1093942&view=rev Log: - Added "extractphpdoc" task # I did not have time to test it deeply # If anyone could try it and provide feedback on zeta-dev # that would be great :) Modified: incubator/zetacomponents/website/Pakefile Modified: incubator/zetacomponents/website/Pakefile URL: http://svn.apache.org/viewvc/incubator/zetacomponents/website/Pakefile?rev=1093942&r1=1093941&r2=1093942&view=diff ============================================================================== --- incubator/zetacomponents/website/Pakefile (original) +++ incubator/zetacomponents/website/Pakefile Sat Apr 16 07:29:26 2011 @@ -192,6 +192,101 @@ function run_tutorials( $task, $args ) gen_tutorial_index_file( $tutorialRootDir ); } + +pake_desc( + 'Extract API documentation from archive and copy it to the correct location in the content tree.' +); +pake_task( 'extractphpdoc', 'tutorials' ); + +/** + * Extracts PHPDoc files in .index.xml + * + * This task is dependent of the "tutorials" task + * + * @param pakeTask $task + * @param array $args + * @access public + * @return void + */ +function run_extractphpdoc( $task, $args ) +{ + $options = pakeYaml::loadFile( CONFIG_FILE ); + $tarballRootDir = 'content/documentation/' . $options['build.name']; + $phpDocRootDir = "${tarballRootDir}/phpdoc"; + + pake_echo_comment( 'Extracting tarball' ); + + $tarball = ezcArchive::open( + "compress.bzip2://${tarballRootDir}/phpdoc.tar.bz2", + ezcArchive::TAR_USTAR + ); + $tarball->extract( $tarballRootDir ); + + $rule = pakeFinder::type('dir')->name( '*' ) + ->discard( 'phpdoc','design', 'Framework' ) + ->maxdepth( 0 ); + + $components = $rule->in( $tarballRootDir ); + sort( $components ); + + foreach( $components as $component ) + { + $componentName = basename( $component ); + pake_echo_comment( "Copy API docs for ${component}" ); + + $rule = pakeFinder::type('any')->name('*'); + + pake_remove( $rule, "${component}/phpdoc" ); + pake_mkdirs( "${component}/phpdoc" ); + $phpDocComponentDir = "${component}/phpdoc"; + + pake_mirror( + $rule, "${phpDocRootDir}/${componentName}", $phpDocComponentDir + ); + + $patterns = array( "#../#", '#"(\.\./)?([a-zA-Z]*)"#'); + + $replacements = array( + "${componentName}/", + '/zetacomponents/documentation/' . $options['build.name'] . '/\2/phpdoc/', + ); + + $xmlContents = ''; + $xmlContents .= ''; + $xmlContents .= 'Class treeclasstrees.html'; + + // pake_replace_regexp is not distributed yet + $rule = pakeFinder::type( 'file' )->name( '*.html' )->maxdepth( 0 ); + $phpDocFiles = $rule->in( $phpDocComponentDir ); + foreach( $phpDocFiles as $phpDocFile ) + { + pake_echo_action('tokens', $phpDocFile ); + + file_put_contents( + $phpDocFile, + preg_replace( + $patterns, + $replacements, + pake_read_file( $phpDocFile ) + ) + ); + + $docFilename = basename( $phpDocFile ); + // classtress.html is already handled above + if( $docFilename != 'classtrees.html' ) + { + $xmlContents .= ''.$docFilename.''.$docFilename.''; + } + } + + $xmlContents .= ''; + + pake_write_file( + "${phpDocComponentDir}/.index.xml", $xmlContents, $overwrite = true + ); + } +} + /* ------ "Private" functions ----------- */ function gen_tutorial_index_file( $tutorialRootDir )