composer/composer — pull request #3588 by jeremy-derusse (2014-12-23 15:22:14+00:00)
Title: Fix self-update permissions

This PR fixes some wrong assertions and allow user to run "self update" command when he has write permission on the file and not the directory.
Fixes:
- Does not attempt to write backup if the directory is not writable
- Does not asserts that the backup's directory is writable when you run a rollback (because nobody write in this directory when you rollback)
- Restore the original permissions after updating

Improve:
- Check if the localFilename **or** it directory is writable
- Use rename strategy when the directory is writable
- Use content replace when the file is writable
- Restore the localFilename permissions instead of using the user's defaults