diff --git a/README.md b/README.md index c6402c6..1a054c5 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,49 @@ drush @ralph.local st --fields=site Here, `@@site` is replaced with site names detected from various site alias definitions. +## Site groups + +Drall allows you to group your sites so that you can run commands on such +groups with ease. + +``` +drall exec --drall-group=GROUP core:rebuild +``` + +Here's how you can create site groups. + +### With site aliases + +In a site alias definition file, you can assign site aliases to one or more +groups like this: + +```yaml +# File: tnmt.site.yml +local: + root: /opt/drupal/web + uri: http://tmnt.com/ + # ... + drall: + groups: + - cartoon + - action +``` + +This puts the alias `@tnmt.local` in the `cartoon` and `action` groups. + +### With sites.php + +If your project doesn't use site aliases, you can still group your sites using +one or more `sites.GROUP.php` files like this: + +```php +# File: sites.bluish.php +$sites['donnie.drall.local'] = 'donnie'; +$sites['leo.drall.local'] = 'leo'; +``` + +This puts the sites `donnie` and `leo` in a group named `bluish`. + ## Development Here's how you can set up a local dev environment. diff --git a/src/Commands/ExecCommand.php b/src/Commands/ExecCommand.php index acbaa50..23dbc41 100644 --- a/src/Commands/ExecCommand.php +++ b/src/Commands/ExecCommand.php @@ -31,6 +31,10 @@ protected function configure() { ); $this->addUsage('core:status'); + $this->addUsage('--uri=@@uri core:status'); + $this->addUsage('@@site.ENV core:status'); + $this->addUsage('--drall-group=GROUP core:status'); + $this->ignoreValidationErrors(); } diff --git a/src/Commands/SiteAliasesCommand.php b/src/Commands/SiteAliasesCommand.php index de8b47e..f9f8760 100644 --- a/src/Commands/SiteAliasesCommand.php +++ b/src/Commands/SiteAliasesCommand.php @@ -15,12 +15,16 @@ protected function configure() { $this->setName('site:aliases'); $this->setAliases(['sa']); $this->setDescription('Get a list of site aliases.'); + $this->addOption( 'drall-group', NULL, InputOption::VALUE_REQUIRED, 'Site group identifier.' ); + + $this->addUsage('site:aliases'); + $this->addUsage('--drall-group=GROUP site:aliases'); } protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/src/Commands/SiteDirectoriesCommand.php b/src/Commands/SiteDirectoriesCommand.php index ce20bae..905a3df 100644 --- a/src/Commands/SiteDirectoriesCommand.php +++ b/src/Commands/SiteDirectoriesCommand.php @@ -15,12 +15,16 @@ protected function configure() { $this->setName('site:directories'); $this->setAliases(['sd']); $this->setDescription('Get a list of site directories.'); + $this->addOption( 'drall-group', NULL, InputOption::VALUE_REQUIRED, 'Site group identifier.' ); + + $this->addUsage('site:directories'); + $this->addUsage('--drall-group=GROUP site:directories'); } protected function execute(InputInterface $input, OutputInterface $output) {