Command.php in Composer Manager 8
File
src/Composer/Command.php
View source
<?php
namespace Drupal\composer_manager\Composer;
use Composer\Script\Event;
use Composer\Console\Application;
use Drupal\Component\FileCache\FileCacheFactory;
use Drupal\composer_manager\PackageManager;
class Command {
public static function rebuild(Event $event) {
$package_manager = self::getPackageManager();
$package_manager
->rebuildRootPackage();
echo 'The composer.json has been successfuly rebuilt.' . PHP_EOL;
}
public static function update(Event $event) {
$package_manager = self::getPackageManager();
$package_manager
->rebuildRootPackage();
$command_index = array_search('drupal-update', $_SERVER['argv']);
$_SERVER['argv'][$command_index] = 'update';
$application = new Application();
$application
->run();
}
public static function getPackageManager() {
$root = getcwd();
require $root . '/autoload.php';
require __DIR__ . '/../ExtensionDiscovery.php';
require __DIR__ . '/../JsonFile.php';
require __DIR__ . '/../PackageManagerInterface.php';
require __DIR__ . '/../PackageManager.php';
FileCacheFactory::setConfiguration([
'default' => [
'class' => '\\Drupal\\Component\\FileCache\\NullFileCache',
],
]);
return new PackageManager($root);
}
}
Classes
Name |
Description |
Command |
Callbacks for Composer commands defined by Composer Manager. |