/** * Constructor. * * @param array $repoConfig * @param IOInterface $io * @param Config $config * @param EventDispatcher $dispatcher * @param array $drivers */ public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null) { $drivers = $drivers ?: Assets::getVcsDrivers(); $assetType = substr($repoConfig['type'], 0, strpos($repoConfig['type'], '-')); $assetType = Assets::createType($assetType); $repoConfig['asset-type'] = $assetType->getName(); $repoConfig['filename'] = $assetType->getFilename(); $this->assetType = $assetType; $this->dispatcher = $dispatcher; $this->filter = isset($repoConfig['vcs-package-filter']) && $repoConfig['vcs-package-filter'] instanceof VcsPackageFilter ? $repoConfig['vcs-package-filter'] : null; parent::__construct($repoConfig, $io, $config, $dispatcher, $drivers); }
public function testGetVcsDrivers() { $this->assertEquals(array('github', 'git-bitbucket', 'git', 'hg-bitbucket', 'hg', 'perforce', 'svn'), array_keys(Assets::getVcsDrivers())); }
/** * Check if url is supported by vcs drivers. * * @param string $url The url * * @return bool */ protected static function hasUrlDependencySupported($url) { $io = new NullIO(); $config = new Config(); /* @var VcsDriverInterface $driver */ foreach (Assets::getVcsDrivers() as $driver) { $supported = $driver::supports($io, $config, $url); if ($supported) { return true; } } return false; }