From 5498b8d6a04f5c111a0bbdf57af5dbdde5707d08 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 24 May 2012 20:36:47 +0200 Subject: [PATCH] Add COMPOSER_ROOT_VERSION env var to override the root version --- doc/03-cli.md | 5 +++++ src/Composer/Package/Loader/RootPackageLoader.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/doc/03-cli.md b/doc/03-cli.md index 94d5b001a..0c3343010 100644 --- a/doc/03-cli.md +++ b/doc/03-cli.md @@ -189,6 +189,11 @@ For example: $ COMPOSER=composer-other.json php composer.phar install +### COMPOSER_ROOT_VERSION + +By setting this var you can specify the version of the root package, if it can +not be guessed from VCS info and is not present in `composer.json`. + ### COMPOSER_VENDOR_DIR By setting this var you can make composer install the dependencies into a diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index b88b3e866..b50e69d8b 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -53,6 +53,11 @@ class RootPackageLoader extends ArrayLoader } } + // override with env var if available + if (getenv('COMPOSER_ROOT_VERSION')) { + $version = getenv('COMPOSER_ROOT_VERSION'); + } + $config['version'] = $version; } else { $version = $config['version'];