LogicLooking
LogicLooking

Reputation: 928

github and composer. pulling repository branches

Composer cannot find the branch I want to clone from in the respository supplied in my json file. the error I get is:

 [UnexpectedValueException]
 Could not parse version constraint development: Invalid version string "dev
 elopment"

I assume I cannot say, go to this location, clone from this branch?

{
    "repositories": [
        {
            "type":"package",
            "package": {
                "name": "AdamKyle/Aisis-Core",
                "version":"development",
                "source": {
                    "url": "https://github.com/AdamKyle/Aisis-Core.git",
                    "type": "git",
                    "reference":"development"
                }
            }
        }
    ],
    "require": {
        "AdamKyle/Aisis-Core": "development"
    }
}

Upvotes: 9

Views: 5788

Answers (2)

nurikabe
nurikabe

Reputation: 4010

Just ran into this problem myself. I think the correct approach is to reference the branch under source and then give it a version of dev-branch:

{
    "repositories": [
        {
            "type":"package",
            "package": {
                "name": "AdamKyle/Aisis-Core",
                "version":"dev-development",
                "source": {
                    "url": "https://github.com/AdamKyle/Aisis-Core.git",
                    "type": "git",
                    "reference":"development"
                }
            }
        }
    ],
    "require": {
        "AdamKyle/Aisis-Core": "dev-development"
    }
}

Upvotes: 6

Danack
Danack

Reputation: 25701

You've just got the syntax wrong. You need to tell Composer to use a branch and then the branch name. So instead of:

"require": {
    "AdamKyle/Aisis-Core": "development"
}

assuming your branch is called 'development' it should be

"require": {
    "AdamKyle/Aisis-Core": "dev-development as 2.0.0"
}

The 2.0.0 to the right of the 'as' is the alias that your branch will be aliased to. This allows Composer to treat your branch as satisfying any other requirement for AdamKyle/Aisis-Core in the project with your branch version as version 2.0.0.

Upvotes: 9

Related Questions