Skip to content

Commit

Permalink
code refactoring - step 2
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Dec 30, 2018
1 parent c728bc0 commit 5d283d3
Show file tree
Hide file tree
Showing 33 changed files with 2,804 additions and 2,158 deletions.
33 changes: 33 additions & 0 deletions bin/compatinfo-db
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env php
<?php
// @link https://www.tomasvotruba.cz/blog/2018/08/02/5-gotchas-of-the-bin-file-in-php-cli-applications/

declare(strict_types=1);

gc_disable(); // performance boost

$possibleAutoloadPaths = [
// local dev repository
__DIR__ . '/../vendor/autoload.php',
// dependency
__DIR__ . '/../../../../vendor/autoload.php',
];

$isAutoloadFound = false;
foreach ($possibleAutoloadPaths as $possibleAutoloadPath) {
if (file_exists($possibleAutoloadPath)) {
require_once $possibleAutoloadPath;
$isAutoloadFound = true;
break;
}
}

if ($isAutoloadFound === false) {
throw new RuntimeException(sprintf(
'Unable to find "vendor/autoload.php" in "%s" paths.',
implode('", "', $possibleAutoloadPaths)
));
}

$application = new \Bartlett\CompatInfoDb\Presentation\Console\Application('Database handler for CompatInfo');
$application->run();
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
"ext-spl": "*",
"ext-json": "*",
"ext-pdo_sqlite": "*",
"symfony/console": "^3.0||^4.0"
"symfony/console": "^3.0||^4.0",
"jean85/pretty-package-versions": "^1.2",
"league/tactician": "^1.0",
"zendframework/zenddiagnostics": "^1.3"
},
"require-dev": {
"psr/log": "^1.0",
Expand Down
218 changes: 217 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5d283d3

Please sign in to comment.