-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AddLines] Fix update process to send changes to RecipeUpdate vs make them immediately #988
Conversation
// reset the file content cache | ||
$this->fileContents = []; | ||
$this->executeUnconfigure($recipeUpdate->getOriginalRecipe(), $originalConfig); | ||
$this->executeConfigure($recipeUpdate->getNewRecipe(), $newConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old logic "unconfigured" the original recipe, then configured the new recipe. So we're doing the same, except that we "record" the changes and report them to $recipeUpdate
below instead of actually making the changes now.
} catch (ParsingException $e) { | ||
// if controllers.json is invalid (possible during a recipe upgrade), we can't update the file | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to the PR - but noticed while doing it. We already have this same code in this file to avoid exploding if package.json
can't be parsed due to a conflict.
Thank you @weaverryan. |
Hi!
This was an oversight when I create
AddLinesConfigurator
.During
recipes:update
, the purpose of theupdate()
method in each configurator is to record what the "original" contents of a file would look like from the original recipe & what the "new" contents of a file would look like with the new recipe. Then, LATER, the patcher system creates a diff from these.The
AddLinesConfigurator
was going rogue and updating the files immediately, which caused the "patcher" system later to explode because this file was unexpectedly already modified.The changes are less drastic than they look, as code needed to be moved from some public methods -> private methods.
Cheers!