Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony dispatch #2843

Merged
merged 196 commits into from
Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
2b12e16
Symfony dispatch: 17 July - 1 Sept.
greg-1-anderson Sep 1, 2017
03032ed
Remove duplicate package entries.
weitzman Sep 1, 2017
0102947
Port core-execute command.
weitzman Sep 1, 2017
823d659
Update commands to use new Alias API while preserving backward compat…
weitzman Sep 1, 2017
e9d9e1d
Enable logging again (once DI container is initialized).
greg-1-anderson Sep 14, 2017
23dd6e1
Start using Drush’s own help and list commands.
weitzman Sep 1, 2017
90350af
Handle --yes and --debug (#2927)
weitzman Sep 3, 2017
8298a2c
Remove drush_get_context() calls from src/[Drupal]/Commands
weitzman Sep 4, 2017
8c8c68a
Enable logging again (once DI container is initialized).
greg-1-anderson Sep 14, 2017
ffff049
Merge pull request #2941 from drush-ops/symfony-dispatch-remove-contexts
greg-1-anderson Sep 14, 2017
8d363a4
Set interactive on the DrushInputAdapter. This does little good, thou…
greg-1-anderson Sep 15, 2017
4552c73
Put confirm() back.
greg-1-anderson Sep 15, 2017
8e5937e
Use output() rather than io() to check the verbose setting.
greg-1-anderson Sep 15, 2017
edeb2b3
Go back to using Symfony's built-in help for now.
greg-1-anderson Sep 15, 2017
39b14a3
Just mark the failing annotated help tests as skipped.
greg-1-anderson Sep 15, 2017
e306457
Refactor some Preflight methods into the Application class.
greg-1-anderson Sep 15, 2017
422db06
If a command cannot be found, bootstrap further and try to find the c…
greg-1-anderson Sep 15, 2017
a259bad
Select site conf path (settings dir) from --uri.
greg-1-anderson Sep 16, 2017
44f4a61
Fix uri selection for tranditional Drush dispatcher again.
greg-1-anderson Sep 16, 2017
4a15620
Validate file paths in options as well.
weitzman Sep 16, 2017
8f99f9e
Fix declaration of php-script option.
weitzman Sep 16, 2017
040de44
Fix calls to 'version' in tests.
weitzman Sep 16, 2017
7c1587f
More careful validation of permission names.
weitzman Sep 16, 2017
15d5552
Add exception to site-alias command.
weitzman Sep 16, 2017
a9e58b1
Fix --simulate values in siteAliasTest.php.
weitzman Sep 16, 2017
507cabc
Fix declaration of --cd in ssh command.
weitzman Sep 16, 2017
d3f695c
Fix options declaration in sql-create.
weitzman Sep 16, 2017
ad65433
Revert "Fix declaration of --cd in ssh command."
greg-1-anderson Sep 16, 2017
62c592b
Rename 'dr' script to 'drush'.
greg-1-anderson Sep 16, 2017
7473ac6
Adjustments to tests.
greg-1-anderson Sep 16, 2017
148150f
Simulate / verbose mode.
greg-1-anderson Sep 17, 2017
e23efe5
Throw exceptin in user-login.
weitzman Sep 17, 2017
c8edb99
Get rid of some legacy preflight operations getting in our way.
greg-1-anderson Sep 18, 2017
41d5f70
Add an escapeshellarg to the sut argument generation script.
greg-1-anderson Sep 18, 2017
3491b28
Fix simulate mode.
greg-1-anderson Sep 18, 2017
aade67f
Code style.
greg-1-anderson Sep 18, 2017
2ecc5d1
Ensure that bootstrap fails if a suitable bootstrap object is not found.
greg-1-anderson Sep 18, 2017
1df1382
Fix bootstrapping in site-install, so that it is possible to install …
greg-1-anderson Sep 18, 2017
5738523
Coding standards.
greg-1-anderson Sep 18, 2017
ee394fa
Use dev-master of annotated-command, since features we depend on need…
greg-1-anderson Sep 18, 2017
a370a1f
Merge pull request #2942 from drush-ops/test-symfony-dispatch
greg-1-anderson Sep 19, 2017
15651e5
Remove commandTest.php. Its duplicated by Symfony Console's own tests.
weitzman Sep 19, 2017
16045a2
Skip standalone drush script tests. Those are not supported anymore.
weitzman Sep 19, 2017
57855fb
Remove shell alias tests. That feature is not supported for now.
weitzman Sep 19, 2017
be30fff
Let php-script accept extra options/arguments in traditional symfony …
weitzman Sep 19, 2017
e9c0a53
Fix a user_fields_D8.php for new script extra arguments syntax.
weitzman Sep 19, 2017
e158931
Fix annotatedCommandTest. Disable tests for console.commands and --ig…
greg-1-anderson Sep 19, 2017
3d568df
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 19, 2017
73507d8
Remove contexts tests -- context is obsolete.
greg-1-anderson Sep 19, 2017
b714fde
Stop double-testing symfony-dispatch branch.
greg-1-anderson Sep 19, 2017
4f843bd
Skip all of the backend tests.
greg-1-anderson Sep 19, 2017
a27d2f3
Cannot use default value for script parameter with an array extra in …
greg-1-anderson Sep 19, 2017
610083e
Fix php-script.
weitzman Sep 19, 2017
ef477de
Improve docs for php-script.
weitzman Sep 19, 2017
f404778
Convert single file aliases that define a variable called 'aliases'.
weitzman Sep 19, 2017
9c488d5
Remove a drush_get_option() call in config-import.
weitzman Sep 19, 2017
b6e3d48
Fix bootstrapping for LoginCommand.
greg-1-anderson Sep 19, 2017
e9d3e76
Use 'none' as default in BootstrapHook, since this method is expectin…
greg-1-anderson Sep 19, 2017
e2ea35b
Port unit.drush.inc to Commands/TestFixturesCommands.php. Disable bat…
greg-1-anderson Sep 19, 2017
cd6c46b
Remove command unit test; skip config pull test.
greg-1-anderson Sep 19, 2017
954a2c7
Fix the image-derive validate-entity-load parameter.
greg-1-anderson Sep 19, 2017
3bdb7d8
Stop using --backend to test core-init command.
greg-1-anderson Sep 19, 2017
58d135c
Skip the role tests that depend on backend invoke.
greg-1-anderson Sep 19, 2017
7baa38b
Skip core tests -- all unimplemented.
greg-1-anderson Sep 19, 2017
7b91cfd
Fix user-login test, skip user-cancel test.
greg-1-anderson Sep 19, 2017
bb78c12
Mark site-set skipped. Tests need backend invoke.
greg-1-anderson Sep 19, 2017
08669a7
Remove siteAliasUnitTest, skip all tests in siteAliasTest.
greg-1-anderson Sep 19, 2017
04cd967
Skip sql-sync tests.
greg-1-anderson Sep 19, 2017
ab932c1
Ignore a minor problem with dependency hell and symfony/yaml in the t…
greg-1-anderson Sep 19, 2017
eed6072
Remove DRUSH_PIPE mode.
greg-1-anderson Sep 20, 2017
73a7e8d
Remove some calls to drush_get_option in annotated commands.
greg-1-anderson Sep 20, 2017
a9f8ac2
Remove UnitUnishTestCase, wich depends on old drush_bootstrap() code.
greg-1-anderson Sep 20, 2017
736cb86
Start porting sql-sync.
weitzman Sep 20, 2017
4ddddb6
Remove some dependencies on functions in the legacy preflight file.
greg-1-anderson Sep 20, 2017
1c78807
Code style
greg-1-anderson Sep 20, 2017
f8e0a51
More modernizing of sql-sync for AliasManager.
weitzman Sep 20, 2017
7da93d7
Use $options['cache-clear'] instead of drush_get_option in CacheComma…
greg-1-anderson Sep 20, 2017
4026fcf
Merge pull request #2946 from drush-ops/symfony-dispatch-remove-some-…
greg-1-anderson Sep 20, 2017
dad1be4
Enhance isLocal() and isRemote() to recognize localhost and 127.0.0.1.
weitzman Sep 20, 2017
81b750e
Re-enable core-requirements test as it is passing.
weitzman Sep 20, 2017
7e3bfa4
Recognize --backend flag. Print log messages to backend. Print backen…
greg-1-anderson Sep 20, 2017
b69fc21
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 20, 2017
5052f55
Fix image-flush --all for non-interactive calls, and re-enable some a…
weitzman Sep 20, 2017
01ca0d2
Pass through --include et. al. in backend invoke, and fix the batch t…
greg-1-anderson Sep 20, 2017
1feca6e
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 20, 2017
d379bb3
Re-enable testDrupalDirectory() as it is passing with the --backend w…
weitzman Sep 20, 2017
7d763c7
Define ETC_PREFIX et. al. in sut. [ci skip]
greg-1-anderson Sep 20, 2017
6029b03
Enable role test
greg-1-anderson Sep 20, 2017
206ef52
Remove filesystem test.
greg-1-anderson Sep 20, 2017
23adebd
remove tests/siteAliasTest.php.
weitzman Sep 20, 2017
3197726
Re-enable testUserCancel(). Its passing.
weitzman Sep 20, 2017
582dd6d
re-enable a couple coreTest methods.
weitzman Sep 20, 2017
8606bee
Convert certain global options e.g. --ssh-options to configuration va…
greg-1-anderson Sep 20, 2017
ccfd4da
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 20, 2017
427b026
Code style.
greg-1-anderson Sep 20, 2017
a557aa3
Fix a couple of small errors with ssh command
greg-1-anderson Sep 20, 2017
247216a
Convert some instances of drush_get_option to \Drush\Drush::config().
greg-1-anderson Sep 21, 2017
2054a45
Add an rsync test. Skipped for now. [ci skip]
greg-1-anderson Sep 21, 2017
07041a0
Improve indentation in config-pull.
weitzman Sep 20, 2017
d6d01d9
Move databases() out of AliasRecod() and into sql-sync.
weitzman Sep 21, 2017
222b42f
Support --strict=0
greg-1-anderson Sep 21, 2017
62a32ee
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 21, 2017
ea586db
Add a HostPath class in Site Aliases to manage paths that include a h…
greg-1-anderson Sep 21, 2017
a7e364f
Indentation fix
weitzman Sep 21, 2017
fd5b5d6
sql-sanitize now clears Drupal’s persistent user cache as well
weitzman Sep 21, 2017
470196a
Minor upddates to get sqlSyncTest passing again.
weitzman Sep 21, 2017
da0af15
Add missing options to sql-sync definition
weitzman Sep 21, 2017
6a49d09
Rename runtime.args to runtime.argv, and add runtime.arguments and ru…
greg-1-anderson Sep 21, 2017
fe93c4d
Rebuild the sut in a scratch directory, and move it into place once s…
greg-1-anderson Sep 21, 2017
54cabb8
Add Drush::redispatchOptions()
greg-1-anderson Sep 21, 2017
e637993
Fix rsync test.
greg-1-anderson Sep 21, 2017
1ec1b1d
Code style.
greg-1-anderson Sep 21, 2017
d1f6b90
Use Drush::redispatchOptions() in sql-sync.
weitzman Sep 21, 2017
3579ac6
Use Drush::redispatchOptions() in various commands
weitzman Sep 21, 2017
ec6a6c5
Add default values for —bg and —editor
weitzman Sep 21, 2017
476db85
One more Drush::redispatchOptions() - in config-edit
weitzman Sep 21, 2017
0ab8d0c
Coding standards.
weitzman Sep 22, 2017
89def1b
Minor cleanup to browse and uli commands.
weitzman Sep 22, 2017
6dc88b5
Remove a variable in browseCommands
weitzman Sep 22, 2017
aa20d21
Cleanup core-cli
weitzman Sep 22, 2017
3d87074
Remove SiteAliasManagerAwareInterface as it seems to not work for boo…
weitzman Sep 22, 2017
bf36c5f
Hide sha command for now.
weitzman Sep 22, 2017
76a83bd
Remove a drush_get_context() call.
weitzman Sep 22, 2017
1921f17
Cleanup php-eval.
weitzman Sep 22, 2017
e1e5870
Slightly better code readability in init command.
weitzman Sep 22, 2017
1f4f856
Minor formatting
weitzman Sep 22, 2017
ca91618
Fix indentation in site-install
weitzman Sep 22, 2017
0a75507
Remove old site-alias code.
greg-1-anderson Sep 22, 2017
d562486
Use commandData->output() in druplicon
greg-1-anderson Sep 22, 2017
6746d0f
Remove no-longer-supported options from sa command.
weitzman Sep 22, 2017
360d93e
Minor runserver cleanup.
weitzman Sep 22, 2017
15643c3
Some better alias handling in site-install. A bit more to do in #2951.
weitzman Sep 22, 2017
77f0be6
Allow for empty generator argument.
weitzman Sep 22, 2017
1b41a6a
Minor improvements to updatedb.
weitzman Sep 22, 2017
7dddedb
indentation et al.
weitzman Sep 22, 2017
58c156d
Update a few _convert_csv_to_array() calls.
weitzman Sep 22, 2017
b647932
Fix 2 typos.
weitzman Sep 23, 2017
1b4b999
Add 'sin' as alias for site-install.
weitzman Sep 23, 2017
b941d3f
Update code docs for global options.
weitzman Sep 23, 2017
6ffe521
Better command description for wd-list.
weitzman Sep 23, 2017
1013bb6
Note that ssh-options is now handled.
weitzman Sep 24, 2017
c61c3b8
Remove --variables support. Not applicable to D8.
weitzman Sep 24, 2017
d3eda67
Add description to status command
weitzman Sep 24, 2017
4b2bec7
Make args required in image-derive
weitzman Sep 24, 2017
3e10ddc
Remap si and en aliases during PreflightArgs
weitzman Sep 24, 2017
c454ffb
Remove drush.api.php. Nothing left to say there
weitzman Sep 24, 2017
33a0b59
Remove mention of version-specific commandfile naming.
weitzman Sep 24, 2017
db76aa4
Edit CONVERAGE file, as if it matters
weitzman Sep 24, 2017
360a230
More realistic advanced usage examples
weitzman Sep 24, 2017
436bb56
Note coverage for generate command
weitzman Sep 24, 2017
a65ce5c
Code comment
weitzman Sep 24, 2017
8806bac
Use brief @bootstrap values
weitzman Sep 24, 2017
7e1b91d
remove bootstrap cruft
weitzman Sep 24, 2017
c3fb815
Use output() instead of drush_print()
weitzman Sep 24, 2017
89c166e
Import class
weitzman Sep 24, 2017
79f3999
Pass the site specification in as the 'name' of the alias record it c…
greg-1-anderson Sep 24, 2017
e1650ab
Straighten out multiple alias loading.
greg-1-anderson Sep 24, 2017
926e7fe
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 24, 2017
55c5d2a
Merge branch 'symfony-dispatch-multiple-alias-fix' into symfony-dispatch
greg-1-anderson Sep 24, 2017
e0b4e0d
revert a bad param.
weitzman Sep 24, 2017
bee7fca
Remove a couple non-working generator alias names.
weitzman Sep 24, 2017
64c11d6
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 24, 2017
70283f1
Use StringUtils::csvToArray() in 2 places.
weitzman Sep 24, 2017
eaf43bb
Remove a couple @complete annotations.
weitzman Sep 24, 2017
74bd928
More StringUtils::csvToArray.
weitzman Sep 24, 2017
4738d47
Add validation for image module enabled and make param required for i…
weitzman Sep 24, 2017
9f3c064
More complete comments for site alias file loader. [ci-skip]
greg-1-anderson Sep 24, 2017
4f31f8d
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 24, 2017
1eab4ad
Evaluate path aliases (e.g. %files) in rsync if the pass alias can be…
greg-1-anderson Sep 24, 2017
650ce41
Fix up some alias tests and a failure.
greg-1-anderson Sep 24, 2017
80ec2fd
Valid argument names in gen dcf
weitzman Sep 25, 2017
8cb1b01
Change @validate-module-enabled to use pre-init hook
weitzman Sep 25, 2017
f06a52b
Import class in front controller.
weitzman Sep 25, 2017
75c6a2e
gen dcf should generate PSR2 compliant code.
weitzman Sep 25, 2017
a8e0bcd
Fix missing close parens
weitzman Sep 25, 2017
35f34aa
‘sut’ should inject HOME env variable as well.
weitzman Sep 25, 2017
22c575a
typo in todo
weitzman Sep 25, 2017
cf6513b
Go back to using Drush custom help.
weitzman Sep 25, 2017
15999e4
Colorize the category titles in ListCommands
weitzman Sep 25, 2017
a93cd7e
Try ignoring PEAR.Functions.ValidDefaultValue. NOTE: Does not change …
greg-1-anderson Sep 25, 2017
4e2c2cd
Call backend invoke from BackendPathEvaluator
greg-1-anderson Sep 25, 2017
93652e8
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 25, 2017
20749fb
Fix #2951. Comment out legacy code and hope for the best.
weitzman Sep 25, 2017
dbe624a
Preserve trailing slash in drush rsync and fix up tests.
greg-1-anderson Sep 25, 2017
2e9bf1a
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 25, 2017
44e8220
We don't need to skip config pull test any longer - it is passing now.
greg-1-anderson Sep 25, 2017
94b4e5d
Fix #2948. Port drush_start_browser() to a trait
weitzman Sep 25, 2017
20fde95
Mark --help tests as skipped.
greg-1-anderson Sep 25, 2017
094e93e
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 25, 2017
ba6cc48
Fix #2906. Remove @complete annotations
weitzman Sep 25, 2017
866e720
Note that --ignored-modules doesn't work at the moment.
weitzman Sep 25, 2017
3ffb2dc
Make drush.php our front controller, and leave the 'drush' script as …
greg-1-anderson Sep 25, 2017
a147507
Pass AliasRecord directly to 'drush_invoke_process'
greg-1-anderson Sep 25, 2017
32492e3
Merge branch 'symfony-dispatch' of github.com:drush-ops/drush into sy…
greg-1-anderson Sep 25, 2017
764f4a2
Fix up code style.
greg-1-anderson Sep 25, 2017
de55232
Remove standalone script test.
greg-1-anderson Sep 25, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sudo: false

env:
matrix:
- TEST_DIR=isolation
- PHPUNIT_ARGS=--group=base
- PHPUNIT_ARGS=--group=commands
- PHPUNIT_ARGS=--exclude-group=base,commands
Expand All @@ -46,14 +47,18 @@ before_install:
- echo 'mbstring.http_output = pass' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

# Build a System-Under-Test.
install: ${PWD}/unish.sut.php
install:
- if [ -n "$TEST_DIR" ] ; then composer --working-dir=${PWD}/$TEST_DIR install ; fi
- if [ -z "$TEST_DIR" ] ; then ${PWD}/unish.sut.php ; fi

before_script:
- phpenv config-rm xdebug.ini
- echo 'sendmail_path = /bin/true' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# - echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`

script: ${PWD}/unish.phpunit.php $PHPUNIT_ARGS
script:
- if [ -n "$TEST_DIR" ] ; then cd $TEST_DIR && phpunit ; fi
- if [ -z "$TEST_DIR" ] ; then ${PWD}/unish.phpunit.php $PHPUNIT_ARGS ; fi

# Background: https://github.com/drush-ops/drush/pull/1426
after_success: ${PWD}/tests/testChildren.sh
after_success: ${PWD}/tests/testChildren.sh
14 changes: 9 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
"psr/log": "~1.0",
"psy/psysh": "~0.6",
"league/container": "~2",
"consolidation/robo": "~1",
"consolidation/config": "dev-master",
"consolidation/robo": "^1.1.2",
"symfony/config": "~2.2|^3",
"chi-teck/drupal-code-generator": "^1.17.3",
"consolidation/annotated-command": "^2.4.13",
"consolidation/annotated-command": "dev-master as 2.7.0",
"consolidation/output-formatters": "^3.1.11",
"grasmash/yaml-expander": "^1.1.1",
"symfony/yaml": "~2.3|^3",
"symfony/var-dumper": "~2.7|^3",
"symfony/console": "~2.7|^3",
Expand All @@ -57,12 +59,14 @@
}
},
"scripts": {
"cs": "phpcs --standard=PSR2 -n src",
"cbf": "phpcbf --standard=PSR2 -n src",
"cs": "phpcs -n src",
"cbf": "phpcbf -n src",
"lint": [
"find includes -name '*.inc' -print0 | xargs -0 -n1 php -l",
"find src -name '*.php' -print0 | xargs -0 -n1 php -l"
]
],
"isolation": "cd isolation && phpunit --colors=always",
"post-update-cmd": "cd isolation && composer update"
},
"extra": {
"branch-alias": {
Expand Down
6 changes: 2 additions & 4 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Global Drush Commands

Commandfiles that don't ship inside Drupal modules are called 'global' commandfiles. See the examples/Commands folder for examples. In general, its better to use modules to carry your Drush commands. If you still prefer using a global commandfiles, please note:

1. The file's namespace should be \Drush.
1. The file's namespace should be \Drush\Commands\[dir-name].
1. The filename must end in Commands.php (e.g. FooCommands.php)
1. The enclosing directory must be named Commands
1. The directory above Commands must be one of:
Expand All @@ -23,9 +23,7 @@ Commandfiles that don't ship inside Drupal modules are called 'global' commandfi
1. The ".drush" folder in the user's HOME folder.
1. ../drush, /drush and /sites/all/drush relative to the current Drupal installation.

Avoiding the loading of certain Commandfiles
Avoiding the loading of certain Commandfiles (Note: not functional right now).
=================

- 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.
- The --ignored-modules global option stops loading of commandfiles from specified modules.

2 changes: 1 addition & 1 deletion docs/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ See [Woot module](https://github.com/drush-ops/drush/blob/master/tests/resources

1. Write a class similar to [ExampleGenerator](https://github.com/drush-ops/drush/tree/master/tests/resources/modules/d8/woot/src/Generators/). Implement your custom logic in the interact() method. Typically this class is placed in the src/Generators directory.
1. Add your class to your module's drush.services.yml file ([example](https://github.com/drush-ops/drush/blob/master/tests/resources/modules/d8/woot/drush.services.yml)). Use the tag `drush.generator` instead of `drush.command`.
1. Perform a `drush cache-rebuild` to compile your drush.services.yml changes into the Drupal container.
1. Perform a `drush cache-rebuild` to compile your drush.services.yml changes into the Drupal container.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ pursuing one of the support options below.

* Post support requests to [Drupal Answers](http://drupal.stackexchange.com/questions/tagged/drush).
* Bug reports and feature requests should be reported in the [GitHub Drush Issue Queue](https://github.com/drush-ops/drush/issues).
* Use pull requests (PRs) to contribute to Drush.
* Use pull requests (PRs) to contribute to Drush.
29 changes: 0 additions & 29 deletions drush.api.php

This file was deleted.

64 changes: 59 additions & 5 deletions drush.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,64 @@
<?php

use Drush\Config\Environment;
use Drush\Preflight\Preflight;
use Webmozart\PathUtil\Path;

/**
* @file
* Drush is a PHP script implementing a command line shell for Drupal.
* This script runs Drush.
*
* Responsibilities of this script:
* - Locate and include the Composer autoload file for Drush.
* - Set up the environment (record user home directory, cwd, etc.).
* - Call the Preflight object to do all necessary setup and execution.
* - Exit with status code returned
*
* It is our goal to put all $_SERVER access and other constructs that are
* difficult to test in this script to reduce the burden on the unit tests.
* This script will only be tested via the functional tests.
*
* @requires PHP CLI 5.6.0, or newer.
* The Drush bootstrap goes through the following steps:
* - (ArgsPreprocessor) Preprocess the commandline arguments, considering only:
* - The named alias `@sitealias` (removed from arguments if present)
* - The --root option (read and retained)
* - The --config option (read and retained)
* - The --alias-path option (read and retained)
* - Load the Drush configuration and alias files from the standard
* global locations (including --config and --alias-path)
* - Determine the local Drupal site targeted, if any
* - Include the Composer autoload for Drupal (if different)
* - Extend configuration and alias files to include files in target Drupal site.
* - Create the Robo DI container and Symfony Application et. al.
* - Run the Symfony Application
* - Predispatch: call a remote Drush command if applicable
* - Bootstrap Drupal via @bootstrap command hook
* - Run commands and command hooks via annotated commands library
* - Catch 'command not found' exception, bootstrap Drupal and run again
* - Return status code
*/

require __DIR__ . '/includes/preflight.inc';
exit(drush_main());
// We use PWD if available because getcwd() resolves symlinks, which
// could take us outside of the Drupal root, making it impossible to find.
$cwd = empty($_SERVER['PWD']) ? getcwd() : $_SERVER['PWD'];

// Set up autoloader
$loader = false;
if (file_exists($autoloadFile = __DIR__ . '/vendor/autoload.php')
|| file_exists($autoloadFile = __DIR__ . '/../autoload.php')
|| file_exists($autoloadFile = __DIR__ . '/../../autoload.php')
) {
$loader = include_once($autoloadFile);
} else {
throw new \Exception("Could not locate autoload.php. cwd is $cwd; __DIR__ is " . __DIR__);
}

// Set up environment
$environment = new Environment(Path::getHomeDirectory(), $cwd, $autoloadFile);
$environment->setLoader($loader);
$environment->applyEnvironment();

// Preflight and run
$preflight = new Preflight($environment);
$status_code = $preflight->run($_SERVER['argv']);

exit($status_code);
3 changes: 3 additions & 0 deletions drush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
drush:
php:
minimum-version: 5.6.0
2 changes: 1 addition & 1 deletion examples/Commands/PolicyCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function rsyncValidate(CommandData $commandData) {
*/
public function validateUpdateDb(CommandData $commandData) {
if (!$commandData->input()->getOption('secret') == 'mysecret') {
throw new \Exception(dt('UpoateDb command requires a secret token per site policy.'));
throw new \Exception(dt('UpdateDb command requires a secret token per site policy.'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/Commands/SandwichCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function makeSandwich($filling, $options = ['spreads' => NULL]) {
$msg = dt('Okay. Enjoy this !filling sandwich!str_spreads.',
array('!filling' => $filling, '!str_spreads' => $str_spreads)
);
drush_print("\n" . $msg . "\n");
$this->output()->writeln("\n" . $msg . "\n");
$this->printFile(__DIR__ . '/sandwich-nocolor.txt');
}

Expand Down
2 changes: 1 addition & 1 deletion examples/Commands/SyncViaHttpCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function downloadFile($url, $user = FALSE, $password = FALSE, $destina
drush_shell_exec("curl -s -L --connect-timeout 30 -o %s %s", $destination_tmp, $url);
}
}
if (!drush_get_context('DRUSH_SIMULATE')) {
if (!\Drush\Drush::simulate()) {
if (!drush_file_not_empty($destination_tmp) && $file = @file_get_contents($url)) {
@file_put_contents($destination_tmp, $file);
}
Expand Down
16 changes: 10 additions & 6 deletions examples/Commands/XkcdCommands.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?php
namespace Drush\Commands;

use Drush\Exec\ExecTrait;

/**
* Run these commands using the --include option - e.g. `drush --include=/path/to/drush/examples xkcd`
*/

class XkcdCommands extends DrushCommands {

use ExecTrait;

/**
* Retrieve and display xkcd cartoons.
*
Expand All @@ -24,25 +28,25 @@ class XkcdCommands extends DrushCommands {
* Retrieve and display a random cartoon in Firefox.
* @aliases @xkcd
*/
public function fetch($search = NULL, $options = ['image-viewer' => 'open', 'google-custom-search-api-key' => NULL]) {
public function fetch($search = NULL, $options = ['image-viewer' => 'open', 'google-custom-search-api-key' => 'AIzaSyDpE01VDNNT73s6CEeJRdSg5jukoG244ek']) {
if (empty($search)) {
drush_start_browser('http://xkcd.com');
$this->startBrowser('http://xkcd.com');
}
elseif (is_numeric($search)) {
drush_start_browser('http://xkcd.com/' . $search);
$this->startBrowser('http://xkcd.com/' . $search);
}
elseif ($search == 'random') {
$xkcd_response = @json_decode(file_get_contents('http://xkcd.com/info.0.json'));
if (!empty($xkcd_response->num)) {
drush_start_browser('http://xkcd.com/' . rand(1, $xkcd_response->num));
$this->startBrowser('http://xkcd.com/' . rand(1, $xkcd_response->num));
}
}
else {
// This uses an API key with a limited number of searches per.
$search_response = @json_decode(file_get_contents('https://www.googleapis.com/customsearch/v1?key=' . drush_get_option('google-custom-search-api-key', 'AIzaSyDpE01VDNNT73s6CEeJRdSg5jukoG244ek') . '&cx=012652707207066138651:zudjtuwe28q&q=' . $search));
$search_response = @json_decode(file_get_contents('https://www.googleapis.com/customsearch/v1?key=' . $options['google-custom-search-api-key'] . '&cx=012652707207066138651:zudjtuwe28q&q=' . $search));
if (!empty($search_response->items)) {
foreach ($search_response->items as $item) {
drush_start_browser($item->link);
$this->startBrowser($item->link);
}
}
else {
Expand Down
41 changes: 9 additions & 32 deletions examples/helloworld.script
Original file line number Diff line number Diff line change
@@ -1,48 +1,25 @@
#!/usr/bin/env drush
<?php

//
// This example demonstrates how to write a drush
// "shebang" script. These scripts start with the
// line "#!/usr/bin/env drush" or "#!/full/path/to/drush".
// script. These scripts are run with the php-script command.
//
drush_print("Hello world!");
drush_print();
drush_print("The arguments to this command were:");
$this->output()->writeln("Hello world!");
$this->output()->writeln("The extra options/arguments to this command were:");
$this->output()->writeln(print_r($extra, true));

//
// If called with --everything, use drush_get_arguments
// to print the commandline arguments. Note that this
// call will include 'php-script' (the drush command)
// and the path to this script.
//
if ($options['everything'])) {
drush_print(" " . implode("\n ", drush_get_arguments()));
}
//
// If --everything is not included, then use
// drush_shift to pull off the arguments one at
// a time. drush_shift only returns the user
// commandline arguments, and does not include
// the drush command or the path to this script.
//
else {
while ($arg = drush_shift()) {
drush_print(' ' . $arg);
}
}

drush_print();

//
// We can check which site was bootstrapped via
// the '@self' alias, which is defined only if
// there is a bootstrapped site.
//
$self_record = drush_sitealias_get_record('@self');
if (empty($self_record)) {
drush_print('No bootstrapped site.');
if (empty($self_record['root'])) {
$this->output()->writeln('No bootstrapped site.');
}
else {
drush_print('The following site is bootstrapped:');
_drush_sitealias_print_record($self_record);
$this->output()->writeln('The following site is bootstrapped:');
$this->output()->writeln(print_r($self_record, true));
}
6 changes: 5 additions & 1 deletion includes/annotationcommand_adapter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,12 @@ function annotationcommand_adapter_process_command() {

$args = annotationcommand_adapter_process_args($userArgs, $command['consolidation-arg-defaults']);

// TODO: Need to determine if $input is interactive, and ensure that $input->isInteractive() returns the correct result.
// Determine if $input is interactive, and ensure that $input->isInteractive() returns the correct result.
$input = new DrushInputAdapter($args, annotationcommand_adapter_get_options($command), $command['command']);
$yes = drush_get_context('DRUSH_AFFIRMATIVE');
$no = drush_get_context('DRUSH_NEGATIVE');
$interactive = (!$yes && !$no);
$input->setInteractive($interactive);
$output = new ConsoleOutput();
$annotationData = $command['annotations'];
$commandData = new CommandData(
Expand Down
Loading