diff --git a/doc/00-intro.md b/doc/00-intro.md index 3509a59d3..046fea8fe 100644 --- a/doc/00-intro.md +++ b/doc/00-intro.md @@ -93,6 +93,10 @@ you can run this to move composer.phar to a directory that is in your path: mv composer.phar /usr/local/bin/composer ``` +If you like to install it only for your user and avoid requiring root permissions, +you can use `~/.local/bin` instead which is available by default on some +Linux distributions. + > **Note:** If the above fails due to permissions, you may need to run it again > with sudo. diff --git a/src/Composer/IO/IOInterface.php b/src/Composer/IO/IOInterface.php index 75c86de20..5766ba479 100644 --- a/src/Composer/IO/IOInterface.php +++ b/src/Composer/IO/IOInterface.php @@ -103,8 +103,8 @@ interface IOInterface /** * Asks a question to the user. * - * @param string|array $question The question to ask - * @param string $default The default answer if none is given by the user + * @param string $question The question to ask + * @param string $default The default answer if none is given by the user * * @throws \RuntimeException If there is no data to read in the input stream * @return string The user answer @@ -116,8 +116,8 @@ interface IOInterface * * The question will be asked until the user answers by nothing, yes, or no. * - * @param string|array $question The question to ask - * @param bool $default The default answer if the user enters nothing + * @param string $question The question to ask + * @param bool $default The default answer if the user enters nothing * * @return bool true if the user has confirmed, false otherwise */ @@ -130,10 +130,10 @@ interface IOInterface * validated data when the data is valid and throw an exception * otherwise. * - * @param string|array $question The question to ask - * @param callable $validator A PHP callback - * @param null|int $attempts Max number of times to ask before giving up (default of null means infinite) - * @param mixed $default The default answer if none is given by the user + * @param string $question The question to ask + * @param callable $validator A PHP callback + * @param null|int $attempts Max number of times to ask before giving up (default of null means infinite) + * @param mixed $default The default answer if none is given by the user * * @throws \Exception When any of the validators return an error * @return mixed @@ -152,12 +152,12 @@ interface IOInterface /** * Asks the user to select a value. * - * @param string|array $question The question to ask - * @param array $choices List of choices to pick from - * @param bool|string $default The default answer if the user enters nothing - * @param bool|int $attempts Max number of times to ask before giving up (false by default, which means infinite) - * @param string $errorMessage Message which will be shown if invalid value from choice list would be picked - * @param bool $multiselect Select more than one value separated by comma + * @param string $question The question to ask + * @param array $choices List of choices to pick from + * @param bool|string $default The default answer if the user enters nothing + * @param bool|int $attempts Max number of times to ask before giving up (false by default, which means infinite) + * @param string $errorMessage Message which will be shown if invalid value from choice list would be picked + * @param bool $multiselect Select more than one value separated by comma * * @throws \InvalidArgumentException * @return int|string|array The selected value or values (the key of the choices array) diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index fe2616cb4..7fbe536f2 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -289,7 +289,7 @@ class Locker { $lock = array( '_readme' => array('This file locks the dependencies of your project to a known state', - 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file', + 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies', 'This file is @gener'.'ated automatically', ), 'content-hash' => $this->contentHash, 'packages' => null, diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index 1faba8195..822510601 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -115,19 +115,38 @@ class SvnDriver extends VcsDriver return null; } + /** + * {@inheritdoc} + */ + protected function shouldCache($identifier) + { + return $this->cache && preg_match('{@\d+$}', $identifier); + } + /** * {@inheritdoc} */ public function getComposerInformation($identifier) { if (!isset($this->infoCache[$identifier])) { - if ($res = $this->cache->read($identifier.'.json')) { + if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) { return $this->infoCache[$identifier] = JsonFile::parseJson($res); } - $composer = $this->getBaseComposerInformation($identifier); + try { + $composer = $this->getBaseComposerInformation($identifier); + } catch(TransportException $e) { + $message = $e->getMessage(); + if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) { + throw $e; + } + // remember a not-existent composer.json + $composer = ''; + } - $this->cache->write($identifier.'.json', json_encode($composer)); + if ($this->shouldCache($identifier)) { + $this->cache->write($identifier.'.json', json_encode($composer)); + } $this->infoCache[$identifier] = $composer; } diff --git a/tests/Composer/Test/Package/LockerTest.php b/tests/Composer/Test/Package/LockerTest.php index a37e09907..b5692b009 100644 --- a/tests/Composer/Test/Package/LockerTest.php +++ b/tests/Composer/Test/Package/LockerTest.php @@ -133,7 +133,7 @@ class LockerTest extends TestCase ->method('write') ->with(array( '_readme' => array('This file locks the dependencies of your project to a known state', - 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file', + 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies', 'This file is @gener'.'ated automatically', ), 'content-hash' => $contentHash, 'packages' => array(