13
13
use Composer \IO \IOInterface ;
14
14
use Composer \Plugin \CommandEvent ;
15
15
use Composer \Plugin \PluginEvents ;
16
+ use Composer \Plugin \Capable ;
16
17
use Composer \Plugin \PluginInterface ;
17
18
use Composer \Script \ScriptEvents ;
18
19
19
20
/**
20
21
* Composer plugin for handling drupal scaffold.
21
22
*/
22
- class Plugin implements PluginInterface, EventSubscriberInterface {
23
+ class Plugin implements PluginInterface, EventSubscriberInterface, Capable {
23
24
24
25
/**
25
26
* @var \DrupalComposer\DrupalScaffold\Handler
@@ -37,15 +38,22 @@ public function activate(Composer $composer, IOInterface $io) {
37
38
$ this ->handler = new Handler ($ composer , $ io );
38
39
}
39
40
41
+ /**
42
+ * {@inheritdoc}
43
+ */
44
+ public function getCapabilities () {
45
+ return array (
46
+ 'Composer\Plugin\Capability\CommandProvider ' => 'DrupalComposer\DrupalScaffold\CommandProvider ' ,
47
+ );
48
+ }
49
+
40
50
/**
41
51
* {@inheritdoc}
42
52
*/
43
53
public static function getSubscribedEvents () {
44
54
return array (
45
55
PackageEvents::POST_PACKAGE_INSTALL => 'postPackage ' ,
46
56
PackageEvents::POST_PACKAGE_UPDATE => 'postPackage ' ,
47
- //PackageEvents::POST_PACKAGE_UNINSTALL => 'postPackage',
48
- //ScriptEvents::POST_INSTALL_CMD => 'postCmd',
49
57
ScriptEvents::POST_UPDATE_CMD => 'postCmd ' ,
50
58
PluginEvents::COMMAND => 'cmdBegins ' ,
51
59
);
@@ -78,16 +86,4 @@ public function postCmd(\Composer\Script\Event $event) {
78
86
$ this ->handler ->onPostCmdEvent ($ event );
79
87
}
80
88
81
- /**
82
- * Script callback for putting in composer scripts to download the
83
- * scaffold files.
84
- *
85
- * @param \Composer\Script\Event $event
86
- */
87
- public static function scaffold (\Composer \Script \Event $ event ) {
88
- $ handler = new Handler ($ event ->getComposer (), $ event ->getIO ());
89
- $ handler ->downloadScaffold ();
90
- // Generate the autoload.php file after generating the scaffold files.
91
- $ handler ->generateAutoload ();
92
- }
93
89
}
0 commit comments