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

Preserve existing files in custom folder #8

Closed rasmustaarnby closed 9 years ago

rasmustaarnby commented 10 years ago

Hi

First off, great plugin and very useful.

Lets say I have something like the following. I need to get two seperate language files and decompress them to the same folder.

It works fine in the sense that it does it with both but it empties the folder before each. It is not an option to make seperate subfolders, da_DK, de_DE etc. I need the files in the same folder.

Is it possible to keep the existing files in the folder and not overwriting them?

The files are of course named differently.

"repositories": [
    {
        "type": "composer",
        "url": "http://wpackagist.org"
    },
    {
      "type": "git",
      "url": "git@github.com:mnsami/composer-custom-directory-installer.git"
    },
    {
        "type": "package",
        "package": {
            "name": "wordpress-language/da_DK",
            "version": "4.0",
            "type": "wordpress-plugin",
            "dist": {
              "type": "zip",
              "url": "http://downloads.wordpress.org/translation/core/4.0/da_DK.zip"
            }
        }
    },
    {
        "type": "package",
        "package": {
            "name": "wordpress-language/de_DE",
            "version": "4.0",
            "type": "wordpress-plugin",
            "dist": {
              "type": "zip",
              "url": "http://downloads.wordpress.org/translation/core/4.0/de_DE.zip"
            }
        }
    }
]

"require": {
    "php": ">=5.3.2",
    "johnpbloch/wordpress": "4.0.*",
    "mnsami/composer-custom-directory-installer": "1.0.*",
    "wordpress-language/da_DK": "*",
    "wordpress-language/de_DE": "*",
},

"installer-paths": {
        "./frontend/wp-content/languages/": ["wordpress-language/da_DK"],
        "./frontend/wp-content/languages/": ["wordpress-language/de_DE"],
    }
mnsami commented 9 years ago

Hello @rasmustaarnby , I'm really sorry for the late reply.

The issue is, when the installer-paths is loaded into the memory it is converted into an associative array and since ./frontend/wp-content/languages/ is a key for 2 values "wordpress-language/da_DK" and "wordpress-language/de_DE" and the latest value overwrites the previous.

So, I can not really do anything about it :)

One more thing I found, it is not a good practice to use uppercase in your package name, as composer convert them to lowercase under the hood.