public function testSetGetDownloader()
 {
     $downloader = $this->createDownloaderMock();
     $manager = new DownloadManager(false, $this->filesystem);
     $manager->setDownloader('test', $downloader);
     $this->assertSame($downloader, $manager->getDownloader('test'));
     $this->setExpectedException('InvalidArgumentException');
     $manager->getDownloader('unregistered');
 }
Beispiel #2
0
 /**
  * @param  IO\IOInterface             $io
  * @param  Config                     $config
  * @param  EventDispatcher            $eventDispatcher
  * @return Downloader\DownloadManager
  */
 public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
 {
     $cache = null;
     if ($config->get('cache-files-ttl') > 0) {
         $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
     }
     $dm = new Downloader\DownloadManager($io);
     switch ($config->get('preferred-install')) {
         case 'dist':
             $dm->setPreferDist(true);
             break;
         case 'source':
             $dm->setPreferSource(true);
             break;
         case 'auto':
         default:
             // noop
             break;
     }
     $executor = new ProcessExecutor($io);
     $fs = new Filesystem($executor);
     $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
     $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
     $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
     $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
     $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
     $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
     $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
     $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
     $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
     $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
     $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
     $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
     return $dm;
 }
Beispiel #3
0
 /**
  * @param  IO\IOInterface             $io
  * @param  Config                     $config
  * @return Downloader\DownloadManager
  */
 public function createDownloadManager(IOInterface $io, Config $config)
 {
     $cache = null;
     if ($config->get('cache-files-ttl') > 0) {
         $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
     }
     $dm = new Downloader\DownloadManager();
     $dm->setDownloader('git', new Downloader\GitDownloader($io, $config));
     $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config));
     $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config));
     $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $cache));
     $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $cache));
     $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $cache));
     $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $cache));
     return $dm;
 }
Beispiel #4
0
 protected function createDownloadManager(IOInterface $io)
 {
     $dm = new Downloader\DownloadManager();
     $dm->setDownloader('git', new Downloader\GitDownloader($io));
     $dm->setDownloader('svn', new Downloader\SvnDownloader($io));
     $dm->setDownloader('hg', new Downloader\HgDownloader($io));
     $dm->setDownloader('pear', new Downloader\PearDownloader($io));
     $dm->setDownloader('zip', new Downloader\ZipDownloader($io));
     $dm->setDownloader('tar', new Downloader\TarDownloader($io));
     $dm->setDownloader('phar', new Downloader\PharDownloader($io));
     return $dm;
 }
Beispiel #5
0
 public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null)
 {
     $cache = null;
     if ($config->get('cache-files-ttl') > 0) {
         $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
     }
     $dm = new Downloader\DownloadManager();
     switch ($config->get('preferred-install')) {
         case 'dist':
             $dm->setPreferDist(true);
             break;
         case 'source':
             $dm->setPreferSource(true);
             break;
         case 'auto':
         default:
             break;
     }
     $dm->setDownloader('git', new Downloader\GitDownloader($io, $config));
     $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config));
     $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config));
     $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
     $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache));
     $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache));
     $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache));
     $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache));
     $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache));
     return $dm;
 }
Beispiel #6
0
 /**
  * @param  IO\IOInterface             $io
  * @return Downloader\DownloadManager
  */
 public function createDownloadManager(IOInterface $io, Config $config)
 {
     $dm = new Downloader\DownloadManager();
     $dm->setDownloader('git', new Downloader\GitDownloader($io, $config));
     $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config));
     $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config));
     $dm->setDownloader('zip', new Downloader\ZipDownloader($io));
     $dm->setDownloader('tar', new Downloader\TarDownloader($io));
     $dm->setDownloader('phar', new Downloader\PharDownloader($io));
     $dm->setDownloader('file', new Downloader\FileDownloader($io));
     return $dm;
 }