1
0
Fork 0

CS and wording fixes, refs #1728

pull/1819/merge
Jordi Boggiano 2013-04-27 17:32:35 +02:00
parent e50173ff93
commit 1b030a76d4
2 changed files with 11 additions and 16 deletions

View File

@ -490,7 +490,7 @@ information.
There are some cases, when there is no ability to have one of the previously There are some cases, when there is no ability to have one of the previously
mentioned repository types online, even the VCS one. Typical example could be mentioned repository types online, even the VCS one. Typical example could be
cross-organisation library exchange through built artifacts. Of course, most cross-organisation library exchange through built artifacts. Of course, most
of the times they are private. To simplify maintenance, one can simply specify of the times they are private. To simplify maintenance, one can simply use a
repository of type `artifact` with a folder containing ZIP archives of those repository of type `artifact` with a folder containing ZIP archives of those
private packages: private packages:
@ -514,10 +514,10 @@ Each zip artifact is just a ZIP archive with `composer.json` in root folder:
composer.json composer.json
... ...
If there is two archives with different versions of a package, they would be If there are two archives with different versions of a package, they are both
imported both. If archive with newer version would be put to artifact folder and imported. When an archive with a newer version is added in the artifact folder
`update` command would be triggered, that version would replace previous, at it and you run `update`, that version will be imported as well and Composer will
logically seems. update to the latest version.
## Disabling Packagist ## Disabling Packagist

View File

@ -28,6 +28,10 @@ class ArtifactRepository extends ArrayRepository
public function __construct(array $repoConfig, IOInterface $io) public function __construct(array $repoConfig, IOInterface $io)
{ {
if (!extension_loaded('zip')) {
throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
}
$this->loader = new ArrayLoader(); $this->loader = new ArrayLoader();
$this->lookup = $repoConfig['url']; $this->lookup = $repoConfig['url'];
$this->io = $io; $this->io = $io;
@ -37,13 +41,6 @@ class ArtifactRepository extends ArrayRepository
{ {
parent::initialize(); parent::initialize();
if (!extension_loaded('zip')) {
$msg = 'In order to use <comment>artifact</comment> repository, ' .
'you need to have <comment>zip</comment> extension enabled';
$this->io->write($msg);
return;
}
$this->scanDirectory($this->lookup); $this->scanDirectory($this->lookup);
} }
@ -59,16 +56,14 @@ class ArtifactRepository extends ArrayRepository
$package = $this->getComposerInformation($file); $package = $this->getComposerInformation($file);
if (!$package) { if (!$package) {
if ($io->isVerbose()) { if ($io->isVerbose()) {
$msg = "File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package"; $io->write("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package");
$io->write($msg);
} }
continue; continue;
} }
if ($io->isVerbose()) { if ($io->isVerbose()) {
$template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>'; $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
$msg = sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()); $io->write(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()));
$io->write($msg);
} }
$this->addPackage($package); $this->addPackage($package);