Skip to content

Commit 80c7d27

Browse files
greg-1-andersonwebflo
authored andcommitted
Pre-load all of our sources on initial load so that we will not get a more recent version of one of our classes e.g. after a 'composer update' operation. (#82)
1 parent f94a689 commit 80c7d27

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Handler.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,27 @@ public function __construct(Composer $composer, IOInterface $io) {
5656
$this->composer = $composer;
5757
$this->io = $io;
5858
$this->progress = TRUE;
59+
60+
// Pre-load all of our sources so that we do not run up
61+
// against problems in `composer update` operations.
62+
$this->manualLoad();
63+
}
64+
65+
protected function manualLoad() {
66+
$src_dir = __DIR__;
67+
68+
$classes = [
69+
'CommandProvider',
70+
'DrupalScaffoldCommand',
71+
'FileFetcher',
72+
'PrestissimoFileFetcher',
73+
];
74+
75+
foreach ($classes as $src) {
76+
if (!class_exists('\\DrupalComposer\\DrupalScaffold\\' . $src)) {
77+
include "{$src_dir}/{$src}.php";
78+
}
79+
}
5980
}
6081

6182
/**

0 commit comments

Comments
 (0)