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 @@ ...@@ -26,6 +26,7 @@
"require": { "require": {
"composer-plugin-api": "^1.0.0", "composer-plugin-api": "^1.0.0",
"cypresslab/gitelephant": "~1.0", "cypresslab/gitelephant": "~1.0",
"lakedrops/composer-json-utils": "^1.1.0",
"php": ">=5.6" "php": ">=5.6"
}, },
"require-dev": { "require-dev": {
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
namespace LakeDrops\DorgFlow; namespace LakeDrops\DorgFlow;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Script\Event; use Composer\Script\Event;
use GitElephant\Repository; use GitElephant\Repository;
use LakeDrops\Component\Composer\BaseHandler;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
/** /**
...@@ -13,47 +12,7 @@ use Symfony\Component\Filesystem\Filesystem; ...@@ -13,47 +12,7 @@ use Symfony\Component\Filesystem\Filesystem;
* *
* @package LakeDrops\DorgFlow * @package LakeDrops\DorgFlow
*/ */
class Handler { class Handler extends BaseHandler {
/**
* 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, '*');
}
/** /**
* Post install/update event to prepare projects for development. * Post install/update event to prepare projects for development.
......
...@@ -2,30 +2,20 @@ ...@@ -2,30 +2,20 @@
namespace LakeDrops\DorgFlow; 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\Event;
use Composer\Script\ScriptEvents; use Composer\Script\ScriptEvents;
use LakeDrops\Component\Composer\BasePlugin;
/** /**
* Composer plugin for preparing Drupal project for development with dorgflow. * Composer plugin for preparing Drupal project for development with dorgflow.
*/ */
class Plugin implements PluginInterface, EventSubscriberInterface { class Plugin extends BasePlugin {
/**
* The handler object to configure the project for dorgflow.
*
* @var \LakeDrops\DorgFlow\Handler
*/
protected $handler;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function activate(Composer $composer, IOInterface $io) { public function getHandlerClass() {
$this->handler = new Handler($composer, $io); 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