Skip to content

Commit 77a6216

Browse files
committed
order
1 parent 8eb8d36 commit 77a6216

24 files changed

Lines changed: 744 additions & 744 deletions

.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,6 @@ class AiCodeInstructions extends AbstractHandler {
1010

1111
const CLAUDE = 'claude';
1212

13-
/**
14-
* {@inheritdoc}
15-
*/
16-
public function discover(): null|string|bool|array {
17-
if (!$this->isInstalled()) {
18-
return NULL;
19-
}
20-
21-
if (is_readable($this->dstDir . '/CLAUDE.md')) {
22-
return self::CLAUDE;
23-
}
24-
25-
return self::NONE;
26-
}
27-
28-
/**
29-
* {@inheritdoc}
30-
*/
31-
public function process(): void {
32-
$v = $this->getResponseAsString();
33-
$t = $this->tmpDir;
34-
35-
if ($v !== self::CLAUDE) {
36-
@unlink($t . '/CLAUDE.md');
37-
}
38-
}
39-
4013
/**
4114
* {@inheritdoc}
4215
*/
@@ -68,4 +41,31 @@ public function default(array $responses): null|string|bool|array {
6841
return self::NONE;
6942
}
7043

44+
/**
45+
* {@inheritdoc}
46+
*/
47+
public function discover(): null|string|bool|array {
48+
if (!$this->isInstalled()) {
49+
return NULL;
50+
}
51+
52+
if (is_readable($this->dstDir . '/CLAUDE.md')) {
53+
return self::CLAUDE;
54+
}
55+
56+
return self::NONE;
57+
}
58+
59+
/**
60+
* {@inheritdoc}
61+
*/
62+
public function process(): void {
63+
$v = $this->getResponseAsString();
64+
$t = $this->tmpDir;
65+
66+
if ($v !== self::CLAUDE) {
67+
@unlink($t . '/CLAUDE.md');
68+
}
69+
}
70+
7171
}

.vortex/installer/src/Prompts/Handlers/AssignAuthorPr.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@ class AssignAuthorPr extends AbstractHandler {
99
/**
1010
* {@inheritdoc}
1111
*/
12-
public function discover(): null|string|bool|array {
13-
return $this->isInstalled() ? file_exists($this->dstDir . '/.github/workflows/assign-author.yml') : NULL;
12+
public function label(): string {
13+
return '👤 Auto-assign the author to their PR?';
1414
}
1515

1616
/**
1717
* {@inheritdoc}
1818
*/
19-
public function process(): void {
20-
if (empty($this->response)) {
21-
@unlink($this->tmpDir . '/.github/workflows/assign-author.yml');
22-
}
19+
public function hint(array $responses): ?string {
20+
return 'Helps to keep the PRs organized.';
2321
}
2422

2523
/**
2624
* {@inheritdoc}
2725
*/
28-
public function label(): string {
29-
return '👤 Auto-assign the author to their PR?';
26+
public function default(array $responses): null|string|bool|array {
27+
return TRUE;
3028
}
3129

3230
/**
3331
* {@inheritdoc}
3432
*/
35-
public function hint(array $responses): ?string {
36-
return 'Helps to keep the PRs organized.';
33+
public function discover(): null|string|bool|array {
34+
return $this->isInstalled() ? file_exists($this->dstDir . '/.github/workflows/assign-author.yml') : NULL;
3735
}
3836

3937
/**
4038
* {@inheritdoc}
4139
*/
42-
public function default(array $responses): null|string|bool|array {
43-
return TRUE;
40+
public function process(): void {
41+
if (empty($this->response)) {
42+
@unlink($this->tmpDir . '/.github/workflows/assign-author.yml');
43+
}
4444
}
4545

4646
}

.vortex/installer/src/Prompts/Handlers/CiProvider.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,44 @@ class CiProvider extends AbstractHandler {
1414

1515
const CIRCLECI = 'circleci';
1616

17+
/**
18+
* {@inheritdoc}
19+
*/
20+
public function label(): string {
21+
return '🔄 Continuous Integration provider';
22+
}
23+
24+
/**
25+
* {@inheritdoc}
26+
*/
27+
public function hint(array $responses): ?string {
28+
return 'Both providers support equivalent workflow.';
29+
}
30+
31+
/**
32+
* {@inheritdoc}
33+
*/
34+
public function options(array $responses): ?array {
35+
$options = [
36+
self::NONE => 'None',
37+
self::GITHUB_ACTIONS => 'GitHub Actions',
38+
self::CIRCLECI => 'CircleCI',
39+
];
40+
41+
if (isset($responses[CodeProvider::id()]) && $responses[CodeProvider::id()] !== CodeProvider::GITHUB) {
42+
unset($options[self::GITHUB_ACTIONS]);
43+
}
44+
45+
return $options;
46+
}
47+
48+
/**
49+
* {@inheritdoc}
50+
*/
51+
public function default(array $responses): null|string|bool|array {
52+
return self::GITHUB_ACTIONS;
53+
}
54+
1755
/**
1856
* {@inheritdoc}
1957
*/
@@ -80,42 +118,4 @@ public function process(): void {
80118
}
81119
}
82120

83-
/**
84-
* {@inheritdoc}
85-
*/
86-
public function label(): string {
87-
return '🔄 Continuous Integration provider';
88-
}
89-
90-
/**
91-
* {@inheritdoc}
92-
*/
93-
public function hint(array $responses): ?string {
94-
return 'Both providers support equivalent workflow.';
95-
}
96-
97-
/**
98-
* {@inheritdoc}
99-
*/
100-
public function options(array $responses): ?array {
101-
$options = [
102-
self::NONE => 'None',
103-
self::GITHUB_ACTIONS => 'GitHub Actions',
104-
self::CIRCLECI => 'CircleCI',
105-
];
106-
107-
if (isset($responses[CodeProvider::id()]) && $responses[CodeProvider::id()] !== CodeProvider::GITHUB) {
108-
unset($options[self::GITHUB_ACTIONS]);
109-
}
110-
111-
return $options;
112-
}
113-
114-
/**
115-
* {@inheritdoc}
116-
*/
117-
public function default(array $responses): null|string|bool|array {
118-
return self::GITHUB_ACTIONS;
119-
}
120-
121121
}

.vortex/installer/src/Prompts/Handlers/CodeProvider.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,6 @@ class CodeProvider extends AbstractHandler {
1212

1313
const OTHER = 'other';
1414

15-
/**
16-
* {@inheritdoc}
17-
*/
18-
public function discover(): null|string|bool|array {
19-
if (file_exists($this->dstDir . '/.github')) {
20-
return self::GITHUB;
21-
}
22-
23-
return $this->isInstalled() && file_exists($this->dstDir . '/.git') ? self::OTHER : NULL;
24-
}
25-
26-
/**
27-
* {@inheritdoc}
28-
*/
29-
public function process(): void {
30-
$v = $this->getResponseAsString();
31-
32-
if ($v !== self::GITHUB) {
33-
File::rmdir($this->tmpDir . '/.github');
34-
}
35-
}
36-
3715
/**
3816
* {@inheritdoc}
3917
*/
@@ -65,4 +43,26 @@ public function default(array $responses): null|string|bool|array {
6543
return self::GITHUB;
6644
}
6745

46+
/**
47+
* {@inheritdoc}
48+
*/
49+
public function discover(): null|string|bool|array {
50+
if (file_exists($this->dstDir . '/.github')) {
51+
return self::GITHUB;
52+
}
53+
54+
return $this->isInstalled() && file_exists($this->dstDir . '/.git') ? self::OTHER : NULL;
55+
}
56+
57+
/**
58+
* {@inheritdoc}
59+
*/
60+
public function process(): void {
61+
$v = $this->getResponseAsString();
62+
63+
if ($v !== self::GITHUB) {
64+
File::rmdir($this->tmpDir . '/.github');
65+
}
66+
}
67+
6868
}

.vortex/installer/src/Prompts/Handlers/DatabaseDownloadSource.php

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,6 @@ class DatabaseDownloadSource extends AbstractHandler {
2121

2222
const NONE = 'none';
2323

24-
/**
25-
* {@inheritdoc}
26-
*/
27-
public function discover(): null|string|bool|array {
28-
return Env::getFromDotenv('VORTEX_DB_DOWNLOAD_SOURCE', $this->dstDir);
29-
}
30-
31-
/**
32-
* {@inheritdoc}
33-
*/
34-
public function process(): void {
35-
$type = $this->getResponseAsString();
36-
37-
File::replaceContentInFile($this->tmpDir . '/.env', '/VORTEX_DB_DOWNLOAD_SOURCE=.*/', 'VORTEX_DB_DOWNLOAD_SOURCE=' . $type);
38-
39-
$types = [
40-
DatabaseDownloadSource::URL,
41-
DatabaseDownloadSource::FTP,
42-
DatabaseDownloadSource::ACQUIA,
43-
DatabaseDownloadSource::LAGOON,
44-
DatabaseDownloadSource::CONTAINER_REGISTRY,
45-
];
46-
47-
foreach ($types as $t) {
48-
$token = 'DB_DOWNLOAD_SOURCE_' . strtoupper($t);
49-
if ($t === $type) {
50-
File::removeTokenAsync('!' . $token);
51-
}
52-
else {
53-
File::removeTokenAsync($token);
54-
}
55-
}
56-
}
57-
5824
/**
5925
* {@inheritdoc}
6026
*/
@@ -79,7 +45,7 @@ public function options(array $responses): ?array {
7945
self::ACQUIA => '💧 Acquia backup',
8046
self::LAGOON => '🌊 Lagoon environment',
8147
self::CONTAINER_REGISTRY => '🐳 Container registry',
82-
self::NONE => '🚫 None',
48+
self::NONE => '🙅 None',
8349
];
8450

8551
if (isset($responses[HostingProvider::id()])) {
@@ -95,6 +61,13 @@ public function options(array $responses): ?array {
9561
return $options;
9662
}
9763

64+
/**
65+
* {@inheritdoc}
66+
*/
67+
public function shouldRun(array $responses): bool {
68+
return isset($responses[ProvisionType::id()]) && $responses[ProvisionType::id()] !== ProvisionType::PROFILE;
69+
}
70+
9871
/**
9972
* {@inheritdoc}
10073
*/
@@ -113,8 +86,35 @@ public function default(array $responses): null|string|bool|array {
11386
/**
11487
* {@inheritdoc}
11588
*/
116-
public function shouldRun(array $responses): bool {
117-
return isset($responses[ProvisionType::id()]) && $responses[ProvisionType::id()] !== ProvisionType::PROFILE;
89+
public function discover(): null|string|bool|array {
90+
return Env::getFromDotenv('VORTEX_DB_DOWNLOAD_SOURCE', $this->dstDir);
91+
}
92+
93+
/**
94+
* {@inheritdoc}
95+
*/
96+
public function process(): void {
97+
$type = $this->getResponseAsString();
98+
99+
File::replaceContentInFile($this->tmpDir . '/.env', '/VORTEX_DB_DOWNLOAD_SOURCE=.*/', 'VORTEX_DB_DOWNLOAD_SOURCE=' . $type);
100+
101+
$types = [
102+
DatabaseDownloadSource::URL,
103+
DatabaseDownloadSource::FTP,
104+
DatabaseDownloadSource::ACQUIA,
105+
DatabaseDownloadSource::LAGOON,
106+
DatabaseDownloadSource::CONTAINER_REGISTRY,
107+
];
108+
109+
foreach ($types as $t) {
110+
$token = 'DB_DOWNLOAD_SOURCE_' . strtoupper($t);
111+
if ($t === $type) {
112+
File::removeTokenAsync('!' . $token);
113+
}
114+
else {
115+
File::removeTokenAsync($token);
116+
}
117+
}
118118
}
119119

120120
}

0 commit comments

Comments
 (0)