public function download(OutputInterface $output, PackageInterface $package, $path) { $source = $package->getSource(); $gitPath = $path . '/.git'; if (!is_dir($gitPath)) { $this->cloneRepository($source, $path); } $this->checkoutReference($source, $path); }
private function getTargetDirectory(PackageInterface $package) { if (!is_dir($this->vendorDirectory)) { if (file_exists($this->vendorDirectory)) { throw new RuntimeException($this->vendorDirectory . ' exists and is not a directory.'); } if (!@mkdir($this->vendorDirectory, 0777, true)) { throw new RuntimeException($this->vendorDirectory . ' does not exist and could not be created.'); } } $targetDirectory = $this->vendorDirectory . DIRECTORY_SEPARATOR . $package->getName(); FileSystem::createDirectory($targetDirectory); return $targetDirectory; }