Skip to content
This repository was archived by the owner on Jan 28, 2022. It is now read-only.

Commit bffde32

Browse files
romainneutronfabpot
authored andcommitted
Add new directory structure hook
1 parent 450796a commit bffde32

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

app/SymfonyStandard/Composer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
class Composer
1717
{
18-
public static function hookInstallAcmeDemoBundle(CommandEvent $event)
18+
public static function hookRootPackageInstall(CommandEvent $event)
1919
{
20-
$event->getComposer()->getEventDispatcher()->addSubscriber(new InstallAcmeDemoBundleSubscriber());
20+
$event->getComposer()->getEventDispatcher()->addSubscriber(new RootPackageInstallSubscriber());
2121
}
2222
}

app/SymfonyStandard/InstallAcmeDemoBundleSubscriber.php renamed to app/SymfonyStandard/RootPackageInstallSubscriber.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,25 @@
1616
use Composer\Script\CommandEvent;
1717
use Sensio\Bundle\DistributionBundle\Composer\ScriptHandler;
1818

19-
class InstallAcmeDemoBundleSubscriber implements EventSubscriberInterface
19+
class RootPackageInstallSubscriber implements EventSubscriberInterface
2020
{
2121
public static function installAcmeDemoBundle(CommandEvent $event)
2222
{
2323
ScriptHandler::installAcmeDemoBundle($event);
2424
}
2525

26+
public static function setupNewDirectoryStructure(CommandEvent $event)
27+
{
28+
ScriptHandler::defineDirectoryStructure($event);
29+
}
30+
2631
public static function getSubscribedEvents()
2732
{
28-
return array(ScriptEvents::POST_INSTALL_CMD => 'installAcmeDemoBundle');
33+
return array(
34+
ScriptEvents::POST_INSTALL_CMD => array(
35+
array('setupNewDirectoryStructure', 512),
36+
array('installAcmeDemoBundle', 0)
37+
),
38+
);
2939
}
3040
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"scripts": {
2626
"post-root-package-install": [
27-
"SymfonyStandard\\Composer::hookInstallAcmeDemoBundle"
27+
"SymfonyStandard\\Composer::hookRootPackageInstall"
2828
],
2929
"post-install-cmd": [
3030
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",

0 commit comments

Comments
 (0)