johnpbloch / wordpress-core-installer

A composer installer for WordPress core so I can stop saying core is a wordpress-plugin type package.
https://packagist.org/packages/johnpbloch/wordpress-core-installer
GNU General Public License v2.0
207 stars 49 forks source link

Conflict with Composer/Installers? #5

Closed crazyjaco closed 10 years ago

crazyjaco commented 10 years ago

Installing WordPress Core and a theme.

If I set the core install dir to "./" to install to root it seems to error on loading the composer/installers dependency after core is loaded and it tries to install the theme.

Specifying a subdirectory works fine. It only seems to conflict when it installs to the root. Looks like the dependency (installers) doesn't even load in the directory structure, but it looks like its being downloaded according to the command output.

This was an experiment to see if I could get an install going in a more traditional manner than the WordPress skeleton.

crazyjaco commented 10 years ago

Oops. I missed Rarst's previously closed issue for this. Dont mind me. :)

johnpbloch commented 10 years ago

@crazyjaco I don't think that's the same issue. You're referring to #3 right? That was more specifically about a code conflict in which composer/installers was trying to install wordpress-core packages without supporting them.

I would imagine installing a package in the root directory would be problematic, since that package is never the only thing in that directory. I don't think composer supports having installation directories inside other installation directories, although to be honest I've never tried.

But the one thing I can think of immediately that would make it pretty much impossible to pull off putting WordPress in the root directory as a dependency is that it would have to overwrite the root composer.json file.

What makes a lot more sense to me as a workflow for getting a more traditional WordPress setup is to use create-project:

composer create-project johnpbloch/wordpress my-new-website

That does install the package in the root directory as a new composer project. One would lose the ability to manage the WP versions with composer, but I just don't see any ways around that.

crazyjaco commented 10 years ago

After looking at this a little more last night, I agree. It is a different issue. I haven't had much time lately to play around with a traditional setup until now.

In my experments last night, it didn't look like the composer.json file was getting overwritten. I think thats because WordPress core doesn't have a composer.json file to begin with and I had everything in-line as a repo package entry.

Thanks for suggesting create-project. I'll check it out and let you know.

crazyjaco commented 10 years ago

FYI, this is the repo entry I was referring to above:

    {
        "type"   : "package",
        "package": {
            "name"   : "crazyjaco/wordpress",
            "type"   : "wordpress-core",
            "version": "3.7",
            "dist"   : {
                "url" : "http://wordpress.org/wordpress-3.7.zip",
                "type": "zip"
            },
            "source" : {
                "url"  : "github:/WordPress/WordPress",
                "type" : "git",
                "reference": "3.7"
            },
            "require": {
                "johnpbloch/wordpress-core-installer": "0.2"
            }
        }
    }

(github.com is aliased in my ssh config file to github:) Was there any particular reason you decided to fork core and add the composer.json file to it instead of taking this approach?

johnpbloch commented 10 years ago

The shim I wrote for core had issues that prevented it from working seamlessly and I wanted a seamless experience. My fork of WordPress is listed on packagist, which means it's already available to anybody with composer. I find adding custom repositories to not only be tedious and burdensome, but to be something I try to avoid whenever possible. For one thing, any package that has to define a custom repository can not simply be added to another project as a dependency, since its repos have to be added to that project's composer manifest.