Skip to content

Commit

Permalink
Merge pull request #40 from zeshanziya/config-files
Browse files Browse the repository at this point in the history
  • Loading branch information
hussainweb authored May 13, 2024
2 parents d900186 + 307038d commit cc19a25
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/Composer/AxelerantDQCPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,17 @@ public function copyFilesToProjectRoot(Event $event): void
}
$pluginDirectory = realpath(__DIR__ . '/../../');

// Check if config already present.
$configPresents = [];

// Copy each file to the project root.
$configFiles = ['grumphp.yml.dist', 'phpcs.xml.dist', 'phpmd.xml.dist', 'phpstan.neon.dist'];
foreach ($configFiles as $filename) {
$sourcePath = $pluginDirectory . '/' . $filename;
$destinationPath = $destination . '/' . $filename;
if (file_exists($destinationPath)) {
$configPresents[] = $filename;
$this->io->write('<fg=yellow>Configuration file ' . $filename . ' is overwritten. Please watchout for any change!</fg=yellow>');
}
copy($sourcePath, $destinationPath);
}

// Output message indicating the files are copied with warning if exists.
if (!empty($configPresents)) {
$this->io->write('<fg=yellow>Configuration files (' . implode(', ', $configPresents) . ') are overwritten. Please watchout for any changes!</fg=yellow>');
}
else {
$this->io->write('<fg=green>Configuration files are copies successfully.</fg=green>');
}
$this->io->write('<fg=green>Configuration files are copied successfully.</fg=green>');
}

/**
Expand Down

0 comments on commit cc19a25

Please sign in to comment.