|
@@ -24,6 +24,7 @@ use Symfony\Component\Process\Process;
|
|
|
class Compiler
|
|
|
{
|
|
|
private $version;
|
|
|
+ private $versionDate;
|
|
|
|
|
|
/**
|
|
|
* Compiles composer into a single phar file
|
|
@@ -43,6 +44,14 @@ class Compiler
|
|
|
}
|
|
|
$this->version = trim($process->getOutput());
|
|
|
|
|
|
+ $process = new Process('git log -n1 --pretty=%ci HEAD', __DIR__);
|
|
|
+ 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.');
|
|
|
+ }
|
|
|
+ $date = new \DateTime(trim($process->getOutput()));
|
|
|
+ $date->setTimezone(new \DateTimeZone('UTC'));
|
|
|
+ $this->versionDate = $date->format('Y-m-d H:i:s');
|
|
|
+
|
|
|
$process = new Process('git describe --tags HEAD');
|
|
|
if ($process->run() == 0) {
|
|
|
$this->version = trim($process->getOutput());
|
|
@@ -127,6 +136,7 @@ class Compiler
|
|
|
}
|
|
|
|
|
|
$content = str_replace('@package_version@', $this->version, $content);
|
|
|
+ $content = str_replace('@release_date@', $this->versionDate, $content);
|
|
|
|
|
|
$phar->addFromString($path, $content);
|
|
|
}
|