Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace LakeDrops\Behat4Drupal;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
/**
* Composer plugin for handling drupal scaffold.
*/
class Plugin implements PluginInterface, EventSubscriberInterface {
/**
* The handler object for events.
*
* @var \LakeDrops\Behat4Drupal\Handler
*/
protected $handler;
/**
* {@inheritdoc}
*/
public function activate(Composer $composer, IOInterface $io) {
$this->handler = new Handler($composer, $io);
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return array(
ScriptEvents::POST_CREATE_PROJECT_CMD => 'postCreateProject',
);
}
/**
* Post create project event callback.
*
* @param \Composer\Script\Event $event
* The event that triggered the plugin.
*/
public function postCreateProject(Event $event) {
$this->handler->configureProject($event);
}
/**
* Script callback for putting in composer scripts to configure the project.
*
* @param \Composer\Script\Event $event
* The event that triggered the call of this function.
*/
public static function config(Event $event) {
$handler = new Handler($event->getComposer(), $event->getIO());
$handler->configureProject($event, TRUE);
}
}