Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .vortex/.ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ahoyapi: v2
commands:

install:
name: Install test dependencies.
usage: Install test dependencies.
cmd: |
[ -d ./tests/vendor ] && rm -rf ./tests/vendor
composer --working-dir tests install
Expand All @@ -18,19 +18,19 @@ commands:
yarn --cwd=docs install --frozen-lockfile

docs:
name: Start documentation server.
usage: Start documentation server.
cmd: |
[ ! -d ./docs/node_modules ] && yarn --cwd=docs install --frozen-lockfile
yarn --cwd=docs run start

docs-serve:
name: Serve built documentation.
usage: Serve built documentation.
cmd: |
[ ! -d ./docs/node_modules ] && yarn --cwd=docs install --frozen-lockfile
yarn --cwd=docs run start

build-docs:
name: Build documentation.
usage: Build documentation.
cmd: |
[ ! -d ./docs/node_modules ] && yarn --cwd=docs install --frozen-lockfile
yarn --cwd=docs run build
Expand All @@ -48,13 +48,13 @@ commands:
php -S "localhost:${port}" -t ./docs_combined/build ./docs/.utils/serve-router.php

build-installer:
name: Build documentation.
usage: Build documentation.
cmd: |
[ ! -d ./installer/vendor ] && composer --working-dir installer install
composer --working-dir installer build

lint:
name: Lint Vortex project.
usage: Lint Vortex project.
cmd: |
ahoy lint-installer
ahoy lint-tests
Expand All @@ -65,7 +65,7 @@ commands:
ahoy lint-ci

lint-fix:
name: Fix linting issues in Vortex project.
usage: Fix linting issues in Vortex project.
cmd: |
ahoy lint-installer-fix
ahoy lint-tests-fix
Expand Down Expand Up @@ -106,13 +106,13 @@ commands:
lint-docs:
cmd: |
yarn --cwd=docs run lint
yarn --cwd=./docs run spellcheck
yarn --cwd=docs run spellcheck

lint-docs-fix:
cmd: yarn --cwd=docs run lint-fix

test:
name: Test Vortex project.
usage: Test Vortex project.
cmd: |
ahoy test-common
ahoy test-docs
Expand All @@ -127,17 +127,17 @@ commands:

test-docs:
cmd: |
[ ! -d ./docs/node_modules ] && yarn --cwd=./docs install --frozen-lockfile
yarn --cwd=./docs run test
yarn --cwd=./docs run spellcheck
[ ! -d ./docs/node_modules ] && yarn --cwd=docs install --frozen-lockfile
yarn --cwd=docs run test
yarn --cwd=docs run spellcheck

# If there are changes to the snapshots - this command will re-run twice reporting error the first time.
update-snapshots:
aliases: [us]
cmd: |
export XDEBUG_MODE=off
composer --working-dir=tests update-snapshots
composer --working-dir=installer update-snapshots -- --jobs=8
composer --working-dir tests update-snapshots
composer --working-dir installer update-snapshots -- --jobs=8

update-snapshots-install:
aliases: [usi]
Expand Down
1 change: 0 additions & 1 deletion .vortex/installer/src/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ protected function showFailureSummary(): void {

Tui::line('');

// Show last 10 lines of output for context.
$runner_output = $this->processRunner->getOutput(as_array: TRUE);

if (!is_array($runner_output)) {
Expand Down
7 changes: 1 addition & 6 deletions .vortex/installer/src/Command/DestinationAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ trait DestinationAwareTrait {
* Add the destination option to the command.
*/
protected function addDestinationOption(): void {
$this->addOption(
'destination',
'd',
InputOption::VALUE_REQUIRED,
'Target directory for the operation. Defaults to current directory.'
);
$this->addOption('destination', 'd', InputOption::VALUE_REQUIRED, 'Target directory for the operation. Defaults to current directory.');
}

/**
Expand Down
9 changes: 4 additions & 5 deletions .vortex/installer/src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
action: function (): string {
$release_prefix = Version::releasePrefix($this->getApplication()->getVersion());
// The staging directory can be pointed at a reused location, and the
// download unpacks into it rather than replacing it, so anything a
// download unpacks into it rather than replacing it. Anything a
// previous run left behind would be treated as shipped by this one.
$this->fileManager->resetStaging();
$version = $this->getRepositoryDownloader()->download($this->artifact, $this->config->get(Config::TMP), $release_prefix);
Expand Down Expand Up @@ -304,8 +304,8 @@ function (string $dir, string $ref): void {
$this->presenter->footerBuildSkipped();
}

// Cleanup should take place only in case of the successful installation.
// Otherwise, the user should be able to re-run the installer.
// Cleanup runs only on successful installation; after a failure the user
// can re-run the installer.
register_shutdown_function([$this, 'cleanup']);

return Command::SUCCESS;
Expand Down Expand Up @@ -448,7 +448,7 @@ public function cleanup(): void {
* Get the repository downloader.
*
* Provides a default RepositoryDownloader instance or returns the injected
* one. This allows tests to inject mocks via setRepositoryDownloader().
* one.
*
* @return \DrevOps\VortexInstaller\Downloader\RepositoryDownloader
* The repository downloader.
Expand All @@ -471,7 +471,6 @@ public function setRepositoryDownloader(RepositoryDownloader $repository_downloa
* Get the file downloader.
*
* Provides a default Downloader instance or returns the injected one.
* This allows tests to inject mocks via setFileDownloader().
*
* @return \DrevOps\VortexInstaller\Downloader\Downloader
* The file downloader.
Expand Down
3 changes: 0 additions & 3 deletions .vortex/installer/src/Downloader/Artifact.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public function isLocal(): bool {
* Check if this artifact uses default repository and reference.
*/
public function isDefault(): bool {
// Check if using default repository (with or without .git).
$default_repo_without_git = self::normalizeRepoUrl(RepositoryDownloader::DEFAULT_REPO);
$is_default_repo = ($this->repo === RepositoryDownloader::DEFAULT_REPO || $this->repo === $default_repo_without_git);

Expand Down Expand Up @@ -168,7 +167,6 @@ protected static function parseUri(string $src): array {
$src = $matches[1] . '#' . $matches[2];
}

// Try GitHub-specific patterns first.
$github_pattern = self::detectGitHubUrlPattern($src);
if ($github_pattern !== NULL) {
[$repo, $ref] = $github_pattern;
Expand All @@ -180,7 +178,6 @@ protected static function parseUri(string $src): array {
return [$repo, $ref];
}

// Fall back to #ref parsing (standard git reference syntax).
if (str_starts_with($src, 'https://') || str_starts_with($src, 'http://')) {
if (!preg_match('~^(https?://[^/]+/[^/]+/[^#]+)(?:#(.+))?$~', $src, $matches)) {
throw new \RuntimeException(sprintf('Invalid remote repository format: "%s". Use # to specify a reference (e.g., repo.git#tag).', $src));
Expand Down
4 changes: 2 additions & 2 deletions .vortex/installer/src/Downloader/Downloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Downloader {
* Constructs a new Downloader instance.
*
* @param \GuzzleHttp\ClientInterface|null $httpClient
* Optional HTTP client for testing. If not provided, a default Guzzle
* client will be created.
* Optional HTTP client. If not provided, a default Guzzle client will be
* created.
*/
public function __construct(
protected ?ClientInterface $httpClient = new Client(self::CLIENT_OPTIONS),
Expand Down
10 changes: 4 additions & 6 deletions .vortex/installer/src/Downloader/RepositoryDownloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class RepositoryDownloader implements RepositoryDownloaderInterface {
* Optional HTTP client for API calls (e.g., discovering releases).
* If not provided, a default Guzzle client will be created.
* @param \DrevOps\VortexInstaller\Downloader\ArchiverInterface|null $archiver
* Optional Archiver instance for testing. If not provided, a default
* Archiver will be created.
* Optional Archiver instance. If not provided, a default Archiver will be
* created.
* @param \DrevOps\VortexInstaller\Utils\Git|null $git
* Optional Git instance for testing. If not provided, will be created
* when needed for local repository operations.
* Optional Git instance. If not provided, will be created when needed for
* local repository operations.
* @param \DrevOps\VortexInstaller\Downloader\Downloader|null $fileDownloader
* Optional Downloader instance for downloading archive files.
* If not provided, a default Downloader will be created.
Expand Down Expand Up @@ -316,8 +316,6 @@ protected function validateRemoteRefExists(string $repo_url, string $ref): void
$options = ['headers' => self::requestHeaders($archive_url), 'http_errors' => FALSE];

try {
// Use HEAD request to check if the archive URL exists without
// downloading.
$response = $this->httpClient->request('HEAD', $archive_url, $options);
$status_code = $response->getStatusCode();

Expand Down
2 changes: 0 additions & 2 deletions .vortex/installer/src/Logger/FileLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,12 @@ public function getDir(): string {
protected function buildFilename(string $command, array $args = []): string {
$parts = [$command];

// Only include positional arguments, not options (starting with -).
foreach ($args as $arg) {
if (!str_starts_with($arg, '-')) {
$parts[] = $arg;
}
}

// Sanitize for use in filename.
$name = implode('-', $parts);
$name = (string) preg_replace('/[^a-zA-Z0-9\-_]/', '-', $name);
$name = (string) preg_replace('/-+/', '-', $name);
Expand Down
4 changes: 0 additions & 4 deletions .vortex/installer/src/Logger/LoggerAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ trait LoggerAwareTrait {
/**
* Get the logger.
*
* Factory method that returns existing logger or creates new one.
*
* @return \DrevOps\VortexInstaller\Logger\FileLoggerInterface
* The logger instance.
*/
Expand All @@ -29,8 +27,6 @@ public function getLogger(): FileLoggerInterface {
/**
* Set the logger.
*
* Allows dependency injection for testing.
*
* @param \DrevOps\VortexInstaller\Logger\FileLoggerInterface $logger
* The logger instance.
*/
Expand Down
14 changes: 7 additions & 7 deletions .vortex/installer/src/Prompts/Handlers/CustomModules.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ public function discover(): null|string|bool|array {
* {@inheritdoc}
*/
public function process(): void {
$selected = $this->getResponseAsArray();
$v = $this->getResponseAsArray();
$t = $this->tmpDir;
$w = $this->webroot;

// The search module cannot function without Solr, so remove it from the
// selection when the Solr service was not selected.
if (in_array(self::SEARCH, $selected) && isset($this->responses[Services::id()])) {
if (in_array(self::SEARCH, $v) && isset($this->responses[Services::id()])) {
$services = $this->responses[Services::id()];
if (is_array($services) && !in_array(Services::SOLR, $services)) {
$selected = array_values(array_diff($selected, [self::SEARCH]));
$v = array_values(array_diff($v, [self::SEARCH]));
}
}

if (!in_array(self::BASE, $selected)) {
if (!in_array(self::BASE, $v)) {
File::removeTokenAsync('CUSTOM_MODULE_BASE');

$locations = [
Expand All @@ -144,7 +144,7 @@ public function process(): void {
}
}

if (!in_array(self::DEMO, $selected)) {
if (!in_array(self::DEMO, $v)) {
File::removeTokenAsync('CUSTOM_MODULE_DEMO');

$locations = [
Expand All @@ -164,7 +164,7 @@ public function process(): void {
self::removeDemoBehatFeatures($t);
}

if (!in_array(self::SEARCH, $selected)) {
if (!in_array(self::SEARCH, $v)) {
File::removeTokenAsync('CUSTOM_MODULE_SEARCH');

$locations = [
Expand All @@ -185,7 +185,7 @@ public function process(): void {
// The 'page' content model is shared: the demo module attaches behavior to
// the content type and the search tests index content of that type. It is
// only removed once neither of them remains.
if (!in_array(self::DEMO, $selected) && !in_array(self::SEARCH, $selected)) {
if (!in_array(self::DEMO, $v) && !in_array(self::SEARCH, $v)) {
File::removeTokenAsync('CONTENT_MODEL');
File::remove($t . '/recipes/page');
}
Expand Down
9 changes: 5 additions & 4 deletions .vortex/installer/src/Prompts/Handlers/DeployTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function discover(): null|string|bool|array {
if (!empty($types)) {
$types = Converter::fromList($types);
sort($types);

return $types;
}

Expand All @@ -89,13 +90,13 @@ public function discover(): null|string|bool|array {
* {@inheritdoc}
*/
public function process(): void {
$types = $this->getResponseAsArray();
$v = $this->getResponseAsArray();
$t = $this->tmpDir;

if (!empty($types)) {
Env::writeValueDotenv('VORTEX_DEPLOY_TYPES', Converter::toList($types), $t . '/.env');
if (!empty($v)) {
Env::writeValueDotenv('VORTEX_DEPLOY_TYPES', Converter::toList($v), $t . '/.env');

if (!in_array(self::ARTIFACT, $types)) {
if (!in_array(self::ARTIFACT, $v)) {
File::remove($t . '/.gitignore.deployment');
File::remove($t . '/.gitignore.artifact');
}
Expand Down
2 changes: 0 additions & 2 deletions .vortex/installer/src/Prompts/Handlers/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public function label(): string {
}

public function discover(): null|string|bool|array {

return NULL;
}

Expand All @@ -29,7 +28,6 @@ public function process(): void {
Env::writeValueDotenv($name, $value, $t . '/.env');
}
}

}

}
2 changes: 1 addition & 1 deletion .vortex/installer/src/Prompts/Handlers/HostingProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function options(array $responses): ?array {
* {@inheritdoc}
*/
public function default(array $responses): null|string|bool|array {
return 'none';
return self::NONE;
}

/**
Expand Down
1 change: 0 additions & 1 deletion .vortex/installer/src/Prompts/Handlers/Internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public function process(): void {
}
}
});

}

/**
Expand Down
Loading