Skip to content
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

Allowing files by any name to be imported via -c option. #3283

Merged
merged 5 commits into from
Jan 2, 2018

Conversation

grasmash
Copy link
Contributor

@grasmash grasmash commented Jan 2, 2018

No description provided.

$candidates = [
'drush.yml',
'config/drush.yml',
];
$this->addConfigCandidates($processor, $loader, $dirs, $candidates);
Copy link
Member

Choose a reason for hiding this comment

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

Might be cleaner to combine addConfigCandidates functionality (sans adding) to separateFilesAndDirs method. Then, the later could just return a list of files, which could all be added together via addConfigFiles.

I could also support the current implementation if there's any problem/disagreement with the suggested refactor.

foreach ($paths as $path) {
if (file_exists($path)) {
if (is_dir($path)) {
$dirs[] = realpath($path);
Copy link
Member

Choose a reason for hiding this comment

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

If you pass in $candidates to this function then you could call $this->identifyCandidates($dirs, $candidates); here (or at the end of this function). This would allow you to keep $dirs private to this method and return only $files.

Copy link
Member

Choose a reason for hiding this comment

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

This improvement would of course imply a renaming of this method.

@greg-1-anderson
Copy link
Member

LTGM - thanks for doing the extra complexity-reducing refactors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants