Reputation: 2808
At work, I have a GitLab setup as a Git repository to host a common composer package that can and will be used across multiple sites (a symfony2 bundle for what it's worth). Not a totally uncommon practice.
I managed to configure the composer.json's to see eachother:
On the site im working on right now, I have:
"repositories": [
{
"type": "package",
"package": {
"name": "coresystem/tools-bundle",
"version": "dev-master",
"source": {
"url": "{sorry this is private}",
"type": "git",
"reference": "master"
},
"autoload": {
"psr-0": {
"CoreSystem\\ToolsBundle": "src"
}
}
}
}
]
and on the packages repository:
{
"name": "coresystem/tools-bundle",
"type": "symfony-bundle",
"description": "A collection of common use tools across the network of core sites",
"license": "DBAD",
"authors": [
{
"name": "Kyle Harrison",
"email": "{private, sorry}"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0",
"symfony/framework-bundle": "~2.5"
},
"autoload": {
"psr-0": {
"CoreSystemToolsBundle": "src/"
}
}
}
On the site, when I ran $ composer require coresystems/tools-bundle dev-master
it worked just fine. It downloaded the repo, installed it. everything was great.
Until I needed to update the tools bundle.
I made my changes, and pushed them to the tools gitlab repo.
But on the site, when I ran $ composer update coresystems/tools-bundles
it says there was nothing to update.
Out of desperation I started setting up some tags, pushing those, and trying things like $ composer update coresystems/tool-bundle 1.*@dev
and such, to no avail.
In order to get it to work, i had to run $ composer remove coresystems/tools-bundle
first, and then run $ composer require coresystems/tools-bundle dev-master
again for it to reclone the repository
What gives?
Upvotes: 0
Views: 1473
Reputation: 70863
Don't use type:package
as the repository description. This is too much manual work to be done, because Composer can detect everything it needs to know if you are using a supported repository (SVN, Git, Mercurial) and have committed a composer.json
file into it.
Simply give Composer the location of the repository by using:
"repositories" : [
{ "type":"vcs", "url":"your private URL of the Git repo"}
]
This is all. No need to duplicate the autoload definition, or anything else that is required to be mentioned in the package description.
Upvotes: 2