11
11
use Composer \Installer \PackageEvent ;
12
12
use Composer \Installer \PackageEvents ;
13
13
use Composer \IO \IOInterface ;
14
+ use Composer \Plugin \Capable ;
14
15
use Composer \Plugin \CommandEvent ;
15
16
use Composer \Plugin \PluginEvents ;
16
17
use Composer \Plugin \PluginInterface ;
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
);
@@ -83,11 +91,16 @@ public function postCmd(\Composer\Script\Event $event) {
83
91
* scaffold files.
84
92
*
85
93
* @param \Composer\Script\Event $event
94
+ *
95
+ * @deprecated since version 2.5.0, to be removed in 3.0. Use the command
96
+ * "composer drupal:scaffold" instead.
86
97
*/
87
98
public static function scaffold (\Composer \Script \Event $ event ) {
99
+ @trigger_error ('\DrupalComposer\DrupalScaffold\Plugin::scaffold is deprecated since version 2.5.0 and will be removed in 3.0. Use "composer drupal:scaffold" instead. ' , E_USER_DEPRECATED );
88
100
$ handler = new Handler ($ event ->getComposer (), $ event ->getIO ());
89
101
$ handler ->downloadScaffold ();
90
102
// Generate the autoload.php file after generating the scaffold files.
91
103
$ handler ->generateAutoload ();
92
104
}
105
+
93
106
}
0 commit comments