Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
480 views
in Technique[技术] by (71.8m points)

symfony - Contributing to open source bundles from vendor directory?

Ideal Situation

Often while working on a Symfony2 project I will spot something I want to change in one of my dependencies. If I could find a way to simply change it in vendor and then easily push the changes as a pull request then I would probably contribute more often (rather than overriding the part with a local child bundle).

The Problem

I can't change a vendor directory without composer freaking out on the next update. If I submit a pull request then it may take quite some time before I can actually use the code in vendors, which is actually a deterrent from contributing my new functionality.

How I do it now

The way I typically contribute to a bundle is to make a fork, put the fork in a barebones symfony standard-edition app, make the change and then submit a pull request.

Put fork in composer.json?

The only solution I can think of, is removing the packagist dependency of the bundle I am editing, and then including my fork with composer (as a package) from github. That way I get my code immediately and can still contribute.

Is this the only solution? How do you do it?

Any tips/advice for contributing to a bundle while working on a different project at the same time would be appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Nah... this is broken.

I've tried the official way to include a fork, here's an example (original:kitano, fork: jstoeffler) of the composer.json :

(For those who are in a hurry: THIS DOESNT WORK)

"repositories": [
//...
    {
        "type": "vcs",
        "url": "https://github.com/jstoeffler/KitanoConnectionBundle",

    },
//...
],

It keeps using the original bundle. Don't know what the problem is, and I don't get how everything works, but here's how I successfully add a fork to a project.

"repositories": [
//...
    {
        "type": "package",
        "package": {
            "name": "kitano/connection-bundle",
            "version": "dev-master",
            "source": {
                "url": "https://github.com/jstoeffler/KitanoConnectionBundle.git",
                "type": "git",
                "reference": "master"
            },
            "autoload": {
                "classmap": [""]
            }
        }
    },
//...
],

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...