You are here

public static function Command::getPackageManager in Composer Manager 8

Returns a \Drupal\composer_manager\PackageManager instance.

2 calls to Command::getPackageManager()
Command::rebuild in src/Composer/Command.php
Rebuilds the root package.
Command::update in src/Composer/Command.php
Rebuilds the root package, then calls 'composer update'.

File

src/Composer/Command.php, line 46

Class

Command
Callbacks for Composer commands defined by Composer Manager.

Namespace

Drupal\composer_manager\Composer

Code

public static function getPackageManager() {
  $root = getcwd();
  require $root . '/autoload.php';

  // The module classes aren't in the autoloader at this point.
  require __DIR__ . '/../ExtensionDiscovery.php';
  require __DIR__ . '/../JsonFile.php';
  require __DIR__ . '/../PackageManagerInterface.php';
  require __DIR__ . '/../PackageManager.php';

  // YAML discovery in core uses FileCache which is not available.
  FileCacheFactory::setConfiguration([
    'default' => [
      'class' => '\\Drupal\\Component\\FileCache\\NullFileCache',
    ],
  ]);
  return new PackageManager($root);
}