outlandishideas / wpackagist

WordPress Packagist — manage your plugins with Composer
https://wpackagist.org
MIT License
701 stars 71 forks source link

Installing as mu plugin #16

Closed blocka closed 10 years ago

blocka commented 10 years ago

How would you handle a situation where you wanted a plugin to land in mu instead of plugins?

Rarst commented 10 years ago

Use Custom Install Paths to redirect their packages into desired folder.

blocka commented 10 years ago

I tried

"extra": {
    "installer-paths": {
        "public/content/mu-plugins/{$name}": ["wpackagist/unfiltered-mu"]
    }

and then

composer update wpackagist/unfiltered-mu

But it insists on sticking it in the plugins folder...

I tried removing the plugin completely, and trying again, and that didn't work either.

Rarst commented 10 years ago

Quick test with this worked fine for me on install.

{
    "name"        : "rarst/mu-test",
    "repositories": [
        {
            "type": "composer",
            "url" : "http://wpackagist.org"
        }
    ],
    "require"     : {
        "wpackagist/unfiltered-mu": "*"
    },
    "extra"       : {
        "installer-paths": {
            "public/content/mu-plugins/{$name}": ["wpackagist/unfiltered-mu"]
        }
    }
}
blocka commented 10 years ago

You're starting from scratch, and I'm starting from an existing composer.json.

Is it not working because i'm calling update instead or install? I can't run install because of my composer.lock file. Is there a way to just run the install part of this again?

Rarst commented 10 years ago

It might be since paths are probably captured in lock. If deleting plugin's folder isn't helping I'd try deleting lock and running install.

blocka commented 10 years ago

Sorry about this...I had another entry in installer-paths for "public/content/mu-plugins/{$name}"

kraftner commented 10 years ago

Just in case anyone had the same issue: If you want force a plugin to be a mu-plugin you need to add the line before the normal plugin path:

"installer-paths" : {
     "public/wp-content/mu-plugins/{$name}": ["wpackagist-plugin/disable-google-fonts"],
     "public/wp-content/plugins/{$name}" : ["type:wordpress-plugin"],
     "public/wp-content/mu-plugins/{$name}": ["type:wordpress-muplugin"],
     "public/wp-content/themes/{$name}" : ["type:wordpress-theme"]
}

As this won't work:

"installer-paths" : {
     "public/wp-content/plugins/{$name}" : ["type:wordpress-plugin"],
     "public/wp-content/mu-plugins/{$name}": ["type:wordpress-muplugin", "wpackagist-plugin/disable-google-fonts"],
     "public/wp-content/themes/{$name}" : ["type:wordpress-theme"]
}
mckelvin commented 8 years ago

@kraftner But this works:

"installer-paths" : {
     "public/wp-content/plugins/{$name}" : ["type:wordpress-plugin"],
     "public/wp-content/mu-plugins/{$name}": ["wpackagist-plugin/disable-google-fonts", "type:wordpress-muplugin"],
     "public/wp-content/themes/{$name}" : ["type:wordpress-theme"]
}

Actually you should put "wpackagist-plugin/disable-google-fonts" prior to "type:wordpress-muplugin".