diff --git a/src/RecipeCommandBehaviour.php b/src/RecipeCommandBehaviour.php
index 017d28f..aeabd09 100644
--- a/src/RecipeCommandBehaviour.php
+++ b/src/RecipeCommandBehaviour.php
@@ -74,6 +74,9 @@ trait RecipeCommandBehaviour
throw new InvalidArgumentException("Invalid composer.json data with error: " . json_last_error_msg());
}
file_put_contents($path, $content);
+
+ // Reset composer object
+ $this->resetComposer();
}
/**
@@ -235,7 +238,7 @@ trait RecipeCommandBehaviour
foreach ($installedRecipe->getRequires() as $requireName => $require) {
$requireVersion = $require->getPrettyConstraint();
$output->writeln(
- " * Inline dependency {$requireName} as {$requireVersion}"
+ " - Inlining {$requireName} ({$requireVersion})"
);
$composerData['require'][$requireName] = $requireVersion;
}
diff --git a/src/RecipeInstaller.php b/src/RecipeInstaller.php
index b679ce7..b0fc018 100644
--- a/src/RecipeInstaller.php
+++ b/src/RecipeInstaller.php
@@ -29,17 +29,33 @@ class RecipeInstaller extends LibraryInstaller {
protected function installProjectFiles($recipe, $sourceRoot, $destinationRoot, $filePatterns)
{
$fileIterator = $this->getFileIterator($sourceRoot, $filePatterns);
+ $any = false;
foreach($fileIterator as $path => $info) {
$relativePath = substr($path, strlen($sourceRoot));
$destination = $destinationRoot . $relativePath;
- // Only copy non-existent files
- if (file_exists($destination)) {
- continue;
+ // Write header
+ if (!$any) {
+ $this->io->write("Installing project files for recipe {$recipe}:");
+ $any = true;
+ }
+
+ // Check if file exists
+ if (file_exists($destination)) {
+ if (file_get_contents($destination) === file_get_contents($path)) {
+ $this->io->write(
+ " - Skipping $relativePath (existing, but unchanged)"
+ );
+ } else {
+ $this->io->write(
+ " - Skipping $relativePath (existing and modified in project)"
+ );
+ }
+ } else {
+ $this->io->write(" - Installing $relativePath");
+ $this->filesystem->ensureDirectoryExists(dirname($destination));
+ copy($path, $destination);
}
- $this->io->write("Installing recipe $recipe file $relativePath");
- $this->filesystem->ensureDirectoryExists(dirname($destination));
- copy($path, $destination);
}
}
diff --git a/src/RecipePlugin.php b/src/RecipePlugin.php
index addc2cd..22df895 100644
--- a/src/RecipePlugin.php
+++ b/src/RecipePlugin.php
@@ -28,6 +28,7 @@ class RecipePlugin implements PluginInterface, EventSubscriberInterface, Capable
public static function getSubscribedEvents()
{
return [
+ 'post-package-update' => 'installPackage',
'post-package-install' => 'installPackage',
];
}