1
0
Fork 0

Added better messages and fixed bugs

pull/4479/head
MakiCode 2015-10-04 20:03:06 -05:00
parent 906c1c2e66
commit 0d00338bdb
3 changed files with 11 additions and 9 deletions

View File

@ -42,7 +42,8 @@ class ArchiveCommand extends Command
new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'), new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
new InputOption('format', 'f', InputOption::VALUE_OPTIONAL, 'Format of the resulting archive: tar or zip'), new InputOption('format', 'f', InputOption::VALUE_OPTIONAL, 'Format of the resulting archive: tar or zip'),
new InputOption('dir', false, InputOption::VALUE_OPTIONAL, 'Write the archive to this directory'), new InputOption('dir', false, InputOption::VALUE_OPTIONAL, 'Write the archive to this directory'),
new InputOption('file', false, InputOption::VALUE_OPTIONAL, 'Write the archive with the given file name.'), new InputOption('file', false, InputOption::VALUE_OPTIONAL, 'Write the archive with the given file name.'
.' Note that the format will be appended.'),
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
The <info>archive</info> command creates an archive of the specified format The <info>archive</info> command creates an archive of the specified format

View File

@ -97,8 +97,8 @@ class ArchiveManager
* @param PackageInterface $package The package to archive * @param PackageInterface $package The package to archive
* @param string $format The format of the archive (zip, tar, ...) * @param string $format The format of the archive (zip, tar, ...)
* @param string $targetDir The directory where to build the archive * @param string $targetDir The directory where to build the archive
* @param string|null $fileName The file name to use for the archive, or null to use the generated * @param string|null $fileName The relative file name to use for the archive, or null to generate
* package name * the package name. Note that the format will be appended to this name
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \RuntimeException * @throws \RuntimeException
* @return string The path of the created archive * @return string The path of the created archive
@ -128,9 +128,9 @@ class ArchiveManager
$filesystem = new Filesystem(); $filesystem = new Filesystem();
if(null === $fileName) { if(null === $fileName) {
$packageName = $fileName;
} else {
$packageName = $this->getPackageFilename($package); $packageName = $this->getPackageFilename($package);
} else {
$packageName = $fileName;
} }
// Archive filename // Archive filename

View File

@ -70,7 +70,7 @@ class ArchiveManagerTest extends ArchiverTest
$this->manager->archive($package, 'tar', $this->targetDir, $fileName); $this->manager->archive($package, 'tar', $this->targetDir, $fileName);
$target = $this->getTargetName($package, 'tar', $fileName); $target = $this->targetDir . "/" . $fileName . ".tar";
$this->assertFileExists($target); $this->assertFileExists($target);
@ -90,11 +90,12 @@ class ArchiveManagerTest extends ArchiverTest
protected function getTargetName(PackageInterface $package, $format, $fileName = null) protected function getTargetName(PackageInterface $package, $format, $fileName = null)
{ {
if(!is_null($fileName)) { if(null === $fileName) {
$packageName = $fileName;
} else {
$packageName = $this->manager->getPackageFilename($package); $packageName = $this->manager->getPackageFilename($package);
} else {
$packageName = $fileName;
} }
$target = $this->targetDir.'/'.$packageName.'.'.$format; $target = $this->targetDir.'/'.$packageName.'.'.$format;
return $target; return $target;