-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbdi
executable file
·70 lines (56 loc) · 3.51 KB
/
bdi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env php
<?php
declare(strict_types=1);
use DBrekelmans\BrowserDriverInstaller\Archive\MultiExtractor;
use DBrekelmans\BrowserDriverInstaller\Archive\TarGzExtractor;
use DBrekelmans\BrowserDriverInstaller\Archive\ZipExtractor;
use DBrekelmans\BrowserDriverInstaller\Browser;
use DBrekelmans\BrowserDriverInstaller\Browser\Chromium;
use DBrekelmans\BrowserDriverInstaller\Browser\Firefox;
use DBrekelmans\BrowserDriverInstaller\Browser\GoogleChrome;
use DBrekelmans\BrowserDriverInstaller\Command\DetectCommand;
use DBrekelmans\BrowserDriverInstaller\CommandLine\ShellCommandLineEnvironment;
use DBrekelmans\BrowserDriverInstaller\Driver;
use DBrekelmans\BrowserDriverInstaller\Driver\ChromeDriver;
use DBrekelmans\BrowserDriverInstaller\Driver\GeckoDriver;
use Symfony\Component\Console\Application;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpClient\NativeHttpClient;
require __DIR__ . '/vendor/autoload.php';
$application = new Application();
$httpClient = new NativeHttpClient();
$filesystem = new Filesystem();
$zipArchive = new ZipArchive();
$shellCommandLineEnv = new ShellCommandLineEnvironment();
$tarGzExtractor = new TarGzExtractor();
$zipExtractor = new ZipExtractor($zipArchive);
$multiExtractor = new MultiExtractor();
$multiExtractor->register($zipExtractor);
$multiExtractor->register($tarGzExtractor);
$browserPathResolverFactory = new Browser\PathResolverFactory();
$browserPathResolverFactory->register(new GoogleChrome\PathResolver());
$browserPathResolverFactory->register(new Chromium\PathResolver());
$browserPathResolverFactory->register(new Firefox\PathResolver());
$browserVersionResolverFactory = new Browser\VersionResolverFactory();
$browserVersionResolverFactory->register(new GoogleChrome\VersionResolver($shellCommandLineEnv));
$browserVersionResolverFactory->register(new Chromium\VersionResolver($shellCommandLineEnv));
$browserVersionResolverFactory->register(new Firefox\VersionResolver($shellCommandLineEnv));
$driverVersionResolverFactory = new Driver\VersionResolverFactory();
$chromeDriverVersionResolver = new ChromeDriver\VersionResolver($httpClient);
$geckoDriverVersionResolver = new GeckoDriver\VersionResolver($httpClient);
$driverVersionResolverFactory->register($chromeDriverVersionResolver);
$driverVersionResolverFactory->register($geckoDriverVersionResolver);
$chromeDriverDownloadUrlResolver = new ChromeDriver\DownloadUrlResolver($httpClient);
$driverDownloaderFactory = new Driver\DownloaderFactory();
$driverDownloaderFactory->register(new ChromeDriver\Downloader($filesystem, $httpClient, $multiExtractor, $chromeDriverDownloadUrlResolver));
$driverDownloaderFactory->register(new GeckoDriver\Downloader($filesystem, $httpClient, $multiExtractor));
$browserFactory = new Browser\BrowserFactory($browserPathResolverFactory, $browserVersionResolverFactory);
$driverFactory = new Driver\DriverFactory($driverVersionResolverFactory);
$application->add(new DetectCommand());
$application->add(new GoogleChrome\Command($filesystem, $browserFactory, $driverFactory, $driverDownloaderFactory));
$application->add(new Chromium\Command($filesystem, $browserFactory, $driverFactory, $driverDownloaderFactory));
$application->add(new Firefox\Command($filesystem, $browserFactory, $driverFactory, $driverDownloaderFactory));
$application->add(new ChromeDriver\Command($chromeDriverVersionResolver, $driverDownloaderFactory));
$application->add(new GeckoDriver\Command($geckoDriverVersionResolver, $driverDownloaderFactory));
$application->setDefaultCommand(DetectCommand::NAME);
$application->run();