Generate boilerplate code for modules/plugins/services etc.
Drush asks questions so that the generated code is as polished as possible. Aftergenerating, Drush lists the files that were created.
Drush make is an extension to drush that can create a ready-to-use drupal site, pulling sources from various locations. It does this by parsing a flat text file (similar to a drupal.info file) and downloading the sources it describes. In practical terms, this means that it is possible to distribute a complicated Drupal distribution as a single. Sudo drush -y make profiles/MYPROFILE/MYPROFILE.make Make new site in the current directory? (y/n): y Beginning to build profiles/MYPROFILE/MYPROFILE.make. ok No core project specified. error But as you can see from my excerpt of the make file above, it does specify a core. And again, it works on two different VMs.
Examples¶
drush generate
. Pick from available generators and then run it.drush generate controller
. Generate a controller class for your module.drush generate drush-command-file
. Generate a Drush commandfile for your module.
drush generate
. Pick from available generators and then run it.drush generate controller
. Generate a controller class for your module.drush generate drush-command-file
. Generate a Drush commandfile for your module.
Arguments¶
- [generator]. A generator name. Omit to pick from available Generators.
Options¶
- --answers=ANSWERS. A JSON string containing pairs of question and answers.
- --directory=DIRECTORY. Absolute path to a base directory for file writing.
Topics¶
- Instructions on creating your own Drush Generators. (docs:generators)
Aliases¶
- gen
Legend
- An argument or option with square brackets is optional.
- Any default value is listed at end of arg/option description.
- An ellipsis indicates that an argument accepts multiple values separated by a space.
If you want to build a Drupal site using a Drush make file instead of Composer, you will need to do the following:
- Set
drupal_build_composer_project: false
- Set
drupal_build_makefile: true
- Use the
example.drupal.make.yml
file as a base (copy it to a new file nameddrupal.make.yml
), or use your own Drush make file- (You can also set a separate path to the makefile using the
drush_makefile_path
variable.)
- (You can also set a separate path to the makefile using the
- Set the following options to force an install an older version of Drush (Drush 9+ no longer supports Drush make files):
Have a look at the defaults in default.config.yml
and tweak the settings as you'd like in your config.yml
, then run vagrant up
as in the Quick Start Guide. Within a few minutes, you should have your site running and available at the drupal_domain
configured in config.yml
, falling back to the default http://drupalvm.test
set in default.config.yml
.
Drush Make Force
With the default settings the Drupal site will be built on the VM inside /var/www/drupalvm/drupal/web
but the web/
subdirectory is only required for composer
based projects and you can simplify this directory structure by setting drupal_core_path
to /var/www/drupalvm/drupal
.