Merge pull request #3352 from phansys/composer_version
Added branch-alias to version output when no tags presentpull/3357/head
commit
c33c5196b1
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer;
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Json\JsonFile;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
|
|
||||||
|
@ -44,6 +45,14 @@ class Compiler
|
||||||
}
|
}
|
||||||
$this->version = trim($process->getOutput());
|
$this->version = trim($process->getOutput());
|
||||||
|
|
||||||
|
$localConfig = __DIR__.'/../../composer.json';
|
||||||
|
$file = new JsonFile($localConfig);
|
||||||
|
$localConfig = $file->read();
|
||||||
|
|
||||||
|
if (isset($localConfig['extra']['branch-alias']['dev-master'])) {
|
||||||
|
$this->version = sprintf('%s (%s)', $localConfig['extra']['branch-alias']['dev-master'], $this->version);
|
||||||
|
}
|
||||||
|
|
||||||
$process = new Process('git log -n1 --pretty=%ci HEAD', __DIR__);
|
$process = new Process('git log -n1 --pretty=%ci HEAD', __DIR__);
|
||||||
if ($process->run() != 0) {
|
if ($process->run() != 0) {
|
||||||
throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.');
|
throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.');
|
||||||
|
|
Loading…
Reference in New Issue