Check exclude from downloaded composer.json

main
Morgan BRUNOT 11 years ago
parent f346274f9a
commit ca7cb68dd5

@ -16,6 +16,7 @@ use Composer\Downloader\DownloadManager;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\RootPackage; use Composer\Package\RootPackage;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Json\JsonFile;
/** /**
* @author Matthieu Moquet <matthieu@moquet.net> * @author Matthieu Moquet <matthieu@moquet.net>
@ -141,6 +142,13 @@ class ArchiveManager
// Download sources // Download sources
$this->downloadManager->download($package, $sourcePath); $this->downloadManager->download($package, $sourcePath);
// Check exclude from downloaded composer.json
$jsonFile = new JsonFile($sourcePath.'/composer.json');
$jsonData = $jsonFile->read();
if (!empty($jsonData['archive']['exclude'])) {
$package->setArchiveExcludes($jsonData['archive']['exclude']);
}
} }
// Create the archive // Create the archive

@ -79,13 +79,13 @@ class ArchiveManagerTest extends ArchiverTest
throw new \RuntimeException('Could not init: '.$this->process->getErrorOutput()); throw new \RuntimeException('Could not init: '.$this->process->getErrorOutput());
} }
$result = file_put_contents('b', 'a'); $result = file_put_contents('composer.json', '{"name":"faker/faker", "description": "description", "license": "MIT"}');
if (false === $result) { if (false === $result) {
chdir($currentWorkDir); chdir($currentWorkDir);
throw new \RuntimeException('Could not save file.'); throw new \RuntimeException('Could not save file.');
} }
$result = $this->process->execute('git add b && git commit -m "commit b" -q', $output, $this->testDir); $result = $this->process->execute('git add composer.json && git commit -m "commit composer.json" -q', $output, $this->testDir);
if ($result > 0) { if ($result > 0) {
chdir($currentWorkDir); chdir($currentWorkDir);
throw new \RuntimeException('Could not commit: '.$this->process->getErrorOutput()); throw new \RuntimeException('Could not commit: '.$this->process->getErrorOutput());

Loading…
Cancel
Save