ReynierPM
ReynierPM

Reputation: 18690

Use fork instead of the original repository

On many occasions I have made forks from some repositories in order to correct the bugs or add new features as a contribution. In this case, when I do the PR the developers behind master repository, sometimes, take days to make the merge and test that all is well and most of the time I need to test on these changes in hot or at the time that I am performing.

Such is the case of SpBowerBundle which have made a fork and fix some things. I've done the PR but I can not wait for the developer to perform their tests and do the merge. The only solution is to point the composer.json to the fork I've done but do not how.

This is the forked repository and this is the commit I made. As addition here is my composer.json content:

{
    "name": "NewProject",
    "license": "MIT",
    "type": "project",
    "description": "NewProject",
    "autoload": {
        "psr-4": {
            "": "src/"
        }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.5.*",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "~1.2",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~3.0",
        "sensio/framework-extra-bundle": "3.0.*@dev",
        "friendsofsymfony/user-bundle": "~2.0@dev",
        "friendsofsymfony/jsrouting-bundle": "2.0.*@dev",
        "friendsofsymfony/rest-bundle": "1.5.*@dev",
        "jms/serializer-bundle": "0.13.*@dev",
        "jms/di-extra-bundle": "1.4.*@dev",
        "jms/security-extra-bundle": "dev-master",
        "knplabs/knp-paginator-bundle": "2.4.*@dev",
        "knplabs/knp-menu": "2.0.*@dev",
        "knplabs/knp-menu-bundle": "2.0.*@dev",
        "stof/doctrine-extensions-bundle": "1.2.*@dev",
        "nelmio/api-doc-bundle": "2.7.*@dev",
        "genemu/form-bundle": "2.2.*@dev",
        "misd/phone-number-bundle": "~1.0",
        "liip/monitor-bundle": "dev-master",
        "raulfraile/ladybug-bundle": "~1.0",
        "sp/bower-bundle": "0.12.*@dev",
        "h4cc/alice-fixtures-bundle": "dev-bug/30-command-reference"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3"
    },
    "scripts": {
        "post-root-package-install": [
            "SymfonyStandard\\Composer::hookRootPackageInstall"
        ],
        "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",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Liip\\MonitorBundle\\Composer\\ScriptHandler::checkHealth"
        ],
        "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",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Liip\\MonitorBundle\\Composer\\ScriptHandler::checkHealth"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
            "dev-master": "2.5-dev"
        },
        "symfony-assets-install": "symlink"
    }
}

How do I point my composer to the forked repository? Which is the best way to deal with this?

Update

After @Cerad suggestion I made this changes to composer.json file but still not updating from fork, what I'm doing wrong?

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/Spea/SpBowerBundle.git"
    }
],
"require": {
    ....
    "sp/bower-bundle": "dev-master",
},

Upvotes: 2

Views: 308

Answers (1)

qooplmao
qooplmao

Reputation: 17759

Add your repository to the repositories and, providing it has the original composer.json, it should use that instead.

{
    ....
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/paquitodev/SpBowerBundle"
        }
    ],
    ....
}

Upvotes: 3

Related Questions