Skip to content

Commit

Permalink
Docs improvements including drush-launcher mentions
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed Aug 4, 2017
1 parent 8d7443e commit c1c3725
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------------
Expand Down
22 changes: 12 additions & 10 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

8 changes: 4 additions & 4 deletions docs/cron.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.

7 changes: 4 additions & 3 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
@@ -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] <command> [argument1] [argument2]

Expand Down

0 comments on commit c1c3725

Please sign in to comment.