1
0
Fork 0

Add readme entry to lock file to explain what it is

pull/1781/head
Jordi Boggiano 2013-04-08 18:15:08 +02:00
parent bee916fab9
commit 069109e0f0
3 changed files with 15 additions and 2 deletions

View File

@ -119,8 +119,15 @@ to those specific versions.
This is important because the `install` command checks if a lock file is present, This is important because the `install` command checks if a lock file is present,
and if it is, it downloads the versions specified there (regardless of what `composer.json` and if it is, it downloads the versions specified there (regardless of what `composer.json`
says). This means that anyone who sets up the project will download the exact says).
same version of the dependencies.
This means that anyone who sets up the project will download the exact
same version of the dependencies. Your CI server, production machines, other
developers in your team, everything and everyone runs on the same dependencies, which
mitigates the potential for bugs affecting only some parts of the deployments. Even if you
develop alone, in six months when reinstalling the project you can feel confident the
dependencies installed are still working even if your dependencies released
many new versions since then.
If no `composer.lock` file exists, Composer will read the dependencies and If no `composer.lock` file exists, Composer will read the dependencies and
versions from `composer.json` and create the lock file. versions from `composer.json` and create the lock file.
@ -132,6 +139,10 @@ the lock file with the new version.
$ php composer.phar update $ php composer.phar update
If you only want to install or update one dependency, you can whitelist them:
$ php composer.phar update monolog/monolog [...]
> **Note:** For libraries it is not necessarily recommended to commit the lock file, > **Note:** For libraries it is not necessarily recommended to commit the lock file,
> see also: [Libraries - Lock file](02-libraries.md#lock-file). > see also: [Libraries - Lock file](02-libraries.md#lock-file).

View File

@ -204,6 +204,7 @@ class Locker
public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags) public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags)
{ {
$lock = array( $lock = array(
'_readme' => array('This file locks the dependencies of your project to a known state', 'Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file'),
'hash' => $this->hash, 'hash' => $this->hash,
'packages' => null, 'packages' => null,
'packages-dev' => null, 'packages-dev' => null,

View File

@ -120,6 +120,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
->expects($this->once()) ->expects($this->once())
->method('write') ->method('write')
->with(array( ->with(array(
'_readme' => array('This file locks the dependencies of your project to a known state', 'Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file'),
'hash' => 'md5', 'hash' => 'md5',
'packages' => array( 'packages' => array(
array('name' => 'pkg1', 'version' => '1.0.0-beta'), array('name' => 'pkg1', 'version' => '1.0.0-beta'),