|
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 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
require_once(dirname(__FILE__).'/lib/preprocessor.lib.php'); |
|---|
| 14 |
require_once(dirname(__FILE__).'/lib/jBuildUtils.lib.php'); |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
if($_SERVER['argc'] < 3){ |
|---|
| 19 |
exit(1); |
|---|
| 20 |
} |
|---|
| 21 |
array_shift($_SERVER['argv']); |
|---|
| 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 |
?> |
|---|