Reputation:
When I install a dependency from BitBucket (git repo) via vcs in the repository config it clones the repo. Then when I commit my parent project it doesn't commit the files, just a link reference to the dependency repo.
How do I
a) commit these files in parent git repo. So that they show up in BitBuckets interface (and other clones or downloaded zip files)
b) tell composer to download the zip file for dependency instead of cloning the repo. I have specified "preferred-install": "dist" in the composer.json but it did nothing. Note: this is a private repository.
Upvotes: 0
Views: 437
Reputation: 70863
First, you are not supposed to edit and/or commit from the repositories that get created in the /vendor
directory (or the location you defined to act as this directory).
The usual case is that you include a library from someone else, and you are not expected to have commit rights for than foreign repository. If you want to have a change made or a feature implemented, there might be a workflow like pull requests, issue tracker etc. To get your update, you wait for a new version to appear and then call composer update
.
The same rules apply for your own libraries. You should have noted that when you do not exclude the /vendor
directory via a .gitignore
in your main project, any remote repository cloned by Composer is treated as a git submodule. I guess (having no experience with them) that the usual rules for having submodules would apply then.
But I would recommend to not develop that way. You should really have two distinct repositories, each able to work on it's own - your library should be developed separate from the main project, and any development there can be pushed to BitBucket. You can then update the vendor directory with Composer.
Now the ZIP downloading: Composer has a special case handling if the repository is hosted at Github. Github provides an interface to download ZIP balls of the repository, with either tags, branches or commit ids as the key. These downloads are world-readable, so there is no authentication issue.
Your own library can also provide a download location for a ZIP file of that version. But it's quite a hassle to make sure it is always correctly maintained if you do it manually. I'd suggest you use a software for this: Satis (detailed description).
Satis creates at least two static files that you need to host on a webserver accessible from your development machines, and can optionally also create ZIP files for every tag it finds in your repositories.
You would then change the manual references of your repositories in the main project to one single pointer to that Satis hosting webserver.
And whenever you create a new tag in one of your repositories, you run Satis again to fetch the new info and create new ZIP files.
Only if you provide a ZIP download location you will experience a difference with the preferred-install=dist
option. Without a download location, Composer will always clone the original repository.
Upvotes: 2