Skip to content

Commit 2f86a50

Browse files
greg-1-andersonhussainwebVladimirAus
authored
Composer 2 support (#36)
Co-authored-by: hw <hussainweb@gmail.com> Co-authored-by: VladimirAus <v_roudakov@yahoo.com>
1 parent 93d421e commit 2f86a50

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"nested package"
1010
],
1111
"homepage": "https://github.com/drupal-composer/preserve-paths",
12-
"license": "GPL-2.0+",
12+
"license": "GPL-2.0-or-later",
1313
"authors": [
1414
{
1515
"name": "Johannes Haseitl",
@@ -21,10 +21,10 @@
2121
"issues": "https://github.com/drupal-composer/preserve-paths/issues"
2222
},
2323
"require": {
24-
"composer-plugin-api": "^1.0"
24+
"composer-plugin-api": "^1.0 || ^2.0"
2525
},
2626
"require-dev": {
27-
"composer/composer": "1.*",
27+
"composer/composer": "^2.0",
2828
"phpunit/phpunit": "4.*",
2929
"derhasi/tempdirectory": "0.1.*",
3030
"squizlabs/php_codesniffer": "2.*",

src/Plugin.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Composer\IO\IOInterface;
1313
use Composer\Plugin\PluginInterface;
1414
use Composer\Installer\PackageEvent;
15-
use Composer\Script\ScriptEvents;
15+
use Composer\Installer\PackageEvents;
1616

1717
/**
1818
* Class Plugin.
@@ -39,12 +39,12 @@ public function activate(Composer $composer, IOInterface $io)
3939
public static function getSubscribedEvents()
4040
{
4141
return array(
42-
ScriptEvents::PRE_PACKAGE_INSTALL => 'prePackage',
43-
ScriptEvents::POST_PACKAGE_INSTALL => 'postPackage',
44-
ScriptEvents::PRE_PACKAGE_UPDATE => 'prePackage',
45-
ScriptEvents::POST_PACKAGE_UPDATE => 'postPackage',
46-
ScriptEvents::PRE_PACKAGE_UNINSTALL => 'prePackage',
47-
ScriptEvents::POST_PACKAGE_UNINSTALL => 'postPackage',
42+
PackageEvents::PRE_PACKAGE_INSTALL => 'prePackage',
43+
PackageEvents::POST_PACKAGE_INSTALL => 'postPackage',
44+
PackageEvents::PRE_PACKAGE_UPDATE => 'prePackage',
45+
PackageEvents::POST_PACKAGE_UPDATE => 'postPackage',
46+
PackageEvents::PRE_PACKAGE_UNINSTALL => 'prePackage',
47+
PackageEvents::POST_PACKAGE_UNINSTALL => 'postPackage',
4848
);
4949
}
5050

@@ -55,7 +55,6 @@ public static function getSubscribedEvents()
5555
*/
5656
public function prePackage(PackageEvent $event)
5757
{
58-
5958
$this->wrapper->prePackage($event);
6059
}
6160

@@ -68,4 +67,18 @@ public function postPackage(PackageEvent $event)
6867
{
6968
$this->wrapper->postPackage($event);
7069
}
70+
71+
/**
72+
* {@inheritdoc}
73+
*/
74+
public function deactivate(Composer $composer, IOInterface $io)
75+
{
76+
}
77+
78+
/**
79+
* {@inheritdoc}
80+
*/
81+
public function uninstall(Composer $composer, IOInterface $io)
82+
{
83+
}
7184
}

0 commit comments

Comments
 (0)