For a while now, at Silicon, we use a combination of Capistrano and Composer to deploy our websites and other services we created.
We tried many possibilities, the one we choose is to run composer install on every deployment. But that means that a dependancy (plugin or theme) can be updated during the deployment.
Of course, it’s not perfect, in an ideal world, we would have a staging server to test and validate the deployment, but it’s not the case. So, to keep a track of Composer’s updates during deployment, I had the idea to mail the output of Composer after the end of the deployment. For doing that, I need to store Composer output in a file and, only if the deployement was successful, send the email with the content of this file.
Simple Linux command to run in your cap deploy:
composer install | tee COMPOSER-LOG
But funny was that the file was empty.
I didn’t find the information on the web, but @ethanol on freenode IRC #composer gave me the reason:
“most output goes to stderr“
So finally, if you want to save the output to a file, don’t forget to catch stderr with something like:
composer install 2>&1 | tee COMPOSER-LOG