Closed shaal closed 10 months ago
Open the branch in Web Editor • VS Code • Insiders
Open Preview
The changes involve updating the Drupal development environment by modifying the install-essential-packages.sh
script and the DevelopmentProjectCommands.php
file. The script's modifications include the removal of specific version constraints for drush/drush
and drupal/core-dev
, and the addition of the phpspec/prophecy-phpunit
package with a version constraint. The DevelopmentProjectCommands.php
file undergoes changes in imports, class declaration, and method modifications to align with the updated environment. Additionally, the .gitignore
file is updated to ignore the drush/
directory, and the Dockerfile for the Gitpod base image and the Minio client version are also updated.
File Path | Change Summary |
---|---|
.gitpod/drupal/install-essential-packages.sh |
Removed version constraint for drush/drush and drupal/core-dev , added phpspec/prophecy-phpunit with version constraint ^2 . |
drush/Commands/core_development/DevelopmentProjectCommands.php |
- Imports and Namespaces: Added ClassLoader , used DrushCommands class, replaced ContainerInterface with DrushContainer . - Class Declaration: Extended DrushCommands , added constructor and static method. - Method Modifications: Updated rebuild method to use the ClassLoader instance. |
.gitignore |
Added drush/ directory to the list of ignored paths. |
.gitpod/images/Dockerfile |
Updated the Minio client version being installed. |
.gitpod.yml |
Updated the Gitpod base image version. |
.gitpod/drupal/drupalpod-setup/drupal_setup_core.sh |
Added logic to determine the major version of drush/drush and copied the corresponding DevelopmentProjectCommands.php file to a drush commands directory. |
Objective | Addressed | Explanation |
---|---|---|
Change ^11 for Drush requirement to >11 (#138) | ❌ | The version constraint for drush/drush was removed entirely rather than changed to >11 . |
In the code where the rabbits hop, 🐇💻
A script was changed at the gitpod shop.
Drush now free, from constraints it hops,
A new package joins, with a version that tops. 🎉
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?
Unfortunately did not work for me with 10.2.x.
It did
- Installing drush/drush (12.4.3): Extracting archive
but then
Configuration complete. You may now run 'ddev start'.
PHP Fatal error: Class Drush\Commands\core_development\DevelopmentProjectCommands cannot extend final class Drush\Commands\core\CacheCommands in /var/www/html/drush/Commands/core_development/DevelopmentProjectCommands.php on line 0
Fatal error: Class Drush\Commands\core_development\DevelopmentProjectCommands cannot extend final class Drush\Commands\core\CacheCommands in /var/www/html/drush/Commands/core_development/DevelopmentProjectCommands.php on line 0
[warning] Drush command terminated abnormally.
Failed to run drush si -y --account-pass=admin --site-name=DrupalPod standard: exit status 1
With Drupal 10.1.x-dev, URL I tested was https://gitpod.io/new/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=drupal-3347291,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=11.x,DP_CORE_VERSION=10.1.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE=standard/https://github.com/shaal/DrupalPod/pull/139
Same result if I remove the fork argument also. Which IMHO is just a plain 10.1.x-dev instance then. So https://github.com/shaal/DrupalPod/blob/main/drush/Commands/core_development/DevelopmentProjectCommands.php needs updating in this PR as well. Question is how to keep it compatible with older Drush but also make it Drush 12 compatibe.
Worked with Drupal 10.1.x URL: https://gitpod.io/new/#DP_PROJECT_NAME=drupal,DP_ISSUE_FORK=,DP_ISSUE_BRANCH=,DP_PROJECT_TYPE=project_core,DP_MODULE_VERSION=,DP_CORE_VERSION=10.1.x,DP_PATCH_FILE=,DP_INSTALL_PROFILE=standard/https://github.com/shaal/DrupalPod/pull/139
Did not work with Drupal 9.5.x (it picked drush 11.6), although I am not sure that is still supposed to work?
Notice: running 'php vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer' in ddev
Using config file: /var/www/html/vendor/squizlabs/php_codesniffer/CodeSniffer.conf
Config value "installed_paths" updated successfully; old value was "../../drupal/coder/coder_sniffer,../../sirbrillig/phpcs-variable-analysis,../../slevomat/coding-standard"
You are reconfiguring the project at /workspace/DrupalPod.
The existing configuration will be updated and replaced.
A project of type 'drupal9' was found in /workspace/DrupalPod/web, but the project is configured with type 'drupal10'
No settings.php file exists, creating one
Configuration complete. You may now run 'ddev start'.
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Drush\Commands\core_development\DevelopmentProjectCommands::__construct(), 0 passed and exactly 1 expected in /var/www/html/drush/Commands/core_development/DevelopmentProjectCommands.php:25
Stack trace:
#0 [internal function]: Drush\Commands\core_development\DevelopmentProjectCommands->__construct()
#1 /var/www/html/vendor/league/container/src/Definition/Definition.php(212): ReflectionClass->newInstanceArgs(Array)
#2 /var/www/html/vendor/league/container/src/Definition/Definition.php(175): League\Container\Definition\Definition->resolveClass('Drush\\Commands\\...')
#3 /var/www/html/vendor/league/container/src/Definition/Definition.php(154): League\Container\Definition\Definition->resolveNew()
#4 /var/www/html/vendor/league/container/src/Definition/DefinitionAggregate.php(79): League\Container\Definition\Definition->resolve()
#5 /var/www/html/vendor/league/container/src/Container.php(161): League\Container\Definition\DefinitionAggregate->resolve('Drush\\Commands\\...')
#6 /var/www/html/vendor/league/container/src/Container.php(111): League\Container\Container->resolve('Drush\\Commands\\...')
#7 /var/www/html/vendor/consolidation/robo/src/Runner.php(384): League\Container\Container->get('Drush\\Commands\\...')
#8 /var/www/html/vendor/consolidation/robo/src/Runner.php(346): Robo\Runner->instantiateCommandClass('Drush\\Commands\\...')
#9 /var/www/html/vendor/consolidation/robo/src/Runner.php(319): Robo\Runner->registerCommandClass(Object(Drush\Application), 'Drush\\Commands\\...')
#10 /var/www/html/vendor/drush/drush/src/Application.php(353): Robo\Runner->registerCommandClasses(Object(Drush\Application), Array)
#11 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(119): Drush\Application->configureAndRegisterCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Object(Composer\Autoload\ClassLoader))
#12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run(Array)
#14 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#15 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
#16 {main}
thrown in /var/www/html/drush/Commands/core_development/DevelopmentProjectCommands.php on line 25
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Drush\Commands\core_development\DevelopmentProjectCommands::__construct(), 0 passed and exactly 1 expected in /var/www/html/drush/Commands/core_development/DevelopmentProjectCommands.php:25
Stack trace:
#0 [internal function]: Drush\Commands\core_development\DevelopmentProjectCommands->__construct()
#1 /var/www/html/vendor/league/container/src/Definition/Definition.php(212): ReflectionClass->newInstanceArgs(Array)
#2 /var/www/html/vendor/league/container/src/Definition/Definition.php(175): League\Container\Definition\Definition->resolveClass('Drush\\Commands\\...')
#3 /var/www/html/vendor/league/container/src/Definition/Definition.php(154): League\Container\Definition\Definition->resolveNew()
#4 /var/www/html/vendor/league/container/src/Definition/DefinitionAggregate.php(79): League\Container\Definition\Definition->resolve()
#5 /var/www/html/vendor/league/container/src/Container.php(161): League\Container\Definition\DefinitionAggregate->resolve('Drush\\Commands\\...')
#6 /var/www/html/vendor/league/container/src/Container.php(111): League\Container\Container->resolve('Drush\\Commands\\...')
#7 /var/www/html/vendor/consolidation/robo/src/Runner.php(384): League\Container\Container->get('Drush\\Commands\\...')
#8 /var/www/html/vendor/consolidation/robo/src/Runner.php(346): Robo\Runner->instantiateCommandClass('Drush\\Commands\\...')
#9 /var/www/html/vendor/consolidation/robo/src/Runner.php(319): Robo\Runner->registerCommandClass(Object(Drush\Application), 'Drush\\Commands\\...')
#10 /var/www/html/vendor/drush/drush/src/Application.php(353): Robo\Runner->registerCommandClasses(Object(Drush\Application), Array)
#11 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(119): Drush\Application->configureAndRegisterCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Object(Composer\Autoload\ClassLoader))
#12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run(Array)
#14 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#15 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
#16 {main}
thrown in /var/www/html/drush/Commands/core_development/DevelopmentProjectCommands.php on line 25
[warning] Drush command terminated abnormally.
Failed to run drush si -y --account-pass=admin --site-name=DrupalPod standard: exit status 1
If drupalpod does not work with Drupal 9 anymore (which would be logical), is there a way to bail early with some user friendly message? :)
BTW it also worked fine on Drupal 10.2.x (like it did on 10.1.x). So the one of the 3 versions I tried 9.5.x did not work due to different drush version.
fixes #138
Summary by CodeRabbit
DevelopmentProjectCommands.php
file to extendDrushCommands
, introducing new methods and constructor.install-essential-packages.sh
file to remove version constraints for certain packages and add a new package with version constraint.ClassLoader
and modified namespaces in theDevelopmentProjectCommands.php
file.drush/
directory in the.gitignore
file.