Added better messages and fixed bugs
parent
906c1c2e66
commit
0d00338bdb
|
@ -42,7 +42,8 @@ class ArchiveCommand extends Command
|
|||
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('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
|
||||
The <info>archive</info> command creates an archive of the specified format
|
||||
|
|
|
@ -97,8 +97,8 @@ class ArchiveManager
|
|||
* @param PackageInterface $package The package to archive
|
||||
* @param string $format The format of the archive (zip, tar, ...)
|
||||
* @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
|
||||
* package name
|
||||
* @param string|null $fileName The relative file name to use for the archive, or null to generate
|
||||
* the package name. Note that the format will be appended to this name
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws \RuntimeException
|
||||
* @return string The path of the created archive
|
||||
|
@ -128,9 +128,9 @@ class ArchiveManager
|
|||
|
||||
$filesystem = new Filesystem();
|
||||
if(null === $fileName) {
|
||||
$packageName = $fileName;
|
||||
} else {
|
||||
$packageName = $this->getPackageFilename($package);
|
||||
} else {
|
||||
$packageName = $fileName;
|
||||
}
|
||||
|
||||
// Archive filename
|
||||
|
|
|
@ -70,7 +70,7 @@ class ArchiveManagerTest extends ArchiverTest
|
|||
|
||||
$this->manager->archive($package, 'tar', $this->targetDir, $fileName);
|
||||
|
||||
$target = $this->getTargetName($package, 'tar', $fileName);
|
||||
$target = $this->targetDir . "/" . $fileName . ".tar";
|
||||
|
||||
$this->assertFileExists($target);
|
||||
|
||||
|
@ -90,11 +90,12 @@ class ArchiveManagerTest extends ArchiverTest
|
|||
|
||||
protected function getTargetName(PackageInterface $package, $format, $fileName = null)
|
||||
{
|
||||
if(!is_null($fileName)) {
|
||||
$packageName = $fileName;
|
||||
} else {
|
||||
if(null === $fileName) {
|
||||
$packageName = $this->manager->getPackageFilename($package);
|
||||
} else {
|
||||
$packageName = $fileName;
|
||||
}
|
||||
|
||||
$target = $this->targetDir.'/'.$packageName.'.'.$format;
|
||||
|
||||
return $target;
|
||||
|
|
Loading…
Reference in New Issue