mnsami / composer-custom-directory-installer

A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.
https://packagist.org/packages/mnsami/composer-custom-directory-installer
MIT License
138 stars 27 forks source link

Problems with composer-custom-directory-installer #7

Closed pablor closed 8 years ago

pablor commented 10 years ago

Hi @mnsami, Fisrt of all thanks for your work! I'm trying to use your installer and I have some problems. With that composer.json everything works OK:

{
    "name": "test/testign",
    "description": "Tetsting",
    "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:mnsami/composer-custom-directory-installer.git"
        }
    ],
    "require": {
        "php": ">=5.3",
        "mnsami/composer-custom-directory-installer": "1.0.*",
        "monolog/monolog": "*"
    },
    "extra": {
        "installer-paths": {
            "./monolog/": ["monolog/monolog"]
        }
    },
    "minimum-stability": "dev"
}

The monolog library was placed in the ./monolog directory as expected. But, if I use my own repo, it doesn't place the pablor/test-library inside the ./monolog directory.

{
    "name": "test/testign",
    "description": "Testing",
    "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:mnsami/composer-custom-directory-installer.git"
        },
        {
            "type": "vcs",
            "url": "https://github.com/pablor/test-library"
        }
    ],
    "require": {
        "php": ">=5.3",
        "mnsami/composer-custom-directory-installer": "1.0.*",
        "pablor/test-library": "*",
        "monolog/monolog": "*"
    },
    "extra": {
        "installer-paths": {
            "./monolog/": ["pablor/test-library"]
        }
    },
    "minimum-stability": "dev"
}

Any idea about waht I'm doing wrong? Thanks!

pablor commented 10 years ago

Some updates :) If I execute composer twice, then it works more of less. My repo is copied to /monlog directory and also it remains in /vendor directory. The final directory structure is something like that:

|- composer.json
|- composer.lock
|- monolog
|  |- test-library (my repo files)
|- vendor
|  |- composer
|  |- mnsami
|  |- monolog
|  |- pablor
|  |- psr
|  |- autoload.php

It's very strange that it works only in the second composer update...

mnsami commented 9 years ago

hello @pablor

sorry it took me time to answer you. But I took your composer.json content and ran composer install on it, I had no problems finding your repo content inside the monolog folder. In other words, the content of your repo was downloaded successfully in the right directory.

may be something happened during the composer install?

can you try again and tell me?

thanks

bpacholek commented 9 years ago

hi @pablor,

you are most likely using an old composer as I had the same before doing composer.phar self-update

kind regards, Bartosz

mnsami commented 8 years ago

Hi @pablor

After doing some investigations, you package is of type project and composer ProjectInstaller handles anything with type project to be installed in the root of clean directory.

Check https://github.com/composer/composer/blob/master/src/Composer/Installer/ProjectInstaller.php#L61

The best thing you can do, is change the type of your composer package to something that the composer installers can handle.

The idea with my plugin here, is to provide customization for the composer installers without altering how composer function or doing some dirty hacks.