Skip to content

Commit a88681a

Browse files
author
Allan Paiste
committed
introduce minor fixes after porting over the code from a specialized plugin (edgedriver)
1 parent 7d40067 commit a88681a

File tree

5 files changed

+52
-11
lines changed

5 files changed

+52
-11
lines changed

src/Analysers/PlatformAnalyser.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@
55
*/
66
namespace Vaimo\WebDriverBinaryDownloader\Analysers;
77

8-
class PlatformAnalyser
8+
class PlatformAnalyser implements \Vaimo\WebDriverBinaryDownloader\Interfaces\PlatformAnalyserInterface
99
{
10-
const TYPE_LINUX32 = 'linux32';
11-
const TYPE_LINUX64 = 'linux64';
12-
const TYPE_WIN32 = 'win32';
13-
const TYPE_WIN64 = 'win64';
14-
const TYPE_MAC64 = 'mac64';
15-
1610
public function getPlatformCode()
1711
{
1812
if (stripos(PHP_OS, 'win') === 0) {

src/Installer.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
*/
66
namespace Vaimo\WebDriverBinaryDownloader;
77

8-
class Installer
8+
use Vaimo\WebDriverBinaryDownloader\Interfaces\ConfigInterface;
9+
10+
class Installer implements \Vaimo\WebDriverBinaryDownloader\Interfaces\InstallerInterface
911
{
1012
/**
1113
* @var \Composer\Composer
@@ -36,7 +38,7 @@ public function __construct(
3638
$this->utils = new \Vaimo\WebDriverBinaryDownloader\Installer\Utils();
3739
}
3840

39-
public function executeWithConfig(\Vaimo\WebDriverBinaryDownloader\Interfaces\ConfigInterface $pluginConfig)
41+
public function executeWithConfig(ConfigInterface $pluginConfig)
4042
{
4143
$binaryDir = $this->composerRuntime->getConfig()->get('bin-dir');
4244

@@ -78,7 +80,7 @@ public function executeWithConfig(\Vaimo\WebDriverBinaryDownloader\Interfaces\Co
7880

7981
$pluginPackage = $projectAnalyser->resolvePackageForNamespace(
8082
$localRepository->getCanonicalPackages(),
81-
__NAMESPACE__
83+
get_class($pluginConfig)
8284
);
8385

8486
$downloadManager = new \Vaimo\WebDriverBinaryDownloader\Installer\DownloadManager(

src/Installer/DownloadManager.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ public function downloadRelease(array $versions)
8181
/** @var \Composer\Downloader\DownloaderInterface $downloader */
8282
$downloader = $this->downloadManager->getDownloaderForInstalledPackage($package);
8383

84-
$downloader->download($package, $targetDir);
84+
/**
85+
* Some downloaders have the option to mute the output, which is why
86+
* there the third call argument.
87+
*/
88+
$downloader->download($package, $targetDir, false);
8589

8690
return $package;
8791
} catch (\Composer\Downloader\TransportException $exception) {

src/Interfaces/InstallerInterface.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © Vaimo Group. All rights reserved.
4+
* See LICENSE_VAIMO.txt for license details.
5+
*/
6+
namespace Vaimo\WebDriverBinaryDownloader\Interfaces;
7+
8+
use Vaimo\WebDriverBinaryDownloader\Interfaces\ConfigInterface as Config;
9+
10+
interface InstallerInterface
11+
{
12+
/**
13+
* @param Config $pluginConfig
14+
*/
15+
public function executeWithConfig(Config $pluginConfig);
16+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Copyright © Vaimo Group. All rights reserved.
4+
* See LICENSE_VAIMO.txt for license details.
5+
*/
6+
namespace Vaimo\WebDriverBinaryDownloader\Interfaces;
7+
8+
interface PlatformAnalyserInterface
9+
{
10+
const TYPE_LINUX32 = 'linux32';
11+
const TYPE_LINUX64 = 'linux64';
12+
const TYPE_WIN32 = 'win32';
13+
const TYPE_WIN64 = 'win64';
14+
const TYPE_MAC64 = 'mac64';
15+
16+
/**
17+
* @return string
18+
*/
19+
public function getPlatformCode();
20+
21+
/**
22+
* @return string
23+
*/
24+
public function getPlatformName();
25+
}

0 commit comments

Comments
 (0)