shaal / DrupalPod

Start Drupal contributions with 1 click.
https://shaal.github.io/DrupalPod
MIT License
163 stars 54 forks source link

Update install-essential-packages.sh #139

Closed shaal closed 10 months ago

shaal commented 10 months ago

fixes #138

Summary by CodeRabbit

codesandbox[bot] commented 10 months ago

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

coderabbitai[bot] commented 10 months ago

Walkthrough

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.

Changes

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.

Assessment against linked issues

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.

Poem

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 ?


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - You can reply to a review comment made by CodeRabbit. - You can tag CodeRabbit on specific lines of code or files in the PR by tagging `@coderabbitai` in a comment. - You can tag `@coderabbitai` in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`
ghost commented 10 months ago
👇 Click on the image for a new way to code review #### [![Review these changes using an interactive CodeSee Map](https://s3.us-east-2.amazonaws.com/maps.codesee.io/images/github/shaal/DrupalPod/139/958837a6/67117786e36cbdb8100588afedbe8f4eb18b6a34.svg)](https://app.codesee.io/r/reviews?pr=139&src=https%3A%2F%2Fgithub.com%2Fshaal%2FDrupalPod) #### Legend CodeSee Map legend
goba commented 10 months ago

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

goba commented 10 months ago

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.

goba commented 10 months ago

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
goba commented 10 months ago

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? :)

goba commented 10 months ago

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.