Example #1
0
 /**
  * @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();
     }
 }
 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);
 }
 /**
  * @param PackageInterface $package
  *
  * @return string
  */
 public function getPackageBasePath(PackageInterface $package)
 {
     $extra = $package->getExtra();
     print_r($extra);
     // get dependency glue packages
     return parent::getPackageBasePath($package);
 }
Example #4
0
 /**
  * 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);
 }
 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);
 }
 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];
 }
 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);
 }
 /**
  * {@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);
 }
 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);
 }
Example #10
0
 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);
 }
 /**
  * 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);
 }
Example #12
0
 /**
  * {@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);
     }
 }
 /**
  *
  * @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);
 }
Example #14
0
 /**
  * {@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);
 }
Example #15
0
 /**
  * {@inheritDoc}
  */
 public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     $extra = $target->getExtra();
     if (empty($extra['class'])) {
         throw new \UnexpectedValueException('Error while installing ' . $target->getPrettyName() . ', composer-plugin packages should have a class defined in their extra key to be usable.');
     }
     parent::update($repo, $initial, $target);
     $this->composer->getPluginManager()->registerPackage($target, true);
 }
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     if (empty($this->drupalLibraryMap[$package->getPrettyName()])) {
         $path = parent::getInstallPath($package);
     } else {
         $path = $this->drupalLibrariesPath . $this->drupalLibraryMap[$package->getPrettyName()];
     }
     return $path;
 }
Example #17
0
 /**
  * {@inheritDoc}
  */
 protected function removeCode(PackageInterface $package)
 {
     $path = $this->getInstallPath($package);
     if ($this->isSymlink($path)) {
         $this->debug("Unlinking <comment>{$path}</comment>...");
         $this->filesystem->unlink($path);
         return true;
     }
     return parent::removeCode($package);
 }
 /**
  * @param PackageInterface $package
  *
  * @return string
  */
 public function getPackageBasePath(PackageInterface $package)
 {
     $root = $this->composer->getPackage();
     if ($rootPath = $this->getRootPath($root, $package)) {
         return $rootPath . "/" . $package->getName();
     }
     if ($packagePath = $this->getPackagePath($package)) {
         return $packagePath . "/" . $package->getName();
     }
     return parent::getPackageBasePath($package);
 }
 /**
  * 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();
 }
 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::uninstall($repo, $package);
     $coreInstallPath = $this->getCoreInstallPath($package);
     // make sure we have absolute paths
     $coreInstallPath = realpath('') . '/' . rtrim($coreInstallPath, '/');
     if (is_link($coreInstallPath)) {
         $this->io->write(sprintf('    Removing concrete5 symlink %s - %s', $coreInstallPath, $this->filesystem->unlink($coreInstallPath) ? '<comment>removed</comment>' : '<error>not removed</error>'));
         $this->io->write('');
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function getPackageBasePath(PackageInterface $package)
 {
     switch ($package->getType()) {
         case self::TYPE_MOODLE_SOURCE:
             $basePath = $this->getMoodleDir();
             break;
         default:
             $basePath = parent::getPackageBasePath($package);
     }
     return $basePath;
 }
Example #22
0
 /**
  * @inheritdoc
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     // uninstall the package the normal composer way
     parent::uninstall($repo, $package);
     // remove the package from yiisoft/extensions.php
     $this->removePackage($package);
     // remove links for Yii.php
     if ($package->getName() == 'yiisoft/yii2-dev') {
         $this->removeBaseYiiFiles();
     }
 }
Example #23
0
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     $extra = $package->getExtra();
     if (isset($extra['module'])) {
         $data = array('modules' => array($extra['module'] => array('active' => 'true', 'codePool' => 'community')));
         $xml = new SimpleXMLElement('<config/>');
         array_walk_recursive($data, array($xml, 'addChild'));
         file_put_contents('app/etc/modules/' . $extra['module'] . '.xml', $xml->asXML());
     }
 }
 /**
  * @param InstalledRepositoryInterface $repo
  * @param PackageInterface             $package
  *
  * @throws FilesystemException
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if ($package->isDev()) {
         if (!$repo->hasPackage($package)) {
             throw new \InvalidArgumentException('Package is not installed : ' . $package->getPrettyName());
         }
         $this->symlinkInstaller->uninstall($repo, $package);
     } else {
         $this->defaultInstaller->uninstall($repo, $package);
     }
 }
 public function getInstallPath(PackageInterface $package)
 {
     $path = PackageUtils::getPackageInstallPath($package, $this->composer);
     if (!empty($path)) {
         return $path;
     }
     /*
      * In case, the user didn't provide a custom path
      * use the default one, by calling the parent::getInstallPath function
      */
     return parent::getInstallPath($package);
 }
 /**
  * @param InstalledRepositoryInterface $repository
  * @param PackageInterface             $package
  *
  * @return array
  */
 public function install(InstalledRepositoryInterface $repository, PackageInterface $package)
 {
     $hooks = [];
     $extra = $package->getExtra();
     if (isset($extra["hooks"])) {
         $hooks = $extra["hooks"];
     }
     foreach ($hooks as $hook) {
         $this->addHook($hook);
     }
     parent::install($repository, $package);
 }
 public function __construct(IOInterface $io, Composer $composer, $type, Filesystem $filesystem = null)
 {
     parent::__construct($io, $composer, $type, $filesystem);
     switch ($type) {
         case 'wordpress-plugin':
             $this->vendorDir = 'wp-content/plugins';
             break;
         case 'wordpress-theme':
             $this->vendorDir = 'wp-content/themes';
             break;
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $configuration = $this->getPluginConfiguration();
     $pattern = $configuration->getPattern($package);
     if ($pattern) {
         $basePath = $this->buildPath($pattern, $this->getPackageReplacementTokens($package));
         $targetDir = $package->getTargetDir();
         return $basePath . ($targetDir ? '/' . $targetDir : '');
     } else {
         return parent::getInstallPath($package);
     }
 }
Example #29
0
 /**
  * See {@link Composer\Installer\InstallerInterface::getInstallPath()} for details.
  *
  * @param PackageInterface $package The package that will be installed.
  * @return string The installation path.
  */
 public function getInstallPath(PackageInterface $package)
 {
     $path = $this->getInstallPathFromRoot($package);
     if ($path !== null) {
         return $path;
     }
     $path = $this->getInstallpathFromPackage($package);
     if ($path !== null) {
         return $path;
     }
     // No path configured, use default behavior as fallback.
     return parent::getInstallPath($package);
 }
 /**
  * Perform the install steps
  *
  * @param InstalledRepositoryInterface $repository
  * @param PackageInterface $package
  */
 public function install(InstalledRepositoryInterface $repository, PackageInterface $package)
 {
     parent::install($repository, $package);
     //Copy the console and AppBoot files
     $rootDir = dirname($this->vendorDir);
     $appDir = $rootDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR;
     if (false === is_dir($appDir)) {
         mkdir($appDir);
     }
     $installDir = $this->getInstallPath($package);
     $installAppDir = $installDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR;
     copy($installAppDir . 'console', $appDir . 'console');
     copy($installAppDir . 'AppBoot.php', $appDir . 'AppBoot.php');
     chmod($appDir . 'console', 0755);
 }