backdrop-contrib / backdrop-drush-extension

A set of commands and boot class for Drush and Backdrop CMS.
GNU General Public License v2.0
14 stars 18 forks source link

Support drush make #130

Closed ghost closed 6 years ago

ghost commented 6 years ago

I'm trying to write a custom install profile which includes a make file to download specific modules automatically. Running drush make displays This command is not supported yet by Backdrop....

Can we add support for drush make to Backdrop?


PR: https://github.com/backdrop-contrib/drush/pull/132

serundeputy commented 6 years ago

Thanks @BWPanda can you provide an example of the makefile or maybe even a simplified version of it as a target use case for this functionality?

It is definitely possible to get this going.

serundeputy commented 6 years ago

I've added a PR: https://github.com/backdrop-contrib/drush/pull/132

That constructs a bmake command from the ground up (rather than porting the existing drush make command). I did it that way because:

  1. drush make command is huge and does a lot of things; I would not be able to comprehend and port them in a few hours.
  2. Much of the way drush interacts with d.org is very different in Backdrop acting against GitHub rather than d.o.
  3. If I build it up feature request by feature request, we chunk out manageable features one at a time and understand the whole system.

This the current functionality is limited to getting Backdrop, modules, themes, and layouts that are specified in a myfile.make.yml file. (this depends on having the PHP yaml extension in order to parse the file). I've added a README.md for the drush bmake command.

@BWPanda if you are up for testing that would be great! There is not too much harm on merging now and iterating on features/bugs as currently we have no make functionality.

ghost commented 6 years ago

I'll look into this tomorrow possibly, but I can say now that if there's any possibility of not having a dependency on yaml, that'd be great.

I have no idea what yaml is, only that I've heard of it in conjunction with D8 as one of the many new technologies I'd have to become familiar with in order to use it (and one of the reasons I didn't go down the D8 path).

If it needs to stay, I'll be ok with that, but since Drush 8 still supports the legacy info file format, I'd suggest using that instead. yaml isn't used anywhere else in Backdrop (that I'm aware of), but info files abound, so I can see that fitting in with Backdrop better...

serundeputy commented 6 years ago

@BWPanda I didn't know about the info file format for make i just saw the yaml they currently use; I'm sure I can refactor to use the .info format.

I'll look into it

serundeputy commented 6 years ago

I've updated the PR to use the PHP ini format:

; Drush bmake ini file

; Backdrop Core Version
core = "1.x"

; Add a list of modules for your project.
[modules]

webform = "1.x-4.16.0"
headless = "1.x-1.0.0"

; Add a list of themes for your project.
[themes]

bootstrap_lite = 3
purple = 8

; Add a list of layouts for your project.
[layouts]

hero = 1

As of now the version numbers have no effect; I still need to refactor dl to accept a --version option and allow users to pin versions for there builds.

serundeputy commented 6 years ago

I've updated the PR to give dl a --version option which a user can pass in a specific version of a module, theme, or layout:

drush dl webform --version=1.x-1.6.2

In turn the drush bmake command can now pass the version strings from the make.ini file into the new --version option. So if you have a makefile called myfile.make.inithe command:

drush bmake myfile.make.ini my-app

will download backdrop, prompt for interactive install (DB creds etc.

screen shot 2018-01-21 at 2 08 52 pm

or you can pass in the D6 style db-url for a non-interactive run.

drush bmake myfile.make.ini my-app --db-url=mysql://MYSQLUSER:MYSQLPASS@localhost/MYAPPDB
serundeputy commented 6 years ago

per gitter; refactor to drush bake and examine aliases.

ghost commented 6 years ago

Thanks @serundeputy! Let me know if/when you want me to test your work. In the meantime, here's a list of things I'd love to be able to do with a make file (not sure if you've already accounted for these things or not):

serundeputy commented 6 years ago

Thanks @BWPanda This is a great list and will help me focus development!

Support Backdrop multisites (e.g. download modules (and themes, etc.) into /sites/[SITE_NAME]/modules/ and not need to download Backdrop core each time)

[core]
core = "false"

Download latest, stable versions of modules, themes, etc. without needing to specify a version number (should match the 'core' Backdrop version)

headless = "latest"

Download specific versions of modules, themes, etc. (like '1.x-1.0.1', or better yet '1.0.1' (it should get the '1.x' from the 'core' value))

headless = "1.x-1.0.0"

Some modules in backdrop-contrib use the 1.x preface to indicate which core they support ( not all, but most?) ... I have no good way of knowing which ones do and don't, but I think I've put some handling of that in drush up ... I can check it out and see if I can make drush bmake work with or without the 1.x preface in the module, theme, and layout version strings. I think I'd like to see that as a new issue/feature as to not hold up what we have so far.

Download non-Backdrop projects (like other GitHub repositories, specify a custom URL, etc.)

We should open a new issue for this feature as well. Some kind of general git pull functionality or something; having a specific use case would help drive development of this feature a great deal.

Download a specific branch (Backdrop equivalent of applying a Drupal patch) (e.g. '1.x-1.x')

This would be great as well! I've got an issue about allowing drush dl to get dev versions here: https://github.com/backdrop-contrib/drush/issues/107. Once drush dl adds the functionality to handle the --dev flag we can then have drush bmake pass off to that just like in the --version case.

thanks for the great list. Feel like opening a couple of issues?

ghost commented 6 years ago

Thanks! I've added issues as above. I didn't bother creating an issue for leaving out the BD core version (1.x) as I can see how that's probably not even possible with the way Backdrop/GitHub is setup. So never mind about that.

serundeputy commented 6 years ago

@BWPanda Great! I've merged the PR as is so we can iterate on the new issues.

That means feel free to update your drush and test and use the current bmake and I'll start on the other issues.