Skip to content

Commit

Permalink
Remove Finder+Launcher. Use DrupalFinder (drush-ops#2749)
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman authored May 11, 2017
1 parent 990a4b3 commit 7ebd5fa
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 934 deletions.
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
"irc": "irc://irc.freenode.org/drush"
},
"bin": [
"drush",
"drush.launcher",
"drush.php",
"drush.complete.sh"
"drush"
],
"require": {
"php": ">=5.6.0",
Expand All @@ -45,6 +42,7 @@
"symfony/finder": "~2.7|^3",
"pear/console_table": "~1.3.0",
"phpdocumentor/reflection-docblock": "^2.0",
"webflo/drupal-finder": "^0",
"webmozart/path-util": "~2",
"sebastian/version": "~1"
},
Expand Down
1 change: 0 additions & 1 deletion docs/examples.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
The _examples_ folder contains excellent example files which you may copy and edit as needed. Read the documentation right in the file. If you see an opportunity to improve the file, please submit a pull request.

* [drush.wrapper](https://raw.githubusercontent.com/drush-ops/drush/master/examples/drush.wrapper). A handy launcher script which calls the Drush located in vendor/bin/drush and can add options like --local, --root, etc.
* [example.aliases.drushrc.php](https://raw.githubusercontent.com/drush-ops/drush/master/examples/example.aliases.drushrc.php). Example site alias definitions.
* [example.bashrc](https://raw.githubusercontent.com/drush-ops/drush/master/examples/example.bashrc). Enhance your shell with lots of Drush niceties including bash completion.
* [example.drush.ini](https://raw.githubusercontent.com/drush-ops/drush/master/examples/example.drush.ini). Configure your PHP just for Drush requests.
Expand Down
113 changes: 1 addition & 112 deletions drush
Original file line number Diff line number Diff line change
@@ -1,115 +1,4 @@
#!/usr/bin/env php
<?php

/**
* This is the Drush "finder" script, which is one part of the
* Drush dispatching chain. This is the script that
* should appear in your global $PATH, or, if using Composer
* (as usually the case), will be found in your vendor/bin directory.
*
*
* - Never copy this script to your site root. Copy examples/drush instead.
*
* - Never copy this script to a directory other than its install directory.
* Symlink to it instead.
*
*
* OVERVIEW OF DRUSH FINDER / WRAPPER / LAUNCHER SCRIPTS
*
* When the user types "drush", up to three scripts might be
* involved in the initial launch:
*
* "drush finder" -> "drush wrapper" -> "drush launcher".
*
* Brief description of each:
*
* - Drush finder: Finds the right Drush script and calls it.
* - Drush wrapper: Contains user customizations to options.
* - Drush launcher: Excutes drush.php.
*
* A full explanation of each script follows.
*
*
* DRUSH FINDER
*
* - The "drush" script on the user's global $PATH
* - It's goal is to find the correct site-local Drush to run.
*
* The Drush finder will locate the correct site-local Drush to use
* by examining:
*
* a) The --root option
* b) The site set via `drush site set` in the current terminal
* c) The cwd
*
* If no site-local Drush is found, then the global Drush will be
* used. The Drush finder assumes that the global Drush is the
* "Drush launcher" found in the same directory as the Drush finder itself.
*
* If a site-local Drush is found, then the Drush finder will call
* either the "Drush wrapper", if it exists, or the "Drush launcher" if
* there is no wrapper script.
*
*
* DRUSH WRAPPER
*
* - The drush.wrapper script that the user optionally copies and edits.
* - Its goal is to allow the user to add options when --local is in use
*
* The Drush "wrapper" is found at examples/drush.wrapper, and may optionally
* be copied to __ROOT__ by the user. It may be named either
* "drush" or "drush.wrapper". It will call the "Drush launcher"
* for the same site that it is located in. It adds the --local flag; the
* user is encouraged to add other options to the "Drush wrapper", e.g. to set
* the location where aliases and global commandfiles can be found.
* The Drush "finder" script always calls the "Drush wrapper" if it exists;
* however, if the user does not want to customize the early options of
* the site-local Drush (site-alias locations, etc.), then the wrapper does not
* need to be used.
*
*
* DRUSH LAUNCHER
*
* - The "drush.launcher" script in vendor/bin
* - The bash script formerly called "drush"
*
* The "Drush launcher" is the traditional script that identifies PHP and
* sets up to call drush.php. It is called by the "Drush wrapper", or
* directly by the "Drush launcher" if there is no "Drush wrapper" in use.
*
*
* LOCATIONS FOR THESE SCRIPTS
*
* "Drush finder" : __ROOT__/vendor/bin/drush (composer install)
* __DRUSH__/drush (source)
*
* "Drush wrapper" : __ROOT__/drush (copied by user)
* __DRUSH__/examples/drush.wrapper (source)
*
* "Drush launcher" : __ROOT__/vendor/bin/drush.launcher (composer install)
* __DRUSH__/drush.launcher (source)
*
*
* BACKEND CALL DISPATCHING
*
* Backend calls are typically set up to call the "drush" script in the $PATH,
* or perhaps some might call __ROOT__/vendor/bin/drush directly, by way
* of the "drush-script" element in a site alias. In either event, this is
* the "drush finder" script.
*
* The backend call will always set --root. The "Drush finder" script
* always favors the site-local Drush stored with the site indicated by the
* --root option, if it exists. If there is no site-local Drush, then the
* "Drush finder" will behave as usual (i.e., it will end up calling the
* "Drush launcher" located next to it).
*
* This should always get you the correct "Drush" for local and remote calls.
* Note that it is also okay for aliases to specify a path directly to
* drush.launcher, in instances where it is known that a recent version of
* Drush is installed on the remote end.
*/

if (!function_exists("drush_startup")) {
include __DIR__ . '/includes/startup.inc';
}
drush_startup($argv);
require __DIR__ . '/drush.php';
132 changes: 0 additions & 132 deletions drush.launcher

This file was deleted.

1 change: 0 additions & 1 deletion drush.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env php
<?php
/**
* @file
Expand Down
27 changes: 0 additions & 27 deletions examples/drush.wrapper

This file was deleted.

5 changes: 2 additions & 3 deletions includes/backend.inc
Original file line number Diff line number Diff line change
Expand Up @@ -837,11 +837,10 @@ function drush_backend_invoke_concurrent($invocations, $common_options = array()
// If the caller did not pass in a specific path to drush, then we will
// use a default value. For commands that are being executed on the same
// machine, we will use DRUSH_COMMAND, which is the path to the drush.php
// that is running right now. For remote commands, we will run a wrapper
// script instead of drush.php called drush.
// that is running right now.
$drush_path = $site_record['path-aliases']['%drush-script'];
if (!$drush_path && !$is_remote && $is_different_site) {
$drush_path = find_wrapper_or_launcher($site_record['root']);
$drush_path = DRUSH_COMMAND;
}
$env_vars = $site_record['#env-vars'];
$php = array_key_exists('php', $site_record) ? $site_record['php'] : (array_key_exists('php', $command_options) ? $command_options['php'] : NULL);
Expand Down
2 changes: 1 addition & 1 deletion includes/drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function drush_get_global_options($brief = FALSE) {
$options['alias-path'] = array('context' => 'ALIAS_PATH', 'local-context-only' => TRUE, 'merge-pathlist' => TRUE, 'propagate-cli-value' => TRUE, 'description' => "Specifies the list of paths where drush will search for alias files.", 'example-value' => '/path/alias1:/path/alias2');
$options['confirm-rollback'] = array('description' => 'Wait for confirmation before doing a rollback when something goes wrong.');
$options['complete-debug'] = array('hidden' => TRUE, 'description' => "Turn on debug mode forf completion code");
$options['php-options'] = array('description' => "Options to pass to `php` when running drush. Only effective when using the drush.launcher script.", 'never-propagate' => TRUE, 'example-value' => '-d error_reporting="E_ALL"');
$options['php-options'] = array('hidden' => TRUE, 'description' => "Options to pass to `php` when running drush. Only effective when specified in a site alias definition.", 'never-propagate' => TRUE, 'example-value' => '-d error_reporting="E_ALL"');
$options['halt-on-error'] = array('propagate-cli-value' => TRUE, 'description' => "Manage recoverable errors. Values: 1=Execution halted. 0=Execution continues.");
$options['deferred-sanitization'] = array('hidden' => TRUE, 'description' => "Defer calculating the sanitization operations until after the DB is copied. This is the default if the source DB is remote.");
$options['remote-host'] = array('hidden' => TRUE, 'description' => 'Remote site to execute drush command on. Managed by site alias.', 'example-value' => 'http://example.com');
Expand Down
Loading

0 comments on commit 7ebd5fa

Please sign in to comment.