Skip to content

Commit cdd239a

Browse files
authored
Merge branch 'master' into master
2 parents 01757cb + caeedc1 commit cdd239a

File tree

134 files changed

+3288
-1191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+3288
-1191
lines changed

.circleci/config.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
2+
defaults: &defaults
3+
working_directory: ~/drush
4+
environment:
5+
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
6+
TERM: dumb
7+
UNISH_NO_TIMEOUTS: y
8+
UNISH_DB_URL: mysql://root:@127.0.0.1
9+
UNISH_TMP: /tmp
10+
PHPUNIT_ARGS: ""
11+
12+
version: 2
13+
jobs:
14+
build:
15+
<<: *defaults
16+
docker:
17+
- image: circleci/php:7.1-apache-node
18+
environment:
19+
- MYSQL_HOST=127.0.0.1
20+
- image: circleci/mysql:5.7.18
21+
steps:
22+
- checkout
23+
- run: $HOME/drush/.circleci/setup.sh
24+
- run: unish.sut.php
25+
- run: unish.phpunit.php $PHPUNIT_ARGS
26+
27+
build_highest:
28+
<<: *defaults
29+
docker:
30+
- image: circleci/php:7.1-apache-node
31+
environment:
32+
- MYSQL_HOST=127.0.0.1
33+
- COMPOSER=composer-highest.json
34+
- image: circleci/mysql:5.7.18
35+
steps:
36+
- checkout
37+
- run: $HOME/drush/.circleci/setup.sh
38+
- run: unish.sut.php
39+
- run: unish.phpunit.php $PHPUNIT_ARGS
40+
41+
build_56:
42+
<<: *defaults
43+
docker:
44+
- image: circleci/php:5.6-apache-node
45+
environment:
46+
- MYSQL_HOST=127.0.0.1
47+
- image: circleci/mysql:5.7.18
48+
steps:
49+
- checkout
50+
- run: $HOME/drush/.circleci/setup.sh
51+
- run: unish.sut.php
52+
- run: unish.phpunit.php $PHPUNIT_ARGS
53+
54+
workflows:
55+
version: 2
56+
build_test:
57+
jobs:
58+
- build
59+
- build_highest
60+
- build_56
61+

.circleci/setup.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Install PHP extensions
4+
sudo docker-php-ext-install pdo_mysql
5+
6+
# Install extension
7+
sudo apt-get install -y libpng-dev
8+
9+
# Install PHP Extensions
10+
sudo docker-php-ext-install gd
11+
12+
# Install Composer
13+
'curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer'
14+
15+
# Display versions
16+
php -v
17+
composer --version
18+
19+
# Install mysql-client
20+
sudo apt-get install mysql-client
21+
22+
# Configure bash environment variables
23+
echo 'export PATH=~/.composer/vendor/bin:~/drush:$PATH' >> $BASH_ENV
24+
echo 'export HOME=/tmp/drush-sandbox/home' >> $BASH_ENV
25+
mkdir -p /tmp/drush-sandbox/home
26+
27+
# Configure php.ini
28+
echo 'mbstring.http_input = pass' > $HOME/php.ini
29+
echo 'mbstring.http_output = pass' >> $HOME/php.ini
30+
echo 'memory_limit = -1' >> $HOME/php.ini
31+
echo 'sendmail_path = /bin/true' >> $HOME/php.ini
32+
echo 'date.timezone = "UTC"' >> $HOME/php.ini
33+
echo 'opcache.enable_cli = 0' >> $HOME/php.ini
34+
35+
# Copy our php.ini configuration to the active php.ini file
36+
# We can't use `php -r 'print php_ini_loaded_file();` when there is no php.ini
37+
PHPINI_PATH="$(php -i | grep 'Configuration File (php.ini) Path' | sed -e 's#.*=> *##')/php.ini"
38+
cat $HOME/php.ini | sudo tee "$PHPINI_PATH" > /dev/null

.travis.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ php:
1212
# See master-fulltest branch for broader PHP version testing.
1313
- 5.6
1414
- 7.0
15+
- 7.2
1516

1617
# Cache Composer.
1718
cache:
@@ -26,23 +27,14 @@ env:
2627
- TEST_DIR=isolation ISOLATION_INSTALL='install --prefer-dist'
2728
- TEST_DIR=isolation ISOLATION_INSTALL='update --prefer-dist --prefer-lowest'
2829
- TEST_DIR=isolation ISOLATION_INSTALL='update --prefer-dist'
29-
- PHPUNIT_ARGS=--group=base
30-
- PHPUNIT_ARGS=--group=commands
31-
- PHPUNIT_ARGS=--exclude-group=base,commands
32-
- COMPOSER=composer-highest.json PHPUNIT_ARGS=--group=base
33-
- COMPOSER=composer-highest.json PHPUNIT_ARGS=--group=commands
34-
- COMPOSER=composer-highest.json PHPUNIT_ARGS=--exclude-group=base,commands
3530
global:
36-
# Github deploy
31+
# GitHub deploy
3732
- secure: VfYokT2CchfuBRJp9/gSwfVGPfsVfkZdDVEuNWEqxww3z4vq+5aLKqoCtPL54E5EIMjhyCE3GVo+biG35Gab1KOVgUs8zD1hAUWA1FPKfMFhoPDfI3ZJC2rX2T1iWK4ZR90pBtcPzS+2OObzTYz8go0PfeSTT6eq69Na1KcNLaE=
3833
- UNISH_NO_TIMEOUTS=y
3934
- UNISH_DB_URL=mysql://root:@127.0.0.1
4035
- UNISH_TMP=/tmp
4136

42-
matrix:
43-
allow_failures:
44-
- php: 7.0
45-
env: COMPOSER=composer-highest.json
37+
4638

4739
before_install:
4840
- echo 'mbstring.http_input = pass' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
@@ -51,22 +43,20 @@ before_install:
5143

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

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

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

6656
after_success:
6757
# Publish updated API documentation on every push to the master branch
6858
- git config --global user.email $GITHUB_USER_EMAIL
6959
- git config --global user.name "Drush Documentation Bot"
70-
- build/scripts/publish-api-docs.sh
60+
- cd $TRAVIS_BUILD_DIR && build/scripts/publish-api-docs.sh
7161
# Background: https://github.com/drush-ops/drush/pull/1426
7262
#- ${PWD}/tests/testChildren.sh

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Drush is built by people like you! Please [join us](https://github.com/drush-ops/drush).
22

33
## Git and Pull requests
4-
* Contributions are submitted, reviewed, and accepted using Github pull requests. [Read this article](https://help.github.com/articles/using-pull-requests) for some details. We use the _Fork and Pull_ model, as described there.
4+
* Contributions are submitted, reviewed, and accepted using GitHub pull requests. [Read this article](https://help.github.com/articles/using-pull-requests) for some details. We use the _Fork and Pull_ model, as described there.
55
* The latest changes are in the `master` branch. PR's should initially target this branch.
66
* Try to make clean commits that are easily readable (including descriptive commit messages!)
77
* Test before you push. Get familiar with Unish, our test suite. See the test-specific [README.md](tests/README.md)

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@ Drush is a command line shell and Unix scripting interface for Drupal. Drush cor
22

33
[![Latest Stable Version](https://poser.pugx.org/drush/drush/v/stable.png)](https://packagist.org/packages/drush/drush) [![Total Downloads](https://poser.pugx.org/drush/drush/downloads.png)](https://packagist.org/packages/drush/drush) [![Latest Unstable Version](https://poser.pugx.org/drush/drush/v/unstable.png)](https://packagist.org/packages/drush/drush) [![License](https://poser.pugx.org/drush/drush/license.png)](https://packagist.org/packages/drush/drush) [![Documentation Status](https://readthedocs.org/projects/drush/badge/?version=master)](https://readthedocs.org/projects/drush/?badge=master)
44

5+
| Code style | Isolation Tests | Functional Tests |
6+
| :--------: | :-------------: | :--------------: |
7+
| <img src="https://api.shippable.com/projects/5507addd5ab6cc1352a213b5/badge?branch=master"> | <img src="https://travis-ci.org/drush-ops/drush.svg?branch=master"> | <img src="https://circleci.com/gh/drush-ops/drush.svg?style=shield"> |
8+
59
Resources
610
-----------
7-
* [Installing (and Upgrading)](http://docs.drush.org/en/master/install/) [(Drush8)](http://docs.drush.org/en/8.x/install/)
8-
* [General Documentation](http://docs.drush.org) [(Drush8)](http://docs.drush.org/en/8.x)
9-
* [API Documentation](http://www.drush.org/api/master/index.html) [(Drush8)](http://api.drush.org)
11+
* [Installing (and Upgrading)](http://docs.drush.org/en/master/install/)
12+
* [General Documentation](http://docs.drush.org)
13+
* [API Documentation](http://www.drush.org/api/master/index.html)
1014
* [Drush Commands](http://drushcommands.com)
1115
* 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/).
1216
* [Drush packages available via Composer](https://packagist.org/search/?type=drupal-drush)
1317
* [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)
14-
* 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).
18+
* 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).
1519

1620
Support
1721
-----------
@@ -35,7 +39,7 @@ FAQ
3539
> rhymes with hush, rush, flush, etc. This is the preferred pronunciation.
3640
>
3741
> Q: Does Drush have unit tests?<br>
38-
> A: Drush has an excellent suite of unit tests. See
42+
> A: Drush has an excellent suite of unit tests. See
3943
> [tests/README.md](https://github.com/drush-ops/drush/blob/master/tests/README.md) for more information.
4044
4145

build/scripts/publish-api-docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ BRANCH_REGEX='^\(master\|9\.[0-9x.]*\)$'
77
test -n "$TRAVIS" || { echo "This script is only designed to be run on Travis."; exit 0; }
88
echo "$TRAVIS_BRANCH" | grep -q $BRANCH_REGEX || { echo "Skipping docs update for branch $TRAVIS_BRANCH - docs only updated for master branch and tagged builds."; exit 0; }
99
test "$TRAVIS_PULL_REQUEST" == "false" || { echo "Skipping docs update -- not done on pull requests. (PR #$TRAVIS_PULL_REQUEST)"; exit 0; }
10-
test "${TRAVIS_PHP_VERSION:0:1}" == "7" || { echo "Skipping docs update for PHP $TRAVIS_PHP_VERSION -- only update for PHP 5.6 build."; exit 0; }
10+
test "${TRAVIS_PHP_VERSION:0:1}" == "7" || { echo "Skipping docs update for PHP $TRAVIS_PHP_VERSION -- only update for PHP 7 builds."; exit 0; }
1111
test "$TRAVIS_REPO_SLUG" == "drush-ops/drush" || { echo "Skipping docs update for repository $TRAVIS_REPO_SLUG -- do not build docs for forks."; exit 0; }
1212

1313
# Check our requirements for running this script have been met.

circle.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "drush/drush",
33
"description": "Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.",
44
"homepage": "http://www.drush.org",
5-
"license": "GPL-2.0+",
5+
"license": "GPL-2.0-or-later",
66
"minimum-stability": "dev",
77
"prefer-stable": true,
88
"authors": [
@@ -26,7 +26,7 @@
2626
"require": {
2727
"php": ">=5.6.0",
2828
"ext-dom": "*",
29-
"chi-teck/drupal-code-generator": "^1.21.0",
29+
"chi-teck/drupal-code-generator": "^1.24.0",
3030
"composer/semver": "^1.4",
3131
"consolidation/annotated-command": "^2.8.1",
3232
"consolidation/config": "^1.0.9",
@@ -68,8 +68,8 @@
6868
}
6969
},
7070
"scripts": {
71-
"cs": "phpcs -n --standard=PSR2 src tests",
72-
"cbf": "phpcbf -n --standard=PSR2 src tests",
71+
"cs": "phpcs -n --standard=PSR2 src tests examples",
72+
"cbf": "phpcbf -n --standard=PSR2 src tests examples",
7373
"lint": [
7474
"find includes -name '*.inc' -print0 | xargs -0 -n1 php -l",
7575
"find src -name '*.php' -print0 | xargs -0 -n1 php -l",
@@ -82,7 +82,7 @@
8282
},
8383
"extra": {
8484
"branch-alias": {
85-
"dev-master": "9.0.x-dev"
85+
"dev-master": "9.x-dev"
8686
}
8787
}
8888
}

docs/bootstrap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ When preparing to run a command, Drush works by "bootstrapping" the Drupal envir
44

55
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.
66

7-
Commands may specify their bootstrap level with a `@bootstrap` annotation. Commands supplied by Drupal modules are `@bootstrap max`.
7+
Commands may specify their bootstrap level with a `@bootstrap` annotation. Commands supplied by Drupal modules are always `@bootstrap full`.
88

99
@bootstrap none
1010
-----------------------

docs/commands.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Creating a new Drush command or porting a legacy command is easy. Follow the ste
88
1. (optional) Drush will also prompt for the path to a legacy command file to port. See [tips on porting command to Drush 9](https://weitzman.github.io/blog/port-to-drush9)
99
1. The module selected must already exist and be enabled. Use `drush generate module-standard` to create a new module.
1010
1. Drush will then report that it created a commandfile, a drush.services.yml file and a composer.json file. Edit those files as needed.
11-
1. Use the classes for the core Drush commands at /src/Drupal/Commands as inspiration and documentation.
11+
1. Use the classes for the core Drush commands at [/src/Drupal/Commands](https://github.com/drush-ops/drush/tree/master/src/Drupal/Commands) as inspiration and documentation.
1212
1. See the [dependency injection docs](dependency-injection.md) for interfaces you can implement to gain access to Drush config, Drupal site aliases, etc.
1313
1. Once your two files are ready, run `drush cr` to get your command recognized by the Drupal container.
1414

@@ -42,15 +42,36 @@ It is also possible to use [version ranges](https://getcomposer.org/doc/articles
4242

4343
In Drush 9, the default services file, `drush.services.yml`, will be used in instances where there is no `services` section in the Drush extras of the project's composer.json file. In Drush 10, however, the services section must exist, and must name the services file to be used. If a future Drush extension is written such that it only works with Drush 10 and later, then its entry would read `"drush.services.yml": "^10"`, and Drush 9 would not load the extension's commands. It is all the same recommended that Drush 9 extensions explicitly declare their services file with an appropriate version constraint.
4444

45+
Altering Drush Command Info
46+
===========================
47+
48+
Drush command info (annotations) can be altered from other modules. This is done by creating and registering 'command info alterers'. Alterers are class services that are able to intercept and manipulate an existing command annotation.
49+
50+
In order to alter an existing command info, follow the next steps:
51+
52+
1. In the module that wants to alter a command info, add a service class that implements the `\Consolidation\AnnotatedCommand\CommandInfoAltererInterface`.
53+
1. In the module `drush.services.yml` declare a service pointing to this class and tag the service with the `drush.command_info_alterer` tag.
54+
1. In the class implement the alteration logic the `alterCommandInfo()` method.
55+
1. Along with the alter code, it's strongly recommended to log a debug message explaining what exactly was altered. This would allow the easy debugging. Also it's a good practice to inject the the logger in the class constructor.
56+
57+
For an example, see the alterer class provided by the testing 'woot' module: `tests/resources/modules/d8/woot/src/WootCommandInfoAlterer.php`.
58+
4559
Global Drush Commands
4660
==============================
4761

48-
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:
62+
Commandfiles that don't ship inside Drupal modules are called 'global' commandfiles. See the [examples/Commands](/examples/Commands) folder for examples. In general, it's better to use modules to carry your Drush commands. If you still prefer using a global commandfiles, here are two examples of valid commandfile names and namespaces:
63+
64+
1. Simple
65+
- Filename: $PROJECT_ROOT/drush/Commands/ExampleCommands.php
66+
- Namespace: Drush\Commands
67+
1. Nested (e.g. Commandfile is part of a Composer package)
68+
- Filename: $PROJECT_ROOT/drush/Commands/dev_modules/ExampleCommands.php
69+
- Namespace: Drush\Commands\dev_modules
4970

50-
1. The file's namespace should be `\Drush\Commands`.
51-
1. The filename must be have a name like Commands/FooCommands.php
52-
1. The prefix `Foo` can be whatever string you want. The file must end in `Commands.php`
53-
1. The enclosing directory must be named `Commands`
71+
##### Tips
72+
1. The filename must be have a name like Commands/ExampleCommands.php
73+
1. The prefix `Example` can be whatever string you want.
74+
1. The file must end in `Commands.php`
5475
1. The directory above Commands must be one of:
5576
1. A Folder listed in the 'include' option. include may be provided via config or via CLI.
5677
1. ../drush, /drush or /sites/all/drush. These paths are relative to Drupal root.

0 commit comments

Comments
 (0)