Skip to content

Commit e1a603f

Browse files
Introduce a pre-scaffold event and a post-scaffold event.
1 parent 6d65015 commit e1a603f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Handler.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
use Composer\DependencyResolver\Operation\UpdateOperation;
1313
use Composer\IO\IOInterface;
1414
use Composer\Package\PackageInterface;
15+
use Composer\EventDispatcher\EventDispatcher;
1516

1617
use Composer\Util\Filesystem;
1718
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
1819

1920
class Handler {
2021

22+
const PRE_SCAFFOLD_CMD = 'pre-scaffold-cmd';
23+
const POST_SCAFFOLD_CMD = 'post-scaffold-cmd';
24+
2125
/**
2226
* @var \Composer\Composer
2327
*/
@@ -102,6 +106,10 @@ public function downloadScaffold() {
102106
$excludes = $this->getExcludes();
103107
$includes = $this->getIncludes();
104108

109+
// Call any pre-scaffold scripts that may be defined.
110+
$dispatcher = new EventDispatcher($this->composer, $this->io);
111+
$dispatcher->dispatch(self::PRE_SCAFFOLD_CMD);
112+
105113
// Run Robo
106114
static::execute(
107115
[
@@ -120,6 +128,9 @@ public function downloadScaffold() {
120128
static::array_to_csv($includes),
121129
]
122130
);
131+
132+
// Call post-scaffold scripts.
133+
$dispatcher->dispatch(self::POST_SCAFFOLD_CMD);
123134
}
124135

125136
/**

0 commit comments

Comments
 (0)