diff --git a/src/Managers/DownloadManager.php b/src/Managers/DownloadManager.php index d418d21..5c188a8 100644 --- a/src/Managers/DownloadManager.php +++ b/src/Managers/DownloadManager.php @@ -16,7 +16,7 @@ class DownloadManager * @var \Composer\Package\CompletePackage */ private $ownerPackage; - + /** * @var \Composer\Downloader\DownloadManager */ @@ -26,7 +26,7 @@ class DownloadManager * @var \Composer\Installer\InstallationManager */ private $installationManager; - + /** * @var \Composer\Cache */ @@ -46,7 +46,7 @@ class DownloadManager * @var \Vaimo\WebDriverBinaryDownloader\Analysers\PlatformAnalyser */ private $platformAnalyser; - + /** * @var \Vaimo\WebDriverBinaryDownloader\Utils\SystemUtils */ @@ -91,13 +91,13 @@ public function __construct( $this->driverPkgFactory = $driverPkgFactory; $this->pluginConfig = $pluginConfig; $this->composer = $composer; - + $this->platformAnalyser = new \Vaimo\WebDriverBinaryDownloader\Analysers\PlatformAnalyser(); $this->systemUtils = new \Vaimo\WebDriverBinaryDownloader\Utils\SystemUtils(); $this->dataUtils = new \Vaimo\WebDriverBinaryDownloader\Utils\DataUtils(); $this->stringUtils = new \Vaimo\WebDriverBinaryDownloader\Utils\StringUtils(); } - + public function downloadRelease(array $versions) { $executableName = $this->dataUtils->extractValue( @@ -107,7 +107,7 @@ public function downloadRelease(array $versions) ); $ownerName = $this->ownerPackage->getName(); - + if (!$executableName) { $platformName = $this->platformAnalyser->getPlatformName(); @@ -117,7 +117,7 @@ public function downloadRelease(array $versions) } $name = sprintf('%s-virtual', $ownerName); - + $relativePath = $this->systemUtils->composePath( $this->ownerPackage->getName(), 'downloads' @@ -128,13 +128,7 @@ public function downloadRelease(array $versions) 'downloads' ); - echo "== downloadRelease fullpath == \n"; - \Symfony\Component\VarDumper\VarDumper::dump($fullPath); - while ($version = array_shift($versions)) { - \Symfony\Component\VarDumper\VarDumper::dump($this->getDownloadUrl($version)); - \Symfony\Component\VarDumper\VarDumper::dump($relativePath); - $package = $this->driverPkgFactory->create( $name, $this->getDownloadUrl($version), diff --git a/src/Managers/PackageManager.php b/src/Managers/PackageManager.php index a37f1c1..04c2372 100644 --- a/src/Managers/PackageManager.php +++ b/src/Managers/PackageManager.php @@ -19,7 +19,7 @@ class PackageManager * @var \Composer\Util\Filesystem */ private $fileSystem; - + /** * @var \Vaimo\WebDriverBinaryDownloader\Analysers\PlatformAnalyser */ @@ -71,17 +71,10 @@ public function installBinaries(PackageInterface $package, $binDir) { $sourceDir = $this->systemUtils->composePath($this->vendorDir, $package->getTargetDir()); - echo "\n== installBinaries == \n"; - - \Symfony\Component\VarDumper\VarDumper::dump($this->vendorDir); - \Symfony\Component\VarDumper\VarDumper::dump($package->getTargetDir()); - $matches = []; $binaries = $package->getBinaries(); - \Symfony\Component\VarDumper\VarDumper::dump($binaries); - foreach ($binaries as $binary) { if (file_exists($this->systemUtils->composePath($sourceDir, $binary))) { $matches[] = $this->systemUtils->composePath($sourceDir, $binary); @@ -89,18 +82,12 @@ public function installBinaries(PackageInterface $package, $binDir) $globPattern = $this->systemUtils->composePath($sourceDir, '**', $binary); - \Symfony\Component\VarDumper\VarDumper::dump($globPattern); - $matches = array_merge( $matches, $this->systemUtils->recursiveGlob($globPattern) ); } - echo "\n\n== Matches ==\n\n"; - \Symfony\Component\VarDumper\VarDumper::dump($matches); - - if (!$matches) { $errorMessage = sprintf( 'Could not locate binaries (%s) from downloaded source', @@ -113,19 +100,17 @@ public function installBinaries(PackageInterface $package, $binDir) ) ) ); - + throw new \Exception($errorMessage); } - echo "\n== end installBinaries == \n"; - $fileRenames = $this->pluginConfig->getExecutableFileRenames(); - + $this->fileSystem->ensureDirectoryExists($binDir); foreach (array_filter($matches, 'is_executable') as $fromPath) { $fileName = basename($fromPath); - + $toPath = $this->systemUtils->composePath( $binDir, $this->dataUtils->extractValue($fileRenames, $fileName, $fileName)