Skip to content

Commit 0fc05e4

Browse files
committed
feat: split Doctum binary into a new file
1 parent edef4fa commit 0fc05e4

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

bin/doctum-binary.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
if (PHP_MAJOR_VERSION <= 7 && PHP_MINOR_VERSION < 1) {
4+
echo 'You need to use PHP 7.1 or above to run Doctum.' . PHP_EOL;
5+
echo 'Current detected version: (' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . ') (' . PHP_VERSION_ID . ').' . PHP_EOL;
6+
exit(1);
7+
}
8+
9+
// installed via composer?
10+
$composerDir = __DIR__ . '/../../../autoload.php';
11+
if (file_exists($composerDir)) {
12+
require_once $composerDir;
13+
} else {
14+
require_once __DIR__ . '/../vendor/autoload.php';
15+
}
16+
17+
use Doctum\Console\Application;
18+
19+
$application = new Application();
20+
$application->run();

bin/doctum.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
#!/usr/bin/env php
22
<?php
33

4-
if (PHP_MAJOR_VERSION <= 7 && PHP_MINOR_VERSION < 1) {
5-
echo 'You need to use PHP 7.1 or above to run Doctum.' . PHP_EOL;
6-
echo 'Current detected version: (' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . ') (' . PHP_VERSION_ID . ').' . PHP_EOL;
7-
exit(1);
8-
}
9-
10-
// installed via composer?
11-
$composerDir = __DIR__ . '/../../../autoload.php';
12-
if (file_exists($composerDir)) {
13-
require_once $composerDir;
14-
} else {
15-
require_once __DIR__ . '/../vendor/autoload.php';
16-
}
17-
18-
use Doctum\Console\Application;
19-
20-
$application = new Application();
21-
$application->run();
4+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'doctum-binary.php';

scripts/phar-generator-script.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
$pharFilesList = $phar->buildFromDirectory($srcRoot, '/((?!vendor\/[0-9A-Za-z-]+\/[0-9A-Za-z-]+\/(tests|test|CHANGELOG|\.travis\.yml|.*\.md|.*\.rst|\.editorconfig|phpunit\.xml|Makefile|phpbench\.json|\.php_cs\.dist|phive\.xml|phpstan\.neon|phpcs\.xml\.dist|phpunit\.xml\.dist|\.scrutinizer\.yml|drupal_test\.sh|\.gitattributes|\.gitignore|psalm\.xml|\.dependabot|\.github|psalm\.xml))(bin|vendor)\/.*)|((?!src\/Resources\/themes\/default\/data)(src\/.*|locale\/.*\.mo))$/');
3232

33-
$phar->setStub($phar->createDefaultStub('bin/doctum.php'));
33+
$phar->setStub($phar->createDefaultStub('bin/doctum-binary.php'));
3434
$phar->setSignatureAlgorithm(Phar::SHA256);
3535

3636
$files = array_map(

0 commit comments

Comments
 (0)