2006-09-23 18:31:17 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Small command line script to bundle Doctrine classes.
|
|
|
|
*/
|
|
|
|
if (count($argv) < 2) {
|
2007-06-25 08:19:23 +04:00
|
|
|
echo "Usage: bundle.php [Target directory] <Library directory>\n\n".
|
|
|
|
"Note: If the library directory is ommited, the path will be deducted\n";
|
2006-09-23 18:31:17 +04:00
|
|
|
exit(1);
|
2007-06-25 08:19:23 +04:00
|
|
|
} else if (count($argv) == 3) {
|
|
|
|
$doctrineBaseDir = $argv[2];
|
|
|
|
} else {
|
|
|
|
$doctrineBaseDir = str_replace('tools/cli', 'lib', $_SERVER['PWD'], $Cnt);
|
|
|
|
|
|
|
|
if ($Cnt != 1) {
|
|
|
|
echo "Can't find library directory, please specify it as an argument\n";
|
|
|
|
exit(1);
|
|
|
|
}
|
2006-09-23 18:31:17 +04:00
|
|
|
}
|
|
|
|
|
2007-06-25 08:19:23 +04:00
|
|
|
$targetDir = $argv[1];
|
|
|
|
|
|
|
|
print "target: $targetDir\n";
|
|
|
|
print "base dire: $doctrineBaseDir\n";
|
2006-09-23 18:31:17 +04:00
|
|
|
|
|
|
|
set_include_path(get_include_path() . PATH_SEPARATOR . $doctrineBaseDir);
|
|
|
|
|
|
|
|
require_once 'Doctrine.php';
|
|
|
|
require_once 'Doctrine/Compiler.php';
|
|
|
|
|
2006-10-02 14:47:43 +04:00
|
|
|
spl_autoload_register(array('Doctrine', 'autoload'));
|
|
|
|
|
2006-09-23 18:31:17 +04:00
|
|
|
echo "Bundling classes ..." . PHP_EOL;
|
|
|
|
|
|
|
|
Doctrine_Compiler::compile($targetDir);
|
|
|
|
|
|
|
|
echo "Bundle complete." . PHP_EOL;
|
|
|
|
|
|
|
|
exit(0);
|
2007-06-25 08:19:23 +04:00
|
|
|
?>
|