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

Handle edge cases #22

Open
grasmash opened this issue Mar 13, 2019 · 8 comments
Open

Handle edge cases #22

grasmash opened this issue Mar 13, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@grasmash
Copy link
Owner

grasmash commented Mar 13, 2019

  1. Site owner has placed custom modules in modules/contrib
  2. Site owner has placed contributed modules in both modules and modules/contrib.
  3. Provide a custom template.gitignore. Add option --gitignore=my.gitignore.
  4. Do not touch .gitignore. Add --no-gitignore option.
@grasmash grasmash added the enhancement New feature or request label Mar 13, 2019
@grasmash
Copy link
Owner Author

grasmash commented Mar 13, 2019

I'm not sure that the 1 and 3 are valuable.

\1. It seems like just as much work to specify which modules to ignore as it would be to simply remove them from composer.json after the fact.
\3. You just as easily use --no-gitignore and then copy your template file into place.

I'll look at solutions to 2 and 4.

@imclean557
Copy link

imclean557 commented Mar 26, 2019

\2. describes our situation migrating a bunch of sites to a composer based workflow. This comes about because sites have traditionally used modules as the module directory. At some point drush started putting everything into modules/contrib so existing sites had a mix when adding new modules.

Composer also does this so some modules have been installed with composer, some with drush and some manually.

@imclean557
Copy link

Can 2. also apply to themes?

@imclean557
Copy link

Because point 2 may be quite a common scenario compared to other other paths, I've made the following changes to my local findContribProjects():

    /**
     * @param $root_composer_json
     *
     * @return array
     */
    protected function findContribProjects($root_composer_json)
    {
        $modules = DrupalInspector::findContribProjects(
            $this->drupalRoot,
            "modules/contrib",
            $root_composer_json
        );
        $modules += DrupalInspector::findContribProjects(
            $this->drupalRoot,
            "modules",
            $root_composer_json
        );
        $themes = DrupalInspector::findContribProjects(
            $this->drupalRoot,
            "themes/contrib",
            $root_composer_json
        );
        $themes += DrupalInspector::findContribProjects(
            $this->drupalRoot,
            "themes",
            $root_composer_json
        );
        $profiles = DrupalInspector::findContribProjects(
            $this->drupalRoot,
            "profiles/contrib",
            $root_composer_json
        );
        $projects = array_merge($modules, $themes, $profiles);
        return $projects;
    }

@imclean557
Copy link

Sorry for the noise. It's not as simple as the above as module updates will be put into modules/contrib even if they're found in modules.

@grasmash
Copy link
Owner Author

grasmash commented Mar 26, 2019

We could just make it move all of the modules in modules to modules/contrib automatically. They're going to move there anyway after composer rebuilds dependencies.

@imclean557
Copy link

That would be a good outcome and effectively what I did. Composer put all the updates in modules/contrib and I manually removed the old versions from modules. I also needed to run rebuild.php and remove the drush directory (I'm using Drush 8). Now everything is nicely organised,

@grasmash
Copy link
Owner Author

grasmash commented Jul 25, 2019

\3. was addressed by #26

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

No branches or pull requests

2 participants