1111use Composer \Installer \PackageEvent ;
1212use Composer \Installer \PackageEvents ;
1313use Composer \IO \IOInterface ;
14+ use Composer \Plugin \Capable ;
1415use Composer \Plugin \CommandEvent ;
1516use Composer \Plugin \PluginEvents ;
1617use Composer \Plugin \PluginInterface ;
1920/**
2021 * Composer plugin for handling drupal scaffold.
2122 */
22- class Plugin implements PluginInterface, EventSubscriberInterface {
23+ class Plugin implements PluginInterface, EventSubscriberInterface, Capable {
2324
2425 /**
2526 * @var \DrupalComposer\DrupalScaffold\Handler
@@ -37,15 +38,22 @@ public function activate(Composer $composer, IOInterface $io) {
3738 $ this ->handler = new Handler ($ composer , $ io );
3839 }
3940
41+ /**
42+ * {@inheritdoc}
43+ */
44+ public function getCapabilities () {
45+ return array (
46+ 'Composer\Plugin\Capability\CommandProvider ' => 'DrupalComposer\DrupalScaffold\CommandProvider ' ,
47+ );
48+ }
49+
4050 /**
4151 * {@inheritdoc}
4252 */
4353 public static function getSubscribedEvents () {
4454 return array (
4555 PackageEvents::POST_PACKAGE_INSTALL => 'postPackage ' ,
4656 PackageEvents::POST_PACKAGE_UPDATE => 'postPackage ' ,
47- //PackageEvents::POST_PACKAGE_UNINSTALL => 'postPackage',
48- //ScriptEvents::POST_INSTALL_CMD => 'postCmd',
4957 ScriptEvents::POST_UPDATE_CMD => 'postCmd ' ,
5058 PluginEvents::COMMAND => 'cmdBegins ' ,
5159 );
@@ -83,11 +91,16 @@ public function postCmd(\Composer\Script\Event $event) {
8391 * scaffold files.
8492 *
8593 * @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.
8697 */
8798 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 );
88100 $ handler = new Handler ($ event ->getComposer (), $ event ->getIO ());
89101 $ handler ->downloadScaffold ();
90102 // Generate the autoload.php file after generating the scaffold files.
91103 $ handler ->generateAutoload ();
92104 }
105+
93106}
0 commit comments