本文整理汇总了PHP中Composer\Installer\LibraryInstaller类的典型用法代码示例。如果您正苦于以下问题:PHP LibraryInstaller类的具体用法?PHP LibraryInstaller怎么用?PHP LibraryInstaller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LibraryInstaller类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstallPath
public function getInstallPath(PackageInterface $package)
{
$installer = new InstallerHelper($package, $this->composer, $this->io);
$path = $installer->getInstallPath($package, $package->getType());
// if the path is false, use the default installer path instead
return $path !== false ? $path : LibraryInstaller::getInstallPath($package);
}
示例2: getInstallPath
/**
* Overridden to take into account the root package
*
* @see \Composer\Installer\LibraryInstaller::getInstallPath()
*/
public function getInstallPath(PackageInterface $package)
{
if ($package instanceof RootPackageInterface) {
return '.';
}
return parent::getInstallPath($package);
}
示例3: installCode
/**
* Override LibraryInstaller::installCode() to hook in additional post-download steps.
*
* @param PackageInterface $package Package instance
*/
protected function installCode(PackageInterface $package)
{
parent::installCode($package);
if (!$this->supports($package->getType())) {
return;
}
$this->mirrorReleaseItems($package);
$this->checkGitignore($package);
}
示例4: getInstallPath
/**
* Determines the install path for git hooks,
*
* The installation path is the standard git hooks directory documented here:
* https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
*
* @param PackageInterface $package
*
* @return string a path relative to the root of the composer.json that is being installed.
*/
public function getInstallPath(PackageInterface $package)
{
if (!$this->supports($package->getType())) {
throw new \InvalidArgumentException('Unable to install package, git-hook packages only ' . 'support "git-hook", "library" type packages.');
}
// Allow to LibraryInstaller to resolve the installPath for other packages.
if ($package->getType() !== 'git-hook') {
return parent::getInstallPath($package);
}
return $this->getGitHooksPath();
}
示例5: __construct
/**
* @param IOInterface $io
* @param Composer $composer
* @param string $type
* @param Filesystem $filesystem
*/
public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null)
{
parent::__construct($io, $composer, $type, $filesystem);
if ($extra = $this->composer->getPackage()->getExtra()) {
$this->paths = isset($extra['courier-paths']) ? $extra['courier-paths'] : array();
}
}
示例6: getPackageBasePath
/**
* @param PackageInterface $package
*
* @return string
*/
public function getPackageBasePath(PackageInterface $package)
{
$extra = $package->getExtra();
print_r($extra);
// get dependency glue packages
return parent::getPackageBasePath($package);
}
示例7:
function __construct(IOInterface $io, Composer $composer, array $installInfo)
{
// fill in install info defaults
$installInfo += ['wordpress-path' => false, 'wp-content-path' => false, 'wpmu-plugin-dir' => false, 'path-mapping' => [], 'symlink-wp-content' => true, 'mu-plugin-autoloader' => true, 'dev-first' => false];
// wp content path - either set or default
$wpContent = $installInfo['wp-content-path'] ?: self::wp_content;
// default paths for plugins and themes
$installInfo['default-paths'] = ['wordpress-plugin' => "{$wpContent}/plugins", 'wordpress-muplugin' => "{$wpContent}/mu-plugins", 'wordpress-theme' => "{$wpContent}/themes"];
// if the wp-content path was explicitly set, add to the path mapping for plugins/themes
if ($installInfo['wp-content-path']) {
$installInfo['path-mapping'] += $installInfo['default-paths'];
} else {
// set the default wp-content path for mapping and symlinking
$installInfo['wp-content-path'] = $wpContent;
}
// add a mapping for core if wordpress path is set
if ($installInfo['wordpress-path']) {
$installInfo['path-mapping']['wordpress-core'] = $installInfo['wordpress-path'];
} else {
$installInfo['wordpress-path'] = $installInfo['default-paths']['wordpress-core'] = self::wordpress;
}
// wpmu-plugin-dir supersedes the default wp-content based path
if ($installInfo['wpmu-plugin-dir']) {
$installInfo['path-mapping']['wordpress-muplugin'] = $installInfo['wpmu-plugin-dir'];
} else {
$installInfo['wpmu-plugin-dir'] = $installInfo['default-paths']['wordpress-muplugin'];
}
$this->installInfo = $installInfo;
parent::__construct($io, $composer);
}
示例8: getInstallPath
public function getInstallPath(PackageInterface $package)
{
$packageName = $package->getPrettyName();
$packageExtra = $this->composer->getPackage()->getExtra();
if (false === array_key_exists('wordpress-install-dir', $packageExtra)) {
return parent::getInstallPath($package);
}
$installDirs = $packageExtra['wordpress-install-dir'];
if (false === is_array($installDirs)) {
throw new InvalidPackageException(['Installation directory must be a key value array of packages and install directories.'], [], [$installDirs]);
}
if (false === array_key_exists($packageName, $installDirs)) {
throw new InvalidPackageException(['Installation directory must be a key value array of packages and install directories.'], [], [$installDirs]);
}
$packageInstallDir = $installDirs[$packageName];
$installDirCount = 0;
foreach ($installDirs as $installDir) {
if ($installDir === $packageInstallDir) {
$installDirCount++;
}
}
if ($installDirCount > 1) {
throw new InvalidPackageException(['Two packages cannot have the same install directory'], [], $installDirs);
}
return $installDirs[$packageName];
}
示例9: update
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
$pluginName = self::assertBarberryPlugin($target);
parent::update($repo, $initial, $target);
$this->registerAutoloader($target);
$this->installPlugin($target, $pluginName);
}
示例10: getInstallPath
/**
* {@inheritdoc}
*/
public function getInstallPath(PackageInterface $package)
{
$drupalLibraries = ['enyo/dropzone'];
if (in_array($package->getPrettyName(), $drupalLibraries)) {
return getcwd() . '/docroot/libraries/' . explode('/', $package->getPrettyName())[1];
}
return parent::getInstallPath($package);
}
示例11: uninstall
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
$this->initGingerBackend();
$extra = $package->getExtra();
$uninstallPluginCommand = new Cqrs\UninstallPluginCommand(array('plugin_name' => $package->getName(), 'plugin_type' => $package->getType(), 'plugin_namespace' => $extra['plugin-namespace'], 'plugin_version' => $package->getVersion()));
$this->getServiceManager()->get('malocher.cqrs.gate')->getBus()->invokeCommand($uninstallPluginCommand);
parent::uninstall($repo, $package);
}
示例12: initializeBinDir
protected function initializeBinDir()
{
parent::initializeBinDir();
file_put_contents($this->binDir . '/composer-php', $this->generateUnixyPhpProxyCode());
@chmod($this->binDir . '/composer-php', 0777);
file_put_contents($this->binDir . '/composer-php.bat', $this->generateWindowsPhpProxyCode());
@chmod($this->binDir . '/composer-php.bat', 0777);
}
示例13: getInstallPath
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
$extra = $package->getExtra();
if (array_key_exists("install-path", $extra)) {
return $extra["install-path"];
} else {
return parent::getInstallPath($package);
}
}
示例14: getInstallPath
/**
*
* @param PackageInterface $package
*
* @return string a path relative to the root of the composer.json that is being installed.
*/
public function getInstallPath(PackageInterface $package)
{
// custom install path only when it is the keeko/keeko package
if ($this->root->getName() == 'keeko/keeko') {
return 'packages/' . $package->getName();
}
// ... anyway return the default
return parent::getInstallPath($package);
}
示例15: update
/**
* {@inheritDoc}
*/
public function update(PackageInterface $initial, PackageInterface $target)
{
$extra = $target->getExtra();
if (empty($extra['class'])) {
throw new \UnexpectedValueException('Error while installing ' . $target->getPrettyName() . ', composer-installer packages should have a class defined in their extra key to be usable.');
}
parent::update($initial, $target);
$this->registerInstaller($target);
}