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

What is the right drush extension composer type? #1132

Closed
fago opened this issue Jan 29, 2015 · 3 comments
Closed

What is the right drush extension composer type? #1132

fago opened this issue Jan 29, 2015 · 3 comments

Comments

@fago
Copy link
Contributor

fago commented Jan 29, 2015

For providing and installing drush extensions via composer there are currently two composer package types:

So I wonder, which one should be used?
"drush-extension" seems to be promoted by drush (via packages.drush.org), however when using that I was not able to add the drush extension to a drupal site, such that it install in the right path. With "drupal-drush" this is solved, and custom installer paths are supported as well.

So which type should be used?
If it is "drush-extension", how would I install the drush-extension in the right sub-directory when added to a project?

@greg-1-anderson
Copy link
Member

It depends on which installer you are using. As you mention, Composer Installers uses "drupal-drush", as defined in DrupalInstaller.php.

I'm not sure where "drush-extension" came from; there is a discussion in #572, but there is no background about how the type was picked. The first mention was by me, but I was just referring to what other folks were already using. I think the problem is that this is just growing up organically. We need standards, but, since these repositories are maintained by third parties, and there's probably code referring to both types in different places, it will probably be a while before we manage to make progress here. I think we should probably standardize on "drupal-drush", but that's probably a discussion to have in the Command Ecosystem issue.

So, what do we do in the meantime? Well, you could post a PR to Composer Installers, and add a DrushInstaller class that recognized "drush-extension".

The other thing you can do is use a different custom installer. Right now, the composer_generate Drush command uses davidbarratt/custom-installer (and also derhasi/composer-preserve-paths, to allow Drupal to be used as a dependency of a project, without using a split core), which allows you to place your routing information in the 'extras' element of your composer.json file, like so:

    "extra": {
        "custom-installer": {
            "drupal-module": "htdocs/sites/all/modules/contrib/{$name}/",
            "drupal-theme": "htdocs/sites/all/themes/contrib/{$name}/",
            "drupal-library": "htdocs/sites/all/libraries/{$name}/",
            "drupal-drush": "htdocs/sites/all/drush/{$name}/",
            "drupal-profile": "htdocs/profiles/{$name}/",
            "drupal-core": "htdocs/"
        },
    },

In my case, I am only pulling from drupal-packagist.webflo.io, which publishes modules from drupal.org, and is using "drupal-drush" for Drush extensions. If you also want to include packages from http://packages.drush.org, then you could add another path for "drush-extension".

Drush searches both ROOT/sites/all/drush, and also ROOT/drush, so you can use either location, per your preference. Composer installers is using ROOT/drush.

@fago
Copy link
Contributor Author

fago commented Feb 3, 2015

Thanks for the good overview. For now, I've been just adding a custom package definition using "drupal-drush" in my composer.json

"drupal-drush" makes mostely sense for me, when thinking about adding extension to drupal projects. But as they can be installed globally also, "drush-extension" seems to be better fitting. Not sure the other issue is good for discussing that, as it already deals with a lot - but as you want :)

@greg-1-anderson
Copy link
Member

packagist.drupal-composer.org is using 'drupal-drush', so I think that we are standardized on that now.

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

No branches or pull requests

2 participants