Skip to content
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

/devmodules question #45

Open
4orever opened this issue Dec 4, 2014 · 3 comments
Open

/devmodules question #45

4orever opened this issue Dec 4, 2014 · 3 comments

Comments

@4orever
Copy link

4orever commented Dec 4, 2014

I like your module structure. But how do you organize your code for development?
There is ./devmodules dir in the project. I think you put source of related modules there and change config for using them instead of ./vendor during development, do you? What is the best way to make it automatically with composer?

I ask this question on StackOverflow with some comments and my assumptions. Please, give me an advise:
http://stackoverflow.com/questions/27300366/getting-development-copy-of-zf2-module

@shipleyr
Copy link
Contributor

shipleyr commented Dec 8, 2014

The devmodules can be a little tricky. If you put a module into the devmodules folder you need to remove it from composer because the composer autoloader takes priority over EVERYTHING! lol. That brings it's own set of issues however... some modules are a dependency of others so if you remove it from composer it may cause dependency resolution problems. For example SpeckUserAddress requires SpeckAddress and if you want to work on speck Address in the devmodules folder you need to put all the things that depend on it in there as well.

Personally I tend to not use that and tell composer to prefer source and then I can work directly in the vendor directory. I agree it's not the most practical way around it.

@4orever
Copy link
Author

4orever commented Dec 9, 2014

Thank you for reply.
For me I get the next solution:

  1. Add somethink like that to "script"-section in composer.json:
    "devmodules": [
        "mkdir devmodules",
        "git clone git://github.com/4orever/ppc-auth/           devmodules/ppc-auth",
        "git clone git://github.com/4orever/ppc-backend/        devmodules/ppc-backend",
        "git clone git://github.com/4orever/ppc-backend-client/ devmodules/ppc-backend-client",
        "git clone git://github.com/4orever/ppc-dev-mode/       devmodules/ppc-dev-mode",
        "git clone git://github.com/4orever/ppc-main-assets/    devmodules/ppc-main-assets",
        "rm -rf vendor/4orever"
    ]
  1. And add "autoload-dev":
     "autoload-dev": {
         "psr-4": {
            "PpcMainAssets\\":  "devmodules/ppc-main-assets/",
            "PpcBackend\\":     "devmodules/ppc-backend/src",
            "PpcAuth\\":     "devmodules/ppc-auth/src"
        },
        "classmap":[
            "devmodules/ppc-backend/Module.php",
            "devmodules/ppc-backend-client/Module.php",
            "devmodules/ppc-auth/Module.php"
        ]
     }
  1. For production just use: composer install --no-dev. I haven't test it, but I suppose that 'autoload-dev' must be ignored. If not run composer dumpautoload --no-dev
  2. For development: composer install and composer devmodules

I don't like to use standard ./vendor folder made by composer because it's not connected to git by default. I prefer git clone in the folder I need.

I hope it would be usefull.

@Xerkus
Copy link
Contributor

Xerkus commented Dec 9, 2014

there is alternative option, read http://blog.naderman.de/2014/02/04/composer-skipping-a-dependency/

That way composer dependencies are resolved as normal but package is not installed, all you need to do from there is to drop module into devmodules folder and enable in app config.

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

No branches or pull requests

3 participants