Merge branch 'master' into 2.0
commit
f6b3f12107
|
@ -0,0 +1,3 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
custom: https://packagist.com
|
|
@ -241,8 +241,14 @@ be in your project root, on the same level as `vendor` directory is. An example
|
||||||
filename would be `src/Foo.php` containing an `Acme\Foo` class.
|
filename would be `src/Foo.php` containing an `Acme\Foo` class.
|
||||||
|
|
||||||
After adding the [`autoload`](04-schema.md#autoload) field, you have to re-run
|
After adding the [`autoload`](04-schema.md#autoload) field, you have to re-run
|
||||||
[`dump-autoload`](03-cli.md#dump-autoload) to re-generate the
|
this command :
|
||||||
`vendor/autoload.php` file.
|
|
||||||
|
```sh
|
||||||
|
php composer.phar dump-autoload
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will re-generate the `vendor/autoload.php` file.
|
||||||
|
See the [`dump-autoload`](03-cli.md#dump-autoload) section for more informations.
|
||||||
|
|
||||||
Including that file will also return the autoloader instance, so you can store
|
Including that file will also return the autoloader instance, so you can store
|
||||||
the return value of the include call in a variable and add more namespaces.
|
the return value of the include call in a variable and add more namespaces.
|
||||||
|
|
|
@ -706,7 +706,7 @@ performance.
|
||||||
* **--apcu:** Use APCu to cache found/not-found classes.
|
* **--apcu:** Use APCu to cache found/not-found classes.
|
||||||
* **--no-dev:** Disables autoload-dev rules.
|
* **--no-dev:** Disables autoload-dev rules.
|
||||||
|
|
||||||
## clear-cache (clearcache)
|
## clear-cache / clearcache / cc
|
||||||
|
|
||||||
Deletes all content from Composer's cache directories.
|
Deletes all content from Composer's cache directories.
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class ClearCacheCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->setName('clear-cache')
|
->setName('clear-cache')
|
||||||
->setAliases(array('clearcache'))
|
->setAliases(array('clearcache', 'cc'))
|
||||||
->setDescription('Clears composer\'s internal package cache.')
|
->setDescription('Clears composer\'s internal package cache.')
|
||||||
->setHelp(
|
->setHelp(
|
||||||
<<<EOT
|
<<<EOT
|
||||||
|
|
|
@ -279,6 +279,24 @@ EOT
|
||||||
$packageVersion = $requirements[0]['version'];
|
$packageVersion = $requirements[0]['version'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if no directory was specified, use the 2nd part of the package name
|
||||||
|
if (null === $directory) {
|
||||||
|
$parts = explode("/", $name, 2);
|
||||||
|
$directory = array_pop($parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
$directory = getcwd() . DIRECTORY_SEPARATOR . $directory;
|
||||||
|
$io->writeError('<info>Creating a "' . $packageName . '" project at "' . $directory . '"</info>');
|
||||||
|
|
||||||
|
$fs = new Filesystem();
|
||||||
|
if (file_exists($directory)) {
|
||||||
|
if (!is_dir($directory)) {
|
||||||
|
throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
|
||||||
|
} elseif (!$fs->isDirEmpty($directory)) {
|
||||||
|
throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (null === $stability) {
|
if (null === $stability) {
|
||||||
if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
|
if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
|
||||||
$stability = $match[1];
|
$stability = $match[1];
|
||||||
|
@ -320,11 +338,6 @@ EOT
|
||||||
throw new \InvalidArgumentException($errorMessage .'.');
|
throw new \InvalidArgumentException($errorMessage .'.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $directory) {
|
|
||||||
$parts = explode("/", $name, 2);
|
|
||||||
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// handler Ctrl+C for unix-like systems
|
// handler Ctrl+C for unix-like systems
|
||||||
if (function_exists('pcntl_async_signals')) {
|
if (function_exists('pcntl_async_signals')) {
|
||||||
@mkdir($directory, 0777, true);
|
@mkdir($directory, 0777, true);
|
||||||
|
|
|
@ -107,11 +107,11 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
$command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
|
$command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (0 === $this->process->execute($command, $ignoredOutput)) {
|
if (0 === $exitCode = $this->process->execute($command, $ignoredOutput)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
|
$processError = new \RuntimeException('Failed to execute ('.$exitCode.') '.$command."\n\n".$this->process->getErrorOutput());
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$processError = $e;
|
$processError = $e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ class ZipDownloaderTest extends TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Exception
|
* @expectedException \Exception
|
||||||
* @expectedExceptionMessage Failed to execute unzip
|
* @expectedExceptionMessage Failed to execute (1) unzip
|
||||||
*/
|
*/
|
||||||
public function testSystemUnzipOnlyFailed()
|
public function testSystemUnzipOnlyFailed()
|
||||||
{
|
{
|
||||||
|
@ -305,7 +305,7 @@ class ZipDownloaderTest extends TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Exception
|
* @expectedException \Exception
|
||||||
* @expectedExceptionMessage Failed to execute unzip
|
* @expectedExceptionMessage Failed to execute (1) unzip
|
||||||
*/
|
*/
|
||||||
public function testWindowsFallbackFailed()
|
public function testWindowsFallbackFailed()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
--RUN--
|
--RUN--
|
||||||
create-project --repository=packages.json -v seld/jsonlint %testDir% dev-master
|
create-project --repository=packages.json -v seld/jsonlint %testDir% dev-master
|
||||||
--EXPECT-ERROR-REGEX--
|
--EXPECT-ERROR-REGEX--
|
||||||
{^Installing seld/jsonlint \(dev-master [a-f0-9]{40}\)}
|
{^Installing seld/jsonlint \(dev-master [a-f0-9]{40}\)}m
|
||||||
|
|
Loading…
Reference in New Issue