Skip to content

Fixed not working "--force" option if you want to reinstall a recipe#684

Closed
malteschlueter wants to merge 1 commit intosymfony:masterfrom
malteschlueter:bugfix/reinstall-with-force
Closed

Fixed not working "--force" option if you want to reinstall a recipe#684
malteschlueter wants to merge 1 commit intosymfony:masterfrom
malteschlueter:bugfix/reinstall-with-force

Conversation

@malteschlueter
Copy link
Copy Markdown
Contributor

Sometimes it's necessary to reinstall a recipe but actually it's not possible if there is not update for a recipe. Also with the --force option Flex won't reinstall/execute the recipe. Only if there is a update for a recipe.

I figured out that the $recipes in Flex.php#L466 are empty. It can't find/collects the recipe because the existing ref and the "reinstall" ref are same, see in Flex.php#L817.

So i tried to fix it but to be honest i'm not sure it's a good solution.


What do you think?


To reproduce:

  1. Create a new directory
  2. Execute composer require symfony/flex
  3. Execute composer require symfony/apache-pack
  4. Delete or truncate file public/.htaccess
  5. Execute composer recipes:install symfony/apache-pack --force

@malteschlueter malteschlueter changed the title Fixed not working "--force" option if you want to reinstall the recipe Fixed not working "--force" option if you want to reinstall a recipe Oct 6, 2020
Comment thread src/Flex.php
@nicolas-grekas
Copy link
Copy Markdown
Member

nicolas-grekas commented Oct 13, 2020

I'm mixed on this one. This will create more changes than required when syncing recipes, increasing the burden of the task.
You can achieve the same by first removing symfony.lock, then running with --force.

@nicolas-grekas
Copy link
Copy Markdown
Member

nicolas-grekas commented Oct 13, 2020

Sorry I closed by mistake.

@malteschlueter
Copy link
Copy Markdown
Contributor Author

malteschlueter commented Oct 14, 2020

You can achieve the same by first removing symfony.lock, then running with --force.

You're right in the end the results are the same but i think this is only a workaround.

For example in the help message of the --force option it says Ignore the "symfony.lock" file and overwrite existing files.


I'm mixed on this one. This will create more changes than required when syncing recipes, increasing the burden of the task.

Do you mean with it will create more changes than required in the project source code or in the source code of flex?

Today i checked the recipes of a project and there was a update for the symfony/framework-bundle available.

If you're running composer recipes:install symfony/framework-bundle you get the message:

Recipe(s) already installed for: symfony/framework-bundle
Re-run the command with --force to re-install the recipes.

No recipes to install.

Then i run the command again with the option --force and it does exactly what I'm expecting after I read the help/info message. It re-installs the complete recipe and overrides all files or add missing ones. But that is easy to solve if you're using i.e. Git :D :)

nicolas-grekas added a commit that referenced this pull request Nov 5, 2020
…ommand (nicolas-grekas)

This PR was merged into the 1.9-dev branch.

Discussion
----------

Fix description of flag "--force" of the recipes:install command

As spotted in #684 (comment)

Commits
-------

baaf062 Fix description of flag "--force" of the recipes:install command
tgalopin pushed a commit to tgalopin/flex that referenced this pull request Dec 3, 2020
@xabbuh
Copy link
Copy Markdown
Member

xabbuh commented Jul 8, 2021

Did #756 solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants