Skip to content
Snippets Groups Projects
Commit eacc6365 authored by Adam G-H's avatar Adam G-H
Browse files

Fix broken non-build tests

parent 46538cc2
No related branches found
No related tags found
1 merge request!20Issue #3230250: Update Composer Stager to 0.2.0
This commit is part of merge request !20. Comments created here will be created in the context of that merge request.
...@@ -11,7 +11,7 @@ services: ...@@ -11,7 +11,7 @@ services:
tags: tags:
- { name: event_subscriber } - { name: event_subscriber }
automatic_updates.beginner: automatic_updates.beginner:
class: Drupal\automatic_updates\ComposerStager\Beginner class: PhpTuf\ComposerStager\Domain\Beginner
arguments: arguments:
['@automatic_updates.file_copier', '@automatic_updates.file_system' ] ['@automatic_updates.file_copier', '@automatic_updates.file_system' ]
automatic_updates.stager: automatic_updates.stager:
...@@ -34,17 +34,18 @@ services: ...@@ -34,17 +34,18 @@ services:
class: PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\FileCopierFactory class: PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\FileCopierFactory
arguments: arguments:
- '@automatic_updates.symfony_exec_finder' - '@automatic_updates.symfony_exec_finder'
- '@automatic_updates.file_copier.php'
- '@automatic_updates.file_copier.rsync' - '@automatic_updates.file_copier.rsync'
- '@automatic_updates.file_copier.symfony'
automatic_updates.file_copier.rsync: automatic_updates.file_copier.rsync:
class: PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\RsyncFileCopier class: PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\RsyncFileCopier
arguments: arguments:
- '@automatic_updates.file_system' - '@automatic_updates.file_system'
- '@automatic_updates.rsync' - '@automatic_updates.rsync'
automatic_updates.file_copier.symfony: automatic_updates.file_copier.php:
class: PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\SymfonyFileCopier class: PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\PhpFileCopier
arguments: arguments:
- '@automatic_updates.symfony_file_system' - '@automatic_updates.file_system'
- '@automatic_updates.finder'
- '@automatic_updates.finder' - '@automatic_updates.finder'
automatic_updates.finder: automatic_updates.finder:
class: Symfony\Component\Finder\Finder class: Symfony\Component\Finder\Finder
......
<?php
namespace Drupal\automatic_updates\ComposerStager;
use PhpTuf\ComposerStager\Domain\BeginnerInterface;
use PhpTuf\ComposerStager\Domain\Output\ProcessOutputCallbackInterface;
use PhpTuf\ComposerStager\Exception\DirectoryAlreadyExistsException;
use PhpTuf\ComposerStager\Exception\DirectoryNotFoundException;
use PhpTuf\ComposerStager\Infrastructure\Filesystem\FilesystemInterface;
use PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\FileCopierInterface;
/**
* An implementation of Composer Stager's Beginner which supports exclusions.
*
* @todo Remove this class when composer_stager implements this functionality.
*/
final class Beginner implements BeginnerInterface {
/**
* The file copier service.
*
* @var \PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\FileCopierInterface
*/
private $fileCopier;
/**
* The file system service.
*
* @var \PhpTuf\ComposerStager\Infrastructure\Filesystem\FilesystemInterface
*/
private $filesystem;
/**
* Constructs a Beginner object.
*
* @param \PhpTuf\ComposerStager\Infrastructure\Process\FileCopier\FileCopierInterface $fileCopier
* The file copier service.
* @param \PhpTuf\ComposerStager\Infrastructure\Filesystem\FilesystemInterface $filesystem
* The file system service.
*/
public function __construct(FileCopierInterface $fileCopier, FilesystemInterface $filesystem) {
$this->fileCopier = $fileCopier;
$this->filesystem = $filesystem;
}
/**
* {@inheritdoc}
*/
public function begin(string $activeDir, string $stagingDir, ?ProcessOutputCallbackInterface $callback = NULL, ?int $timeout = 120, array $exclusions = []): void {
if (!$this->filesystem->exists($activeDir)) {
throw new DirectoryNotFoundException($activeDir, 'The active directory does not exist at "%s"');
}
if ($this->filesystem->exists($stagingDir)) {
throw new DirectoryAlreadyExistsException($stagingDir, 'The staging directory already exists at "%s"');
}
$this->fileCopier->copy(
$activeDir,
$stagingDir,
$exclusions,
$callback,
$timeout
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment