Skip to content

Commit

Permalink
Relates to #121: Print messages when TUF is enabled and during operat…
Browse files Browse the repository at this point in the history
…ions.
  • Loading branch information
ergonlogic committed Oct 28, 2024
1 parent 05a6d3e commit eba5602
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private function getRepositoryFromEvent(PreFileDownloadEvent|PostFileDownloadEve
*/
public function activate(Composer $composer, IOInterface $io): void
{
$io->debug('TUF integration enabled.');
$io->write('<info>TUF integration enabled. This may impact performance.</info>');

// By the time this plugin is activated, several repositories may have
// already been instantiated, and we need to convert them to
Expand Down
6 changes: 3 additions & 3 deletions src/TufValidatedComposerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct(array $repoConfig, IOInterface $io, Config $config,
$loader = new SizeCheckingLoader($loader);
$this->updater = new ComposerCompatibleUpdater($loader, $storage);

$io->info("[TUF] Packages from $url are verified by TUF. This may impact performance.");
$io->write("<info>[TUF] Packages from $url are verified by TUF.</info>");
$io->debug("[TUF] Metadata source: $metadataUrl");
} else {
// @todo Usability assessment. Should we output this for other repo types, or not at all?
Expand Down Expand Up @@ -253,7 +253,7 @@ public function validateComposerMetadata(string $url, Response $response): void
$target = $this->getTargetFromUrl($url);
$this->updater->verify($target, Utils::streamFor($response->getBody()));

$this->io->debug("[TUF] Target '$target' validated.");
$this->io->write("<info>[TUF] Target '$target' validated.</info>");
}
}

Expand Down Expand Up @@ -284,7 +284,7 @@ public function validatePackage(PackageInterface $package, string $filename): vo
$resource = Utils::tryFopen($filename, 'r');
$this->updater->verify($options['tuf']['target'], Utils::streamFor($resource));

$this->io->debug("[TUF] Target '" . $options['tuf']['target'] . "' validated.");
$this->io->write("<info>[TUF] Target '" . $options['tuf']['target'] . "' validated.</info>");
}
}
}
2 changes: 1 addition & 1 deletion tests/ComposerCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testRequireAndRemove(): void
// debugging messages generated by the plugin, which will be logged to STDERR.
$debug = $this->composer(['require', 'drupal/core-recommended', '--with-all-dependencies', '-vvv',])
->getErrorOutput();
$this->assertStringContainsString('TUF integration enabled.', $debug);
$this->assertStringContainsString('TUF integration enabled. This may impact performance.', $debug);
$this->assertStringContainsString('[TUF] Root metadata for http://localhost:8080 loaded from ', $debug);
$this->assertStringContainsString('[TUF] Packages from http://localhost:8080 are verified by TUF.', $debug);
$this->assertStringContainsString('[TUF] Metadata source: http://localhost:8080/metadata/', $debug);
Expand Down

0 comments on commit eba5602

Please sign in to comment.