Add support for the new Drush 9 command format.

Comments

badjava created an issue. See original summary.

badjava’s picture

Here is the patch.

badjava’s picture

Assigned: badjava » Unassigned
Status: Active » Needs review
jribeiro’s picture

Status: Needs review » Reviewed & tested by the community

+1 RTBC

gbyte’s picture

Thanks @badjava.

Why is the command simple-sitemap:generate instead of simple_sitemap:generate? That seems confusing to me. Is there a best practice on drush 9 commands?

I'd also move Drupal\simple_sitemap\Commands\SimpleSitemapCommands.php to Drupal\simple_sitemap\Drush\Commands.php.

Thoughts?

gbyte’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)
badjava’s picture

To provide some background, this patch was created as part of the code sprint in Vienna with @greg.1.anderson and the standards set out by him for porting drush commands to drush 9. Drush 9 commands now use the Symfony standard of module-name:command-name and the standard is also to put drush commands in the src/Commands folder. These are the new drush 9 standards.

  • gbyte.co committed c5d9beb on 8.x-2.x authored by badjava
    Issue #2912684 by badjava: Add Drush 9 command support
    
gbyte’s picture

Title: Add Drush 9 command support » Add D rush 9 command support
Status: Postponed (maintainer needs more info) » Fixed

Thanks, your explanation is sound. I wasn't able to find these drush 9 standards outlined anywhere, hence my question.

gbyte’s picture

Title: Add D rush 9 command support » Add Drush 9 command support
matt_paz’s picture

I haven't looked deeply into this yet (and haven't pursued the patch above), but thought this might be related.
When executing simple commands like CR w/ Drush V8.1.15, I'm getting ...

PHP Fatal error:  Class 'Drush\Commands\DrushCommands' not found in /var/www/drupalvm/web/modules/contrib/simple_sitemap/src/Commands/SimpleSitemapCommands.php on line 12

Fatal error: Class 'Drush\Commands\DrushCommands' not found in /var/www/drupalvm/web/modules/contrib/simple_sitemap/src/Commands/SimpleSitemapCommands.php on line 12
Drush command terminated abnormally due to an unrecoverable error.                                                                                                            [error]
Error: Class 'Drush\Commands\DrushCommands' not found in /var/www/drupalvm/web/modules/contrib/simple_sitemap/src/Commands/SimpleSitemapCommands.php, line 12
gbyte’s picture

Status: Fixed » Active
badrange’s picture

I just upgraded to 8.x-2.x to be able to try out the patch in #2875286 and I see the same error as matt_paz, with both Drush 8.1.10 and 8.1.15.

gbyte’s picture

Sounds like an upstream problem: https://github.com/drush-ops/drush/issues/3041

@badjava Aren't the commands supposed to go into drush.services.yml instead of simple_sitemap.services.yml as one of the posts from the issue above suggests?

gbyte’s picture

Status: Active » Fixed

According to this it is supposed to be drush.services.yml. This is now committed and tested with drush 9.0-dev-g2f52b20.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.