diff --git a/README.md b/README.md index 7081438f8f..7a342a3791 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ Resources * [General Documentation](http://docs.drush.org) [(Drush8)](http://docs.drush.org/en/8.x) * [API Documentation](http://api.drush.org) * [Drush Commands](http://drushcommands.com) -* Subscribe [this atom feed](https://github.com/drush-ops/drush/releases.atom) to receive notification on new releases. Also, [Version eye](https://www.versioneye.com/). +* Subscribe [this atom feed](https://github.com/drush-ops/drush/releases.atom) to receive notification of new releases. Also, [Version eye](https://www.versioneye.com/). * [Drush packages available via Composer](https://packagist.org/search/?type=drupal-drush) * [A list of modules that include Drush integration](https://www.drupal.org/project/project_module?f[2]=im_vid_3%3A4654&solrsort=ds_project_latest_release+desc) * Drush comes with a [full test suite](https://github.com/drush-ops/drush/blob/master/tests/README.md) powered by [PHPUnit](https://github.com/sebastianbergmann/phpunit). Each commit gets tested by the awesome [Travis.ci continuous integration service](https://travis-ci.org/drush-ops/drush). Support ----------- -* Post support requests to [Drupal Answers](http://drupal.stackexchange.com/questions/tagged/drush). +* Post support requests to [Drupal Answers](http://drupal.stackexchange.com/questions/tagged/drush). Tag question with 'drush'. * Report bugs and request features in the [GitHub Drush Issue Queue](https://github.com/drush-ops/drush/issues). * Use pull requests (PRs) to contribute to Drush. diff --git a/docs/bootstrap.md b/docs/bootstrap.md index 313e02c624..73ed44a243 100644 --- a/docs/bootstrap.md +++ b/docs/bootstrap.md @@ -2,7 +2,7 @@ The Drush Bootstrap Process =========================== When preparing to run a command, Drush works by "bootstrapping" the Drupal environment in very much the same way that is done during a normal page request from the web server, so most Drush commands run in the context of a fully-initialized website. -For efficiency and convenience, some Drush commands can work without first bootstrapping a Drupal site, or by only partially bootstrapping a site. This is faster than a full bootstrap. It is also a matter of convenience, because some commands are useful even when you don't have a working Drupal site. For example, you can use Drush to download Drupal with `drush dl drupal`. This obviously does not require any bootstrapping to work. +For efficiency and convenience, some Drush commands can work without first bootstrapping a Drupal site, or by only partially bootstrapping a site. This is faster than a full bootstrap. It is also a matter of convenience, because some commands are useful even when you don't have a working Drupal site. DRUSH\_BOOTSTRAP\_NONE ----------------------- diff --git a/docs/commands.md b/docs/commands.md index 78f5504133..b07357c506 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -3,17 +3,19 @@ Creating Custom Drush Commands Creating a new Drush command is very easy. Follow these simple steps: -1. Copy the example commandfile at lib/Drush/Commands/examples/Commands/SandwichCommands.php to mymodule/src/Drush/Commands/MyModuleCommands.php -1. Edit the namespace and classnames in your file to match the file's location. -1. Use the classes for the core Drush commands at /lib/Drush/Commands as inspiration and documentation. -1. Rename and edit the makeSandwich() method. Carefully add/edit/remove annotations above the method and put your logic inside the method. +1. Run `drush generate drush-command-file`. +1. Enter the machine name of the module that should "own" the file. +1. Drush will then report that it created a commandfile and a drush.services.yml file. Edit those 2 files as needed. +1. Use the classes for the core Drush commands at /lib/Drush/Commands as inspiration and documentation. +1. Once your two files are ready, run `drush cr` to get your command recognized by the Drupal container. Drush searches for commandfiles in the following locations: -- Folders listed in the 'include' option (see `drush topic docs-configuration`). -- The system-wide Drush commands folder, e.g. /usr/share/drush/commands -- The ".drush" folder in the user's HOME folder. -- /drush and /sites/all/drush in the current Drupal installation -- All enabled modules in the current Drupal installation -- Folders and files containing other versions of Drush in their names will be \*skipped\* (e.g. devel.drush4.inc or drush4/devel.drush.inc). Names containing the current version of Drush (e.g. devel.drush5.inc) will be loaded. +- Folders listed in the 'include' option (see `drush topic docs-configuration`). +- The system-wide Drush commands folder, e.g. /usr/share/drush/commands. +- The ".drush" folder in the user's HOME folder. +- ../drush, /drush and /sites/all/drush relative to the current Drupal installation. +- All enabled modules in the current Drupal installation. + +Note: Folders and files containing other versions of Drush in their names will be \*skipped\* (e.g. devel.drush7.inc or drush7/devel.drush.inc). Names containing the current version of Drush (e.g. devel.drush9.inc) will be loaded. diff --git a/docs/cron.md b/docs/cron.md index 04ab36d024..fe49d3cdd9 100644 --- a/docs/cron.md +++ b/docs/cron.md @@ -1,16 +1,16 @@ Running Drupal cron tasks from Drush ==================================== -Drupal cron tasks are often set up to be run via a wget call to cron.php; this same task can also be accomplished via the `drush cron` command, which circumvents the need to provide a webserver interface to cron. +Drupal cron tasks are often set up to be run via a wget call to cron.php; this same task can also be accomplished via the `drush cron` command, which circumvents the need to provide a web server interface to cron. Quick start ---------- If you just want to get started quickly, here is a crontab entry that will run cron once every hour at ten minutes after the hour: - 10 * * * * /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin COLUMNS=72 /usr/local/bin/drush --root=/path/to/your/drupalroot --uri=your.drupalsite.org --quiet cron + 10 * * * * /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin COLUMNS=72 cd [DOCROOT] && ../vendor/bin/drush --uri=your.drupalsite.org --quiet cron -You should set up crontab to run your cron tasks as the same user that runs the web server; for example, if you run your webserver as the user www-data: +You should set up crontab to run your cron tasks as the same user that runs the web server; for example, if you run your web server as the user www-data: sudo crontab -u www-data -e @@ -45,5 +45,5 @@ By default, Drush will print a success message when the run of cron is completed Specifying the Drupal site to run --------------------------------- -There are many ways to tell Drush which Drupal site to select for the active command, and any may be used here. The example uses the --root and --uri flags, but you could also use an alias record. +There are many ways to tell Drush which Drupal site to select for the active command, and any may be used here. The example uses `cd [DOCROOT]`, but you could also use the --root and --uri flags, or a site alias. diff --git a/docs/install.md b/docs/install.md index 274b3cfaa8..d3c1565f0b 100644 --- a/docs/install.md +++ b/docs/install.md @@ -4,13 +4,14 @@ See the [Drush 8 docs](http://docs.drush.org/en/8.x) for installing prior versions of Drush. -Install a site-local Drush +Install a site-local Drush and Drush Launcher. ----------------- 1. It is recommended that Drupal 8 sites be [built using Composer, with Drush listed as a dependency](https://github.com/drupal-composer/drupal-project). That project already includes Drush in its composer.json. If your Composer project doesn't yet depend on Drush, run `composer require drush/drush` to add it. 1. To run Drush, navigate to project root or Drupal root and call like so: `../vendor/bin/drush`. -1. If you want the convenience of being able to call `drush` from anywhere, install the [drush-shim](https://github.com/webflo/drush-shim). Thats a small launcher program that locates your Composer project and hands control to its Drush. +1. To be able to call `drush` from anywhere, install the [Drush Launcher](https://github.com/drush-ops/drush-launcher). That is a small program which listens on your $PATH and hands control to a site-local Drush that is in the /vendor directory of your Composer project. If you skip this step, call drush from within drupal via ../vendor/bin/drush. Note that Drush's bash integration and custom prompt won't work. +1. Run `drush init`. This edits ~/.bashrc so that Drush's custom prompt and bash integration are active. 1. See [Usage](http://docs.drush.org/en/master/usage/) for details on using Drush. -1. To use a non-default PHP, [edit ~/.bashrc so that the desired PHP is in front of your $PATH](http://stackoverflow.com/questions/4145667/how-to-override-the-path-of-php-to-use-the-mamp-path/10653443#10653443). If thats not desireable, you can change your PATH for just one request: `PATH=/path/to/php:$PATH` drush status ...` +1. To use a non-default PHP, [edit ~/.bashrc so that the desired PHP is in front of your $PATH](http://stackoverflow.com/questions/4145667/how-to-override-the-path-of-php-to-use-the-mamp-path/10653443#10653443). If that is not desireable, you can change your PATH for just one request: `PATH=/path/to/php:$PATH` drush status ...` Drupal Compatibility ----------------- diff --git a/docs/usage.md b/docs/usage.md index d5c5df663b..c898fc47de 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -1,7 +1,7 @@ Usage ----------- -Drush can be run in your shell by typing "drush" from within any Drupal root directory. +With the [Drush Launcher](https://github.com/drush-ops/drush-launcher), Drush can be run in your shell by typing "drush" from within your project root directory or anywhere within Drupal. $ drush [options] [argument1] [argument2]