Skip to content

Commit

Permalink
Merge pull request #89 from xsist10/version_detection
Browse files Browse the repository at this point in the history
Automate the version detection
  • Loading branch information
xsist10 authored Jan 1, 2023
2 parents 5402403 + 01f8bda commit fe01a40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion bin/cadfael
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php
}

use Symfony\Component\Console\Application;
use Composer\InstalledVersions as InstalledVersionsAlias;
use Cadfael\Cli\Command\RunCommand;
use Cadfael\Cli\Command\AboutCommand;

$version = InstalledVersionsAlias::getPrettyVersion('cadfael/cadfael');
// Swap out version for git tag if we're dealing with a phar generated with box
if ($version === 'dev-master' && (int)'@is_phar@') {
$version = '@git_tag@';
}

$application = new Application();
$application->setName('Cadfael CLI');
$application->setVersion('0.2.6');
$application->setVersion($version);
$application->add(new AboutCommand());
$application->add(new RunCommand());
$application->run();
6 changes: 5 additions & 1 deletion box.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
"vendor/vimeo",
"vendor/webmozart"
],
"output": "cadfael.phar"
"output": "cadfael.phar",
"git": "git_tag",
"replacements": {
"is_phar": "1"
}
}

0 comments on commit fe01a40

Please sign in to comment.