So I'm currently playing about with Composer and Magento, and having a bit of trouble getting the magento-composer-installer to play nice.
Firstly, my composer.json files!
Module:
{
"name":"namespace/module",
"description":"Desc",
"type": "magento-module",
"suggest":{
"magento-hackathon/magento-composer-installer": "*"
},
"extra":{
"map":[
[
"app/etc/modules/Namespace_Module.xml",
"app/etc/modules/Namespace_Module.xml"
],
[
"app/code/community/Namespace/Module/",
"app/code/community/Namespace/Module/"
]
]
}
}
Project:
{
"require": {
"magento/core":"1.9.1.0",
"magento-hackathon/magento-composer-installer": "*",
"namespace/module":"dev-master"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.firegento.com"
},
{
"type": "vcs",
"url": "/home/luker/namespace/module"
}
],
"extra": {
"magento-root-dir":"./",
"magento-deploystrategy":"copy",
"magento-force": true,
"magento-deploy-sort-priority": {
"namespace/module": "200"
}
}
}
This setup does not work.
However, if I change the module to "require" magento-composer-installer instead of "suggest" it, then it works and gets copied into the code base correctly.
After reading the docs, I know this is not the correct thing to do.
What have I missed?
(To be honest, not entirely sure what I'm achieving with my magento-force and priority extras. I've just been hacking about)
Thanks
1 Answer 1
the suggest is the right choice, at least in theory. Because there are a lot of different installers out there today, and it should be easy to switch or even use none of them, this would not work, if modules all require the installer, or even different installers.
The problem is, that if you install both together, there are cases where the installer is not installed at first, which causes other modules to not get deployed.
this is fixed in the current alpha of version 3, but it needs more testers to find problems caused by the big refactoring.
You now have a few different ways to solve this problem.
- Use require, even if it is not best practice
- use one of the other installers, the AOE one for example is suggested by a lot of people
- use the version 3 of the installer, even if it is still in alpha state
-
Neato! That's kind of what I was expecting. You can see I was trying to force some sort of priority in the project composer.json. What should I
requireto get the alpha version 3?Luke Rodgers– Luke Rodgers2014年12月17日 09:51:52 +00:00Commented Dec 17, 2014 at 9:51 -
1on packages.firegento.com/#!/magento-hackathon/… you can see all the available version. "3.0.0-alpha.2" is the most current release, but "3.0@alpha" or "~3.0@alpha" should also work. also look into getcomposer.org/doc/faqs/… and getcomposer.org/doc/01-basic-usage.md#package-versionsFlyingmana– Flyingmana2014年12月17日 14:44:47 +00:00Commented Dec 17, 2014 at 14:44
-
Awesome! I'll try this later on and get back to you :)Luke Rodgers– Luke Rodgers2014年12月17日 15:32:47 +00:00Commented Dec 17, 2014 at 15:32
3.0series is taking, have voiced my opinions here github.com/Cotya/magento-composer-installer/issues/…