git – 如何使作曲家依赖可承诺?

我正在使用composer来管理2个symfony2项目的依赖项.

由于这两个项目有一些共同的东西,我创建了一个(private)公共捆绑,这两个都是composer.json所必需的

这是我的composer.json:

{
  "name": "symfony/framework-standard-edition",
  "description": "The \"Symfony Standard Edition\" distribution",
  "repositories": [
    {
        "type": "vcs",
        "url":  "git@git.local:commonbundle.git"
    }
  ],
  "require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.2.*",
    "doctrine/orm": ">=2.2,<3.0,>=2.2.3",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.2.*",
    "symfony/monolog-bundle": "2.2.*",
    "sensio/distribution-bundle": "2.2.*",
    "sensio/framework-extra-bundle": "2.2.*",
    "sensio/generator-bundle": "2.2.*",
    "jms/security-extra-bundle": "1.4.*",
    "jms/di-extra-bundle": "1.3.*",
    "kriswallsmith/assetic": "1.1.*@dev",

    "doctrine/common": "2.4.*@dev",
    "doctrine/data-fixtures": "dev-master",
    "doctrine/doctrine-fixtures-bundle": "dev-master",
    "gmp/common-bundle" : "dev-master"
  },
  "scripts": {
    "post-install-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
  },
  "extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "symlink",
    "branch-alias": {
        "dev-master": "2.2-dev"
    }
  }
}

这很好用.但我希望能够从我的2个项目中更改和提交公共包中的更改.

我的观点是:普通捆绑不是独立的,不能独立工作.这只是一种不在我的2个项目之间复制类的方便方法.所以普通包的变化总是来自我的两个项目之一.
如何使我的项目中的公共包可以提交?

最佳答案 当您在其中一个主项目上运行composer install时,如果您执行–prefer-source,那么您应该能够将CD刻录到common-bundle的供应商目录中,进行更改并将其提交给它.

点赞