-
Notifications
You must be signed in to change notification settings - Fork 1
/
mpmerge
executable file
·62 lines (53 loc) · 1.57 KB
/
mpmerge
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env php
<?php
ini_set('register_argc_argv', 1);
$autoloads = [
__DIR__ . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php'
];
foreach ($autoloads as $file) {
if (file_exists($file)) {
define('MPMERGE_COMPOSER_INSTALL', $file);
break;
}
}
unset($file);
if (!defined('MPMERGE_COMPOSER_INSTALL')) {
fwrite(STDERR,
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
'wget http://getcomposer.org/composer.phar' . PHP_EOL .
'php composer.phar install' . PHP_EOL
);
die(1);
}
include MPMERGE_COMPOSER_INSTALL;
\Xshifty\MyPhpMerge\Output::setup();
if (!function_exists('cprintln')) {
function cprintln()
{
$class = "\\Xshifty\\MyPhpMerge\\Output";
$method = "writeln";
$args = func_get_args();
return call_user_func_array([$class, $method], $args);
}
}
if (!function_exists('cprint')) {
function cprint()
{
$class = "\\Xshifty\\MyPhpMerge\\Output";
$method = "write";
$args = func_get_args();
return call_user_func_array([$class, $method], $args);
}
}
try {
$mergeFile = 'Mergefile.json';
$console = new \Xshifty\MyPhpMerge\Tools\Console($mergeFile, $argv);
$console->setup();
$console->run();
} catch (\RuntimeException $re) {
cprintln('<warning>WARN: ' . $re->getMessage() . '(' . $re->getFile() . ':' . $re->getLine() . ')' . '</warning>');
} catch (\Exception $e) {
cprintln('<error>ERR: ' . $e->getMessage() . '</error>');
}