protected function fetch($target) { $package = Package::factory($this->name, $this->version, $this->prettyVersion); $package->setSourceType('git'); $package->setSourceUrl($this->url); $package->setSourceReference($this->version); $package->setRootDir($target); $downloader = new GitDownloader($this->io, new Config()); if (null !== $downloader) { $downloader->download($package, $target); } }
/** * {@inheritDoc} */ public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url) { if (!is_dir($path . '/.git')) { $this->io->writeError(" Missing .git directory. Don't worry ;)"); $this->io->writeError(" => See https://github.com/sonata-project/sonata-composer"); $this->doDownload($initial, $path, $url); } return parent::doUpdate($initial, $target, $path, $url); }
public function testGetInstallationSource() { $downloader = new GitDownloader($this->getMock('Composer\\IO\\IOInterface')); $this->assertEquals('source', $downloader->getInstallationSource()); }
public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url) { GitUtil::cleanEnv(); $path = $this->normalizePath($path); if (!$this->isRepositoryCloned($path)) { //clone the multi repository if it was removed $this->io->write(' Multi-repository GIT directory not found. Cloning...'); $this->cloneRepository($initial, $path, $url); } parent::doUpdate($initial, $target, $path, $url); //copy file into required directory $this->copyFilesToDefaultPath($this->normalizePath($path)); }