作曲家和多个分支 [英] Composer and multiple branches
问题描述
我有一个git项目,有两个分支:
- Master:目前是stable branch
- Devel:下一个版本的开发分支。
在主控中,我有一个要求在我的 composer.json
使用特定版本:
require:{
pre>
triagens / arangodb:1.2.1,
php:> = 5.4.0
},
在我的devel分支中,我想使用依赖的开发版本:
require:{
triagens / arangodb:dev-devel,
php:> = 5.4.0
}
有效地,当分支切换时,
composer install
或composer update
运行我想让composer更新/将依赖关系更改为适当的版本。
由于
composer install --dev
不支持在require-dev
中具有不同版本的依赖项,因此我不能在require-dev
部分中设置不同的版本。
我也希望没有单独的<$
如果你有多个分支,每个分支使用一些版本
解决方案您可以维护多个版本的
composer .json
使用不同的名称:
-
composer.master.json
-
composer.dev.json
然后当你调用 composer.phar install
或 composer.phar update
要使用的作曲家文件:
-
COMPOSER = composer.master.json php composer.phar update
-
COMPOSER = composer.dev.json php composer.phar update
请参阅 CLI文档。
I have a git project with 2 branches:
- Master: Currently the "stable branch" but subjected to changed. Releases are tagged from there.
- Devel: A development branch for the next version. This is merged into master when we think some features from here are quite stable.
In master, I have a requirement in my composer.json
that uses a specific version:
"require" : {
"triagens/arangodb" : "1.2.1",
"php" : ">=5.4.0"
},
In my devel branch, I would like to use the development version of the dependency:
"require" : {
"triagens/arangodb" : "dev-devel",
"php" : ">=5.4.0"
},
Effectively, when branches are switched, and composer install
or composer update
is run I would like to have composer update/change the dependencies to the appropriate versions.
Since composer install --dev
does not support having a different version of a dependency in require-dev
, I cannot set the different version in the require-dev
section.
I would also prefer to not have a separate composer.json
for each branch as merge would be quite painful.
If you have multiple branches and each branch uses some version of a dependency, what's the best way to do this?
You can maintain multiple versions of composer.json
under different names:
composer.master.json
composer.dev.json
Then when you call composer.phar install
or composer.phar update
, you can preface the desired composer file to use:
COMPOSER=composer.master.json php composer.phar update
COMPOSER=composer.dev.json php composer.phar update
See the CLI docs.
这篇关于作曲家和多个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!