1
0
Fork 0

Moved archive Dumpers into its own Archiver package

pull/1567/head
Matthieu Moquet 2012-08-27 09:33:04 +02:00 committed by Nils Adermann
parent 2acb033057
commit 3d0ce85db2
7 changed files with 27 additions and 27 deletions

View File

@ -8,18 +8,18 @@
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Package\Dumper; namespace Composer\Package\Archiver;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
/** /**
* @author Till Klampaeckel <till@php.net> * @author Till Klampaeckel <till@php.net>
*/ */
interface DumperInterface interface ArchiverInterface
{ {
/** /**
* Return value depends on implementation - e.g. generating a tar or zip the * Return value depends on implementation - e.g. generating a tar or zip the
* method currently returns void, the ArrayDumper returns an array. * method currently returns void, the ArrayArchiver returns an array.
* *
* @param PackageInterface $package * @param PackageInterface $package
* *

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Package\Dumper; namespace Composer\Package\Archiver;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
@ -22,7 +22,7 @@ use Composer\Factory;
/** /**
* @author Till Klampaeckel <till@php.net> * @author Till Klampaeckel <till@php.net>
*/ */
abstract class BaseDumper implements DumperInterface abstract class BaseArchiver implements ArchiverInterface
{ {
/** /**
* Format: zip or tar. * Format: zip or tar.

View File

@ -9,17 +9,17 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Package\Dumper; namespace Composer\Package\Archiver;
use Composer\Package\Dumper\BaseDumper; use Composer\Package\Archiver\BaseArchiver;
use Composer\Package\Dumper\DumperInterface; use Composer\Package\Archiver\ArchiverInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
/** /**
* @author Ulf Härnhammar <ulfharn@gmail.com> * @author Ulf Härnhammar <ulfharn@gmail.com>
*/ */
class TarDumper extends BaseDumper class TarArchiver extends BaseArchiver
{ {
protected $format = 'tar'; protected $format = 'tar';

View File

@ -9,17 +9,17 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Package\Dumper; namespace Composer\Package\Archiver;
use Composer\Package\Dumper\BaseDumper; use Composer\Package\Archiver\BaseArchiver;
use Composer\Package\Dumper\DumperInterface; use Composer\Package\Archiver\ArchiverInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
/** /**
* @author Till Klampaeckel <till@php.net> * @author Till Klampaeckel <till@php.net>
*/ */
class ZipDumper extends BaseDumper class ZipArchiver extends BaseArchiver
{ {
protected $format = 'zip'; protected $format = 'zip';

View File

@ -9,13 +9,13 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Test\Package\Dumper; namespace Composer\Test\Package\Archiver;
use Composer\Package\MemoryPackage; use Composer\Package\MemoryPackage;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
abstract class DumperTest extends \PHPUnit_Framework_TestCase abstract class ArchiverTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var \Composer\Util\Filesystem * @var \Composer\Util\Filesystem
@ -36,7 +36,7 @@ abstract class DumperTest extends \PHPUnit_Framework_TestCase
{ {
$this->fs = new Filesystem; $this->fs = new Filesystem;
$this->process = new ProcessExecutor; $this->process = new ProcessExecutor;
$this->testdir = sys_get_temp_dir() . '/composer_dumpertest_git_repository' . mt_rand(); $this->testdir = sys_get_temp_dir() . '/composer_archivertest_git_repository' . mt_rand();
} }
protected function getTestDir() protected function getTestDir()
@ -83,7 +83,7 @@ abstract class DumperTest extends \PHPUnit_Framework_TestCase
protected function setupPackage() protected function setupPackage()
{ {
$td = $this->getTestDir(); $td = $this->getTestDir();
$package = new MemoryPackage('dumpertest/dumpertest', 'master', 'master'); $package = new MemoryPackage('archivertest/archivertest', 'master', 'master');
$package->setSourceUrl("file://$td"); $package->setSourceUrl("file://$td");
$package->setSourceReference('master'); $package->setSourceReference('master');
$package->setSourceType('git'); $package->setSourceType('git');

View File

@ -9,11 +9,11 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Test\Package\Dumper; namespace Composer\Test\Package\Archiver;
use Composer\Package\Dumper\TarDumper; use Composer\Package\Archiver\TarArchiver;
class TarDumperTest extends DumperTest class TarArchiverTest extends ArchiverTest
{ {
public function testThis() public function testThis()
{ {
@ -22,7 +22,7 @@ class TarDumperTest extends DumperTest
$name = $this->getPackageFileName($package); $name = $this->getPackageFileName($package);
$temp = sys_get_temp_dir(); $temp = sys_get_temp_dir();
$tar = new TarDumper($temp); $tar = new TarArchiver($temp);
$tar->dump($package); $tar->dump($package);
$dist = sprintf('%s/%s.tar', $dist = sprintf('%s/%s.tar',
@ -38,6 +38,6 @@ class TarDumperTest extends DumperTest
*/ */
public function testException() public function testException()
{ {
new TarDumper("/totally-random-" . time()); new TarArchiver("/totally-random-" . time());
} }
} }

View File

@ -9,11 +9,11 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Test\Package\Dumper; namespace Composer\Test\Package\Archiver;
use Composer\Package\Dumper\ZipDumper; use Composer\Package\Archiver\ZipArchiver;
class ZipDumperTest extends DumperTest class ZipArchiverTest extends ArchiverTest
{ {
public function testThis() public function testThis()
{ {
@ -22,7 +22,7 @@ class ZipDumperTest extends DumperTest
$name = $this->getPackageFileName($package); $name = $this->getPackageFileName($package);
$temp = sys_get_temp_dir(); $temp = sys_get_temp_dir();
$zip = new ZipDumper($temp); $zip = new ZipArchiver($temp);
$zip->dump($package); $zip->dump($package);
$dist = sprintf('%s/%s.zip', $dist = sprintf('%s/%s.zip',
@ -38,6 +38,6 @@ class ZipDumperTest extends DumperTest
*/ */
public function testException() public function testException()
{ {
new ZipDumper("/totally-random-" . time()); new ZipArchiver("/totally-random-" . time());
} }
} }