-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathoe-eshop-unified_namespace_generator
executable file
·43 lines (38 loc) · 1.48 KB
/
oe-eshop-unified_namespace_generator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env php
<?php
/**
* Copyright © OXID eSales AG. All rights reserved.
* See LICENSE file for license details.
*/
use OxidEsales\UnifiedNameSpaceGenerator\UnifiedNameSpaceClassMapProvider;
$installationRootPath = dirname(__FILE__, 4);
$vendorPath = $installationRootPath . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR;
require_once $vendorPath . 'autoload.php';
/**
* We always want to provide clear state:
* - Before generating the files, the old ones are deleted in order not to end up with something 'mixed'
* - In case of error, all generated files will be deleted in order not to end up with something 'incomplete'
*/
try {
$generator = new \OxidEsales\UnifiedNameSpaceGenerator\Generator(new UnifiedNameSpaceClassMapProvider());
$generator->cleanupOutputDirectory();
$generator->generate();
} catch (\Exception $exception) {
$message = $exception->getMessage();
$code = $exception->getCode();
$traceString = $exception->getTraceAsString();
try {
$generator = new \OxidEsales\UnifiedNameSpaceGenerator\Generator(new UnifiedNameSpaceClassMapProvider());
$generator->cleanupOutputDirectory();
} catch (\Exception $exception) {
$message = $exception->getMessage();
$code = $exception->getCode();
$traceString = $exception->getTraceAsString();
}
echo $message . PHP_EOL;
echo "error code: $code" . PHP_EOL;
echo 'stack trace:' . PHP_EOL;
echo $traceString . PHP_EOL;
exit(1);
}
exit(0);