root/trunk/build/preprocess.php

Revision 292, 1.3 kB (checked in by laurentj, 2 years ago)

nouveau système de build en php

Line 
1 <?php
2
3 /**
4 * @package     jBuildTools
5 * @version     $Id$
6 * @author      Jouanneau Laurent
7 * @contributor
8 * @copyright   2006 Jouanneau laurent
9 * @link        http://www.jelix.org
10 * @licence     GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html
11 */
12
13 require_once(dirname(__FILE__).'/lib/preprocessor.lib.php');
14 require_once(dirname(__FILE__).'/lib/jBuildUtils.lib.php');
15
16 // arguments :  chemin_source chemin_dist
17
18 if($_SERVER['argc'] < 3){
19    exit(1);
20 }
21 array_shift($_SERVER['argv']); // shift the script name
22 $restrictedDirectory = '';
23 $options = array('verbose'=>false);
24
25 if(substr($_SERVER['argv'][0],0,1) == '-'){
26   $sw = substr(array_shift($_SERVER['argv']),1);
27   $options['verbose'] = (strpos($sw, 'v') !== false);
28   if(strpos($sw,'d') !== false){
29      $restrictedDirectory = array_shift($_SERVER['argv']);
30   }
31
32 }
33
34 list($sourcefile, $distfile) = $_SERVER['argv'];
35
36 if($restrictedDirectory !=''){
37    $s = realpath($sourcefile);
38    if(strpos($s, $restrictedDirectory) !==0){
39       exit(1);
40    }
41 }
42 try{
43
44     $proc = new jPreProcessor();
45     $proc->setVars($_SERVER);
46     $dist = $proc->parseFile($sourcefile);
47
48 }catch(Exception $e){
49   echo $e;
50   exit(1);
51 }
52
53 jBuildUtils::createDir(dirname($distfile));
54 file_put_contents($distfile, $dist);
55 exit(0);
56
57 ?>
Note: See TracBrowser for help on using the browser.
Download in other formats: Plain Text Original Format