-
Notifications
You must be signed in to change notification settings - Fork 9
/
ymir
executable file
·52 lines (41 loc) · 1.51 KB
/
ymir
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
#!/usr/bin/env php
<?php
/*
* This file is part of Ymir command-line tool.
*
* (c) Carl Alexander <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Ymir\Cli\Application;
/**
* Determine vendor directory.
*/
$vendorDirectory = '';
if (file_exists(__DIR__.'/../../autoload.php')) {
$vendorDirectory = __DIR__.'/../..';
} elseif (file_exists(__DIR__.'/vendor/autoload.php')) {
$vendorDirectory = __DIR__.'/vendor';
}
if (empty($vendorDirectory)) {
throw new \RuntimeException('Unable to find vendor directory');
}
require $vendorDirectory.'/autoload.php';
$container = new ContainerBuilder();
// Load manual parameters
$container->setParameter('application_directory', __DIR__);
$container->setParameter('home_directory', rtrim(getenv('HOME'), '/'));
$container->setParameter('vendor_directory', $vendorDirectory);
$container->setParameter('working_directory', rtrim(getcwd(), '/'));
$container->setParameter('ymir_api_url', getenv('YMIR_API_URL') ?: 'https://ymirapp.com/api');
// Load container configuration
$loader = new YamlFileLoader($container, new FileLocator());
$loader->load(__DIR__.'/config/services.yml');
// Compile container
$container->compile();
// Start the console application.
exit($container->get(Application::class)->run());