4

2 つの symfony2 プロジェクトの依存関係を管理するために composer を使用しています。これら 2 つのプロジェクトにはいくつかの共通点があるため、両方の 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 つのプロジェクト間でクラスを重複させないための便利な方法です。したがって、共通バンドルの変更は、常に私の 2 つのプロジェクトのいずれかから発生します。プロジェクトから共通バンドルをコミット可能にするにはどうすればよいですか?

4

2 に答える 2

0

commonbundle リポジトリを各プロジェクトに git サブモジュールとして追加できますか?

cd /path/to/Proj1
git submodule add path/to/commonbundle commonbundle
git commit -m "added submodule"
[repeat for Proj 2]
于 2013-04-26T06:55:19.860 に答える