当前位置: 动力学知识库 > 问答 > 编程问答 >

symfony2 - Symfony 2.1, composer and git repositories

问题描述:

With Symfony 2.0.x I store all my client side dependencies (jQuery, etc) in the deps file so I can easily update them all at once with vendor/install, with the switch to composer in 2.1 this is not possible. My options appear to be:

  • Fork all repos and add in the composer.json file (pain in the butt and waste of time)
  • Manually download them all and stick them inside my repo somewhere (also a pain in the butt)
  • Write my own Grunt script or something similar

Does anyone have a solution for handling this, or am I going about it all wrong?

网友答案:

Composer does have support for downloading libraries that are not Composer-aware. It's a little more work, but you can define each of your dependencies like this:

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "jquery/jquery",
                "version": "1.8.1",
                "dist": {
                    "url": "http://code.jquery.com/jquery-1.8.1.min.js",
                    "type": "file"
                }
            }
        }
    ],
    "require": {
        "jquery/jquery": "1.8.1"
    }
}

Read more about it here: http://getcomposer.org/doc/05-repositories.md#package-2.

This will download jQuery to vendors/jquery/jquery by default. I don't think there's a way to specify a directory outside of vendors at the moment, so that may considerably limit the usefulness of this suggestion.

FWIW, I would consider submitting a pull request/issue to the Composer Github project. This actually would make a whole lot of sense.

分享给朋友:
您可能感兴趣的文章:
随机阅读: