-
-
Notifications
You must be signed in to change notification settings - Fork 29
[#1882] Added support for DrupalCMS. #1955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,7 +31,7 @@ web/sites/default/* | |||||||||||
| # Preserve default settings files to use them in Functional test. | ||||||||||||
| !web/sites/default/default.settings.php | ||||||||||||
| !web/sites/default/default.services.yml | ||||||||||||
| # Whitelist Drupal Scaffold files. @see https://github.com/drupal-composer/drupal-scaffold#limitation | ||||||||||||
| # Allow Drupal Scaffold files. @see https://github.com/drupal-composer/drupal-scaffold#limitation | ||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||
| !web/.editorconfig | ||||||||||||
| !web/.eslintignore | ||||||||||||
| !web/.gitattributes | ||||||||||||
|
|
@@ -41,6 +41,9 @@ web/sites/default/* | |||||||||||
| !web/robots.txt | ||||||||||||
| !web/update.php | ||||||||||||
|
|
||||||||||||
| # Ignore all recipes by default. Custom recipes should be added explicitly. | ||||||||||||
| recipes/* | ||||||||||||
|
|
||||||||||||
|
Comment on lines
+44
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Ignoring recipes by default is sensible; consider an opt-in keep file. If you want the directory present but empty in new repos, add an exception and commit a placeholder. # Ignore all recipes by default. Custom recipes should be added explicitly.
recipes/*
+!recipes/.gitkeep📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| #;< VORTEX_DEV | ||||||||||||
| #; Ignore these files in Vortex itself, but do not ignore in consumer site. | ||||||||||||
| /composer.lock | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,7 +134,7 @@ public function resolvedValue(array $responses): null|string|bool|array { | |
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function resolvedMessage(array $responses): ?string { | ||
| public function resolvedMessage(array $responses, mixed $resolved): ?string { | ||
| return NULL; | ||
| } | ||
|
Comment on lines
+137
to
139
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusivePublic API change to resolvedMessage — ensure all overrides and call sites updated Signature expansion is fine; confirm no handlers still implement the old single-arg method and no call sites pass one argument. Add/upd phpdoc here and in overrides to document $resolved purpose and types for IDEs/static analysis. 🏁 Script executed: #!/bin/bash
# Find handlers overriding old signature (no second param).
rg -nP --type=php 'function\s+resolvedMessage\s*\(\s*array\s+\$responses\s*(?!,)\s*\)' .vortex/installer/src/Prompts/Handlers
# Find call sites still passing a single argument.
rg -nP --type=php '->resolvedMessage\s*\(\s*[^,)]*\)' .vortex/installer/srcLength of output: 610 🏁 Script executed: #!/bin/bash
# re-run override search
rg -nP --type=php -n 'function\s+resolvedMessage\s*\(\s*array\s+\$responses\s*(?!,)' .vortex/installer/src/Prompts/Handlers
# find call sites still passing a single argument
rg -nP --type=php -n '\b->resolvedMessage\s*\(\s*[^,)]*\)' .vortex/installer/srcLength of output: 208 Legacy single-arg resolvedMessage usage removed—all overrides and call sites now include both parameters. Optional: add or update phpdoc on resolvedMessage (and its overrides) to document the 🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,11 +146,13 @@ public function resolvedValue(array $responses): null|string|bool|array; | |
| * | ||
| * @param array $responses | ||
| * Current form responses for context-aware message generation. | ||
| * @param mixed $resolved | ||
| * The resolved value from resolvedValue(). | ||
| * | ||
| * @return string|null | ||
| * The message to display, or null if no message needed. | ||
| */ | ||
| public function resolvedMessage(array $responses): ?string; | ||
| public function resolvedMessage(array $responses, mixed $resolved): ?string; | ||
|
|
||
|
Comment on lines
+149
to
156
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainInterface signature change is a BC break; ensure all implementers and call sites are updated; fix doc typos.
Search for outdated signatures and call sites: Docblock tweak (outside the changed lines): /**
* Get a message to display when showing the resolved value.
*
* This is used by PromptManager to show an appropriate message (via
* info(), ok(), etc.) when using a resolved value instead of prompting
* for input.
*/🏁 Script executed: #!/bin/bash
# Implementations missing $resolved in signature
rg -nP --type=php '(?s)class\s+\w+\s+implements\s+HandlerInterface.*?\bfunction\s+resolvedMessage\s*\(\s*array\s+\$responses\s*\)' -C2
# Calls passing only $responses
rg -nP --type=php '\bresolvedMessage\s*\(\s*\$[a-zA-Z_][\w]*\s*\)'
# Interface reference to help fix doc wording
rg -nP --type=php 'PromptManager|handlerManager|handlering' .vortex/installer/src/PromptsLength of output: 797 Fix doc typos in HandlerInterface 🤖 Prompt for AI Agents |
||
| /** | ||
| * Set the responses. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -124,7 +124,7 @@ protected function processDemoMode(array $responses, string $dir): void { | |||||||||||||
| $is_demo = $this->config->get(Config::IS_DEMO); | ||||||||||||||
|
|
||||||||||||||
| if (is_null($is_demo)) { | ||||||||||||||
| if ($responses[Starter::id()] !== Starter::DRUPAL_LOAD_DATABASE_DEMO) { | ||||||||||||||
| if ($responses[Starter::id()] !== Starter::LOAD_DATABASE_DEMO) { | ||||||||||||||
| $is_demo = FALSE; | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+127
to
129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Harden access to Starter response to avoid undefined index. In some non-interactive or partial-resolution paths, Starter::id() may be absent; use null coalescing. Apply: - if ($responses[Starter::id()] !== Starter::LOAD_DATABASE_DEMO) {
+ if (($responses[Starter::id()] ?? null) !== Starter::LOAD_DATABASE_DEMO) {
$is_demo = FALSE;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| // Check if it should be enabled based on the provision type and database | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -73,32 +73,29 @@ public function discover(): null|string|bool|array { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * {@inheritdoc} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function process(): void { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $v = $this->getResponseAsString(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function resolvedValue(array $responses): null|string|bool|array { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $discovered = $this->discover(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // If user selected 'custom', use the ProfileCustom response instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($v === self::CUSTOM && isset($this->responses['profile_custom'])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $v = $this->responses['profile_custom']; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!is_null($discovered)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return $discovered; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $t = $this->tmpDir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $w = $this->webroot; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::replaceContentInFile($t . '/.env', '/DRUPAL_PROFILE=.*/', 'DRUPAL_PROFILE=' . $v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (($responses[Starter::id()] ?? '') === Starter::INSTALL_PROFILE_DRUPALCMS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return Starter::INSTALL_PROFILE_DRUPALCMS_PATH; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (in_array($v, [self::STANDARD, self::MINIMAL, self::DEMO_UMAMI])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::rmdir(sprintf('%s/%s/profiles/your_site_profile', $t, $w)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::rmdir(sprintf('%s/%s/profiles/custom/your_site_profile', $t, $w)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::replaceContentAsync([ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/profiles/your_site_profile,' => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/profiles/custom/your_site_profile,' => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::replaceContentAsync('your_site_profile', $v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::renameInDir($t, 'your_site_profile', $v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * {@inheritdoc} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function resolvedMessage(array $responses, mixed $resolved): ?string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (is_string($resolved)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return sprintf('Profile will be set to "%s".', $resolved); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+93
to
99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Avoid logging “custom” as a final profile value. public function resolvedMessage(array $responses, mixed $resolved): ?string {
- if (is_string($resolved)) {
+ if (is_string($resolved)) {
+ if ($resolved === self::CUSTOM) {
+ return NULL;
+ }
return sprintf('Profile will be set to "%s".', $resolved);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -131,4 +128,38 @@ public function discoverName(): null|string|bool|array { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return str_replace(['.info.yml', '.info'], '', basename($path)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * {@inheritdoc} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function process(): void { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $v = $this->getResponseAsString(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // If user selected 'custom', use the ProfileCustom response instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($v === self::CUSTOM && isset($this->responses[ProfileCustom::id()])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $v = $this->responses[ProfileCustom::id()]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $t = $this->tmpDir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $w = $this->webroot; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::replaceContentInFile($t . '/.env', '/DRUPAL_PROFILE=.*/', 'DRUPAL_PROFILE=' . $v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+145
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Anchor the .env replacement to the line for DRUPAL_PROFILE (defensive). Reduces accidental matches if the token appears elsewhere. Apply this diff (if replaceContentInFile supports PCRE flags): - File::replaceContentInFile($t . '/.env', '/DRUPAL_PROFILE=.*/', 'DRUPAL_PROFILE=' . $v);
+ File::replaceContentInFile($t . '/.env', '/^DRUPAL_PROFILE=.*/m', 'DRUPAL_PROFILE=' . $v);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Assume that profiles provided as a path are contrib profiles. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $is_contrib_profile = str_contains($v, DIRECTORY_SEPARATOR); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (in_array($v, [self::STANDARD, self::MINIMAL, self::DEMO_UMAMI]) || $is_contrib_profile) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::rmdir(sprintf('%s/%s/profiles/your_site_profile', $t, $w)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::rmdir(sprintf('%s/%s/profiles/custom/your_site_profile', $t, $w)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::replaceContentAsync([ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/profiles/your_site_profile,' => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/profiles/custom/your_site_profile,' => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::replaceContentAsync('your_site_profile', $v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File::renameInDir($t, 'your_site_profile', $v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+147
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Fix OS-specific path detection for contrib/profile paths. str_contains($v, DIRECTORY_SEPARATOR) fails on Windows when $v uses '/' (e.g., '../recipes/...'), leading to incorrect branch and potential bad renames. Detect both separators. - $is_contrib_profile = str_contains($v, DIRECTORY_SEPARATOR);
+ // Detect both Unix and Windows separators in provided path.
+ $is_contrib_profile = (strpbrk($v, '/\\') !== FALSE);Consider adding a small unit test covering Unix-style and Windows-style paths. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,13 +4,18 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace DrevOps\VortexInstaller\Prompts\Handlers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use DrevOps\VortexInstaller\Utils\JsonManipulator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use DrevOps\VortexInstaller\Utils\Tui; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class Starter extends AbstractHandler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const DRUPAL_LOAD_DATABASE_DEMO = 'demodb'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const INSTALL_PROFILE_CORE = 'install_profile_core'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const DRUPAL_INSTALL_PROFILE = 'drupal_profile'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const INSTALL_PROFILE_DRUPALCMS = 'install_profile_drupalcms'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const LOAD_DATABASE_DEMO = 'load_demodb'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const INSTALL_PROFILE_DRUPALCMS_PATH = '../recipes/drupal_cms_starter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusiveVerify this constant is actually used; otherwise remove or use it in postInstall. Run to confirm: 🏁 Script executed: #!/bin/bash
rg -nC2 '\bINSTALL_PROFILE_DRUPALCMS_PATH\b'Length of output: 46 Remove unused INSTALL_PROFILE_DRUPALCMS_PATH constant 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusiveConfirm usage of INSTALL_PROFILE_DRUPALCMS_PATH or remove it. 🏁 Script executed: #!/bin/bash
# Find references to the constant across the repo.
rg -nC2 '\bINSTALL_PROFILE_DRUPALCMS_PATH\b'Length of output: 46 Remove the unused constant INSTALL_PROFILE_DRUPALCMS_PATH. It isn’t referenced anywhere in the repo. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * {@inheritdoc} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -25,8 +30,12 @@ public function label(): string { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static function description(array $responses): ?string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $label1 = Tui::bold('Drupal, installed from profile'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $label11 = Tui::underscore('populating a fresh database'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $label2 = Tui::bold('Drupal, loaded from the demo database'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $label21 = Tui::underscore('loading an existing demo database'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $label2 = Tui::bold('Drupal CMS, installed from profile'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $label21 = Tui::underscore('populating a fresh database'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $label3 = Tui::bold('Drupal, loaded from the demo database'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $label31 = Tui::underscore('loading an existing demo database'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return <<<DOC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Choose how your site will be created the first time after this installer finishes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -36,7 +45,11 @@ public static function description(array $responses): ?string { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from one of the standard Drupal installation profiles. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ○ {$label2} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Creates a site by {$label21} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Creates a new site by {$label21} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from the Drupal CMS recipe. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ○ {$label3} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Creates a site by {$label31} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| provided with the installer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DOC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -53,16 +66,17 @@ public function hint(array $responses): ?string { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function options(array $responses): ?array { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self::DRUPAL_INSTALL_PROFILE => 'Drupal, installed from profile', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self::DRUPAL_LOAD_DATABASE_DEMO => 'Drupal, loaded from the demo database', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self::INSTALL_PROFILE_CORE => 'Drupal, installed from profile', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self::INSTALL_PROFILE_DRUPALCMS => 'Drupal CMS, installed from profile', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self::LOAD_DATABASE_DEMO => 'Drupal, loaded from the demo database', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * {@inheritdoc} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function default(array $responses): null|string|bool|array { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return self::DRUPAL_LOAD_DATABASE_DEMO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return self::LOAD_DATABASE_DEMO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -76,7 +90,29 @@ public function discover(): null|string|bool|array { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * {@inheritdoc} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function process(): void { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // @todo Implement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($this->response == self::INSTALL_PROFILE_DRUPALCMS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj = JsonManipulator::fromFile($this->tmpDir . '/composer.json'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addLink('require', 'drupal/cms', '^1.0', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addLink('require', 'wikimedia/composer-merge-plugin', '^2.1', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addLink('require', 'symfony/http-client', '^6.4 || ^7.0', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addConfigSetting('allow-plugins.drupal/core-project-message', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addConfigSetting('allow-plugins.wikimedia/composer-merge-plugin', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.ignore-duplicates', FALSE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.merge-false', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.merge-extra', FALSE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.merge-extra-deep', FALSE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.merge-replace', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.merge-scripts', FALSE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.recurse', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.replace', TRUE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $cj->addProperty('extra.merge-plugin.require', ['vendor/drupal/cms/composer.json']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+96
to
+112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Ensure recipes install under web/recipes and allow composer/installers. Meets PR objective (type:drupal-recipe → web/recipes/{$name}) and avoids Composer 2 plugin blocks. Apply: $cj->addLink('require', 'drupal/cms', '^1.0', TRUE);
$cj->addLink('require', 'wikimedia/composer-merge-plugin', '^2.1', TRUE);
$cj->addLink('require', 'symfony/http-client', '^6.4 || ^7.0', TRUE);
+ $cj->addConfigSetting('allow-plugins.composer/installers', TRUE);
@@
- $cj->addProperty('extra.merge-plugin.require', ['vendor/drupal/cms/composer.json']);
+ $cj->addProperty('extra.merge-plugin.require', ['vendor/drupal/cms/composer.json']);
+ $cj->addProperty('extra.installer-paths.web/recipes/{$name}', ['type:drupal-recipe']);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $c = $cj->getContents(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| file_put_contents($this->tmpDir . '/composer.json', $c); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+93
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix loose comparison, null deref, missing installer-path, and Composer plugin allowances.
- if ($this->response == self::INSTALL_PROFILE_DRUPALCMS) {
- $cj = JsonManipulator::fromFile($this->tmpDir . '/composer.json');
+ if ($this->response === self::INSTALL_PROFILE_DRUPALCMS) {
+ $composerPath = $this->tmpDir . '/composer.json';
+ $cj = JsonManipulator::fromFile($composerPath);
+ if ($cj === NULL) {
+ throw new \RuntimeException(sprintf('composer.json not found or unreadable at %s', $composerPath));
+ }
@@
$cj->addLink('require', 'drupal/cms', '^1.0', TRUE);
$cj->addLink('require', 'wikimedia/composer-merge-plugin', '^2.1', TRUE);
$cj->addLink('require', 'symfony/http-client', '^6.4 || ^7.0', TRUE);
@@
$cj->addConfigSetting('allow-plugins.drupal/core-project-message', TRUE);
$cj->addConfigSetting('allow-plugins.wikimedia/composer-merge-plugin', TRUE);
+ $cj->addConfigSetting('allow-plugins.composer/installers', TRUE);
@@
$cj->addProperty('extra.merge-plugin.ignore-duplicates', FALSE);
- $cj->addProperty('extra.merge-plugin.merge-false', TRUE);
+ $cj->addProperty('extra.merge-plugin.merge-dev', TRUE);
$cj->addProperty('extra.merge-plugin.merge-extra', FALSE);
$cj->addProperty('extra.merge-plugin.merge-extra-deep', FALSE);
$cj->addProperty('extra.merge-plugin.merge-replace', TRUE);
$cj->addProperty('extra.merge-plugin.merge-scripts', FALSE);
$cj->addProperty('extra.merge-plugin.recurse', TRUE);
$cj->addProperty('extra.merge-plugin.replace', TRUE);
$cj->addProperty('extra.merge-plugin.require', ['vendor/drupal/cms/composer.json']);
+ $cj->addProperty('extra.installer-paths.web/recipes/{$name}', ['type:drupal-recipe']);
@@
- $c = $cj->getContents();
- file_put_contents($this->tmpDir . '/composer.json', $c);
+ $c = $cj->getContents();
+ if (file_put_contents($composerPath, $c) === FALSE) {
+ throw new \RuntimeException(sprintf('Failed to write composer.json to %s', $composerPath));
+ }📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -89,12 +125,12 @@ public function postInstall(): ?string { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $output = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($this->response == self::DRUPAL_LOAD_DATABASE_DEMO) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($this->response == self::LOAD_DATABASE_DEMO) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Use strict comparison. - if ($this->response == self::LOAD_DATABASE_DEMO) {
+ if ($this->response === self::LOAD_DATABASE_DEMO) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $output .= 'Build project locally:' . PHP_EOL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $output .= ' ahoy build' . PHP_EOL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $output .= PHP_EOL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| elseif ($this->response == self::DRUPAL_INSTALL_PROFILE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| elseif ($this->response == self::INSTALL_PROFILE_CORE || $this->response == self::INSTALL_PROFILE_DRUPALCMS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $output .= 'Build project locally:' . PHP_EOL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $output .= ' VORTEX_PROVISION_TYPE=profile ahoy build' . PHP_EOL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $output .= PHP_EOL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -125,7 +125,9 @@ public function runPrompts(): void { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ->intro('Drupal') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ->add(fn($r, $pr, $n): int|string => select(...$this->args(Starter::class, NULL, $r)), Starter::id()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ->add( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fn($r, $pr, $n): int|string => select(...$this->args(Profile::class)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function (array $r, $pr, $n): string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return $this->resolveOrPrompt(Profile::id(), $r, fn(): int|string => select(...$this->args(Profile::class))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Profile::id() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ->addIf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -147,17 +149,8 @@ public function runPrompts(): void { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ->intro('Hosting') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ->add(fn($r, $pr, $n): int|string => select(...$this->args(HostingProvider::class)), HostingProvider::id()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ->add( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // @todo Move into centralised resolver within this class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function (array $r, $pr, $n): string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $handler = $this->handlers[Webroot::id()]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $resolved = $handler->resolvedValue($r); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (is_string($resolved)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| info($handler->resolvedMessage($r)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return $resolved; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return text(...$this->args(Webroot::class, NULL, $r)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return $this->resolveOrPrompt(Webroot::id(), $r, fn(): string => text(...$this->args(Webroot::class, NULL, $r))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Webroot::id() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -567,4 +560,38 @@ private function args(string $handler_class, mixed $default_override = NULL, arr | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return array_filter($args, fn($value): bool => $value !== NULL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Resolve a value via handler or prompt the user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * This method is used to resolve a value via a handler's resolvedValue() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * method. If the value is not resolved, it will prompt the user using the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * provided prompt callable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param string $handler_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The handler ID. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param array $r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Current form responses for context-aware methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param callable $prompt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The prompt callable to use if the value is not resolved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @return string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The resolved value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| protected function resolveOrPrompt(string $handler_id, array $r, callable $prompt): string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $handler = $this->handlers[$handler_id]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $resolved = $handler->resolvedValue($r); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (is_string($resolved)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $message = $handler->resolvedMessage($r, $resolved); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($message) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| info($message); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return $resolved; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return (string) $prompt(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+563
to
+596
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Optional: guard handler existence in resolveOrPrompt. Defensive check mirrors other parts of the class. protected function resolveOrPrompt(string $handler_id, array $r, callable $prompt): string {
- $handler = $this->handlers[$handler_id];
+ if (!array_key_exists($handler_id, $this->handlers)) {
+ throw new \RuntimeException(sprintf('Handler for "%s" not found.', $handler_id));
+ }
+ $handler = $this->handlers[$handler_id];📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Fail-fast for deployment tests — tradeoff check.
Ok if speed > parallel failure visibility. If you still want all batches’ logs even after one fails, keep fail-fast false here.
🤖 Prompt for AI Agents