Skip to content
Snippets Groups Projects
Commit 08203ff7 authored by jurgenhaas's avatar jurgenhaas
Browse files

Refactor namespace to extend LakeDrops Composer Components

parent 704c1918
No related branches found
No related tags found
No related merge requests found
ahoyapi: v2
commands:
update:
cmd: composer dorgflow "$@"
usage: Update DorgFlow setup in project
......@@ -26,6 +26,7 @@
"require": {
"composer-plugin-api": "^1.0.0",
"cypresslab/gitelephant": "~1.0",
"lakedrops/composer-json-utils": "^1.1.0",
"php": ">=5.6"
},
"require-dev": {
......
......@@ -2,10 +2,9 @@
namespace LakeDrops\DorgFlow;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Script\Event;
use GitElephant\Repository;
use LakeDrops\Component\Composer\BaseHandler;
use Symfony\Component\Filesystem\Filesystem;
/**
......@@ -13,47 +12,7 @@ use Symfony\Component\Filesystem\Filesystem;
*
* @package LakeDrops\DorgFlow
*/
class Handler {
/**
* The composer object of this session.
*
* @var \Composer\Composer
*/
protected $composer;
/**
* The input-output object of the composer session.
*
* @var \Composer\IO\IOInterface
*/
protected $io;
/**
* Handler constructor.
*
* @param \Composer\Composer $composer
* The composer object of this session.
* @param \Composer\IO\IOInterface $io
* The input-output object of the composer session.
*/
public function __construct(Composer $composer, IOInterface $io) {
$this->composer = $composer;
$this->io = $io;
}
/**
* Retrieve a package from the current composer process.
*
* @param string $name
* Name of the package to get from the current composer installation.
*
* @return \Composer\Package\PackageInterface
* The package.
*/
protected function getPackage($name) {
return $this->composer->getRepositoryManager()->getLocalRepository()->findPackage($name, '*');
}
class Handler extends BaseHandler {
/**
* Post install/update event to prepare projects for development.
......
......@@ -2,30 +2,20 @@
namespace LakeDrops\DorgFlow;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use LakeDrops\Component\Composer\BasePlugin;
/**
* Composer plugin for preparing Drupal project for development with dorgflow.
*/
class Plugin implements PluginInterface, EventSubscriberInterface {
/**
* The handler object to configure the project for dorgflow.
*
* @var \LakeDrops\DorgFlow\Handler
*/
protected $handler;
class Plugin extends BasePlugin {
/**
* {@inheritdoc}
*/
public function activate(Composer $composer, IOInterface $io) {
$this->handler = new Handler($composer, $io);
public function getHandlerClass() {
return Handler::class;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment