Skip to content

Commit

Permalink
updating build number generation
Browse files Browse the repository at this point in the history
  • Loading branch information
a-musing-moose committed Mar 1, 2011
1 parent b17e9c5 commit affbedb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions build.xml
Expand Up @@ -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>
Expand Down
17 changes: 16 additions & 1 deletion src/bootstrap.php
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit affbedb

Please sign in to comment.