Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding symfony2 deps

Tags:

git

php

symfony

I'm working with symfony2 for some time and I don't really get the correct way to work with the vendors.

So here is what I'm doing:

I have the deps and deps.lock files in my git while I ignore the whole vendors folder. Now when I install the application to a new server, I do a php bin/vendors install to pull the vendors onto the server. I get the message that I have to use install --reinstall and do that.

From my understanding, the versions should now be the exact same as on my development machine, as both deps and deps.lock are the same. But it seems that the deps.lock gets (partly) ignored?

There is also a vendors update command, which I read should not be used. BUt I didn't get the idea what it really does.

So I'm a bit confused now as of what command should be used when and what it is supposed to do. Maybe someone can shed some light on this topic! I'm especially interested in the correct way to use the vendors command both local and on the server so the vendors are in the correct version on both systems!

like image 467
Sgoettschkes Avatar asked Mar 17 '12 10:03

Sgoettschkes


2 Answers

install and update both fetch new code from the git repositories specified in your deps file

install checks for hashes in you deps.lock files for each library. If it finds something, it checkouts the commit corresponding to the hash. If it does not, it checkouts the tag or branch in your deps.lock if one is specified and creates an entry in the deps.lock file

update is useful when you want to update to a new version of symfony (or any library in the deps file). If you one day, you feel like updating, you can read this post I wrote about the update process.

To sum up, I always use update on all machines, and I try to always specify a version for each library, so that the production environment does not get updated to an unstable version unexpectedly.

like image 124
greg0ire Avatar answered Oct 29 '22 06:10

greg0ire


install --reinstall is the same as install but it also deletes vendor folder content before doing installation.

vendors update updates all your vendors to the latest version or version specified in your deps file and updates your deps.lock file. But you rarely need it, don't know where you read "should not be used".

If you look inside vendors file, you can see this line:

if (is_dir($vendorDir.'/symfony') && !is_dir($vendorDir.'/symfony/.git') && !in_array('--reinstall', $argv))
...Try to run ./bin/vendors install --reinstall...

So you have vendor/symfony folder without .git in it.

like image 27
meze Avatar answered Oct 29 '22 07:10

meze