afragen / wp-dependency-installer

A lightweight class to add to WordPress plugins/themes to automatically install plugin dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove json "host" arg

mgibbs189 opened this issue · comments

I think we should auto-detect the host from the uri arg. @afragen what do you think?

{
    "name": "GitHub Updater",
    "slug": "github-updater/github-updater.php",
    "uri": "https://github.com/afragen/github-updater",
    "branch": "master",
    "optional": false,
    "token": null
},

We can autodetect but, my logic for not was, why go through an extra function or two to figure it out when we can have the developer just declare it. The dev is already entering the other data in the JSON.

IMO it's just a matter of convenience. Seems counter-productive to require the host, when we can easily grab it from the uri with minimal extra logic.

E.g. https://github.com/afragen/wp-dependency-installer/pull/5/files#diff-752528f8a0e18edf2b3f3f997c8ecaaaR117

The benefit is that you would then allow for a shortened input of just owner/repo for the URI. This shortened input is used for GHU and WP Pusher. I'm not sure if there are other similar products but since those 2 allow it devs might be used to a similar input.

There's no real downside, it's just part of the json spec. Maybe?

@afragen Let's support both then 😉

uri could be either either a full URL or partial. If the user doesn't specify a host, we'll auto-detect.

Sounds like a plan.

854b7b2

This should account for using host or not and shorthand <owner>/<repo> as uri