Skip to content

Commit

Permalink
Composer 2 support (#36)
Browse files Browse the repository at this point in the history
Co-authored-by: hw <hussainweb@gmail.com>
Co-authored-by: VladimirAus <v_roudakov@yahoo.com>
  • Loading branch information
3 people authored Nov 14, 2020
1 parent 93d421e commit 2f86a50
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"nested package"
],
"homepage": "https://github.com/drupal-composer/preserve-paths",
"license": "GPL-2.0+",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Johannes Haseitl",
Expand All @@ -21,10 +21,10 @@
"issues": "https://github.com/drupal-composer/preserve-paths/issues"
},
"require": {
"composer-plugin-api": "^1.0"
"composer-plugin-api": "^1.0 || ^2.0"
},
"require-dev": {
"composer/composer": "1.*",
"composer/composer": "^2.0",
"phpunit/phpunit": "4.*",
"derhasi/tempdirectory": "0.1.*",
"squizlabs/php_codesniffer": "2.*",
Expand Down
29 changes: 21 additions & 8 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use Composer\Installer\PackageEvent;
use Composer\Script\ScriptEvents;
use Composer\Installer\PackageEvents;

/**
* Class Plugin.
Expand All @@ -39,12 +39,12 @@ public function activate(Composer $composer, IOInterface $io)
public static function getSubscribedEvents()
{
return array(
ScriptEvents::PRE_PACKAGE_INSTALL => 'prePackage',
ScriptEvents::POST_PACKAGE_INSTALL => 'postPackage',
ScriptEvents::PRE_PACKAGE_UPDATE => 'prePackage',
ScriptEvents::POST_PACKAGE_UPDATE => 'postPackage',
ScriptEvents::PRE_PACKAGE_UNINSTALL => 'prePackage',
ScriptEvents::POST_PACKAGE_UNINSTALL => 'postPackage',
PackageEvents::PRE_PACKAGE_INSTALL => 'prePackage',
PackageEvents::POST_PACKAGE_INSTALL => 'postPackage',
PackageEvents::PRE_PACKAGE_UPDATE => 'prePackage',
PackageEvents::POST_PACKAGE_UPDATE => 'postPackage',
PackageEvents::PRE_PACKAGE_UNINSTALL => 'prePackage',
PackageEvents::POST_PACKAGE_UNINSTALL => 'postPackage',
);
}

Expand All @@ -55,7 +55,6 @@ public static function getSubscribedEvents()
*/
public function prePackage(PackageEvent $event)
{

$this->wrapper->prePackage($event);
}

Expand All @@ -68,4 +67,18 @@ public function postPackage(PackageEvent $event)
{
$this->wrapper->postPackage($event);
}

/**
* {@inheritdoc}
*/
public function deactivate(Composer $composer, IOInterface $io)
{
}

/**
* {@inheritdoc}
*/
public function uninstall(Composer $composer, IOInterface $io)
{
}
}

0 comments on commit 2f86a50

Please sign in to comment.