Skip to content

Pre-load all of our sources on initial load #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ public function __construct(Composer $composer, IOInterface $io) {
$this->composer = $composer;
$this->io = $io;
$this->progress = TRUE;

// Pre-load all of our sources so that we do not run up
// against problems in `composer update` operations.
$this->manualLoad();
}

protected function manualLoad() {
$src_dir = __DIR__;

$classes = [
'CommandProvider',
'DrupalScaffoldCommand',
'FileFetcher',
'PrestissimoFileFetcher',
];

foreach ($classes as $src) {
if (!class_exists('\\DrupalComposer\\DrupalScaffold\\' . $src)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the a particular reason for the double backslash notation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double backslash is necessary at the end; otherwise you get \', which escapes the last single-quote. I made the rest doubled up for consistency. This could be changed if you prefer it the other way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense. Thanks!

include "{$src_dir}/{$src}.php";
}
}
}

/**
Expand Down