From ba5d5e864584bbad0a486f2f86f62ef340aeeade Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 21 Dec 2015 06:58:56 +0100 Subject: [PATCH] Load version number from file --- .gitignore | 1 + README.rst | 3 +-- build.xml | 9 ++++++++- src/phpsqllint/Cli.php | 7 ++++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c1e6936..2458a03 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /README.html /dist /bin/phar-php-sqllint.php +VERSION diff --git a/README.rst b/README.rst index e02ff6b..d4ae83c 100644 --- a/README.rst +++ b/README.rst @@ -96,8 +96,7 @@ Building Preparation =========== -- Adjust version number in ``src/phpsqllint/Cli.php`` -- Adjust version number in ``build.xml`` +1. Write new version number into ``VERSION`` Create the release diff --git a/build.xml b/build.xml index 9585aa1..4d1b07e 100644 --- a/build.xml +++ b/build.xml @@ -1,7 +1,13 @@ - + + + + + + + @@ -12,6 +18,7 @@ + diff --git a/src/phpsqllint/Cli.php b/src/phpsqllint/Cli.php index 1448a53..4edcf66 100644 --- a/src/phpsqllint/Cli.php +++ b/src/phpsqllint/Cli.php @@ -163,9 +163,14 @@ class Cli { $parser = new \Console_CommandLine(); $parser->description = 'php-sqllint'; - $parser->version = '0.0.2'; + $parser->version = 'dev'; $parser->avoid_reading_stdin = true; + $versionFile = __DIR__ . '/../../VERSION'; + if (file_exists($versionFile)) { + $parser->version = trim(file_get_contents($versionFile)); + } + $parser->addOption( 'format', array( -- 2.30.2