Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updating build number generation

  • Loading branch information...
commit affbedbdf36f60d0238fc78dbbb2e728de3d3a41 1 parent b17e9c5
Jonathan Moss authored
Showing with 19 additions and 4 deletions.
  1. +3 −3 build.xml
  2. +16 −1 src/bootstrap.php
View
6 build.xml
@@ -109,17 +109,17 @@
</copy>
<delete file="${package.file}" quiet="true" />
-
+ <property name="BUILD_NUMBER" value="local(${date.build})" override="false"/>
<pharpackage basedir="export" destfile="${package.file}" compression="gzip" stub="src/bootstrap.php" alias="${package.title}">
<fileset dir="export">
<include name="**/*" />
- </fileset>
+ </fileset>
<metadata>
<element name="Title" value="${package.title}" />
<element name="Author" value="${package.author}" />
<element name="Description" value="${package.description}" />
<element name="Copyright" value="${package.copyright} ${date.year}" />
- <element name="Build" value="${date.build}" />
+ <element name="Build" value="${BUILD_NUMBER}" />
<element name="Created Date" value="${date.created}" />
</metadata>
</pharpackage>
View
17 src/bootstrap.php
@@ -75,7 +75,7 @@ public function processParameters(array $argv)
$switches = array();
$commands = array();
foreach (array_slice($argv, 1) as $arg) {
- if (substr($arg, 0, 2) == '--') {
+ if (substr($arg, 0, 2) == '--' || substr($arg, 0, 1) == '-') {
$switches[] = $arg;
} else {
$commands[] = $arg;
@@ -97,7 +97,13 @@ public function processParameters(array $argv)
$this->printHeader($filename);
$this->listContent($filename);
break;
+ case in_array('version', $commands):
+ case in_array('--version', $switches):
+ case in_array('-v', $switches):
+ $this->listVersion($filename);
+ break;
case in_array('--help', $switches):
+ case in_array('-h', $switches):
case in_array('help', $commands):
default:
$this->printHeader($filename);
@@ -147,6 +153,13 @@ private function listContent($filename)
}
}
+ private function listVersion($filename)
+ {
+ $p = new Phar($filename, 0);
+ $meta = $p->getMetadata();
+ echo "Build: " . $meta['Build'] . "\n";
+ }
+
/**
* @param string $filename
* @return void
@@ -177,9 +190,11 @@ private function printHelp()
test Runs the unit test suite
help Show this usage information
list Lists the metadata and file content of this library
+ version Lists the build number of this library
Switches:
--testdox Will output a test results in the testdox format
+ --version Lists the build number of this library
EOD;
Please sign in to comment.
Something went wrong with that request. Please try again.