-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect and configure Git updates from plugin headers only #16
Conversation
I for one would like to see a separate header line for this, perhaps I like what you're after here though, I'm getting tired of changing two files :) |
I think having the URI and branch in their own lines makes sense though could also do something like below and just build the urls on the fly, but I can see how having the full github url could be useful.
|
Could be useful, as long as they are all within the plugin's headers themselves. We'll need to wait and see exactly what @jkudish wants to do here. |
Configuration
I'm partial to this format, for several reasons:
Multiple Git servicesThere's not much reason updates need to be restricted to just coming from Github-hosted repositories. I've already written code for private repos, and have researched writing connectors for generic Gitweb hosting. For example:
Private ReposThis format makes it trivial to support private repositories. Again, without additional header keys to memorize. Private repos, one with Github oAuth, another with HTTP authentication:
Creating individual keys for every minor piece of information, like user, repo, and branch, password, or access token, then varied for different services, would have us up to 15 keys, just from the examples so far. I don't see any reason for that complexity, when the specification for a repository URL already contains all the necessary information in a standardized format, and PHP already has a very well-defined function for breaking a URL down into its individual parts. No need to force people to do a computer's job. Tags work for any branchAFAIK, there's not any reason to specify a branch because the Git method for identifying a new version, tags, is a global commit idenifier. That is, if I tag a commit as version As an example, take a look at the Github API tags output for this repo. Branches don't come into play, because tags are global. |
Howdy @pdclark, thanks for the contribution, this is awesome! I'll have to give your pull requests a more in-depth look-over in the next few days before I merge them in. It's on my todo list so I'll get to it asap. Thanks :) |
Thanks for the positive feedback @jkudish ! I'm looking forward to hearing what you think. I realize the two merges aren't compatible with each other yet, but I wanted to get your approval before putting the time into merge them into a single final product. I'm happy to help do that– don't at all think I'm expecting you to stitch the two feature branches together! |
+1 |
Howdy @pdclark et al, This is the format I'd like to go with:
If I like the consistency that this format provides and as previously explained, it reduces the likeness for errors. I don't however think that including private repos this way with the @pdclark can you make this happen, and work in coordination with your other pull request, and I'll gladly merge this in :) |
Actually never mind about the branch thing, you are right, tags are best used in this case regardless of the branch and it's a much better approach. |
Whew! Thanks for updating that so quickly! I was starting to stress out about branches again! On the Github URI line, it's a fairly minor thing, but could we use As for |
Wouldn't the API used for each be different anyways? I'd rather stick to specific for now and use
I realize that the URL built is the same but I think from a security and maintainability point of view, it's better to generate the oAuth token on the fly instead of including it directly in the plugin's code that way. I guess, I just don't want to "advertise" doing it that way, but as you said, you could do it that way regardless :) |
Github vs. GitThe API would be different, but transparent to the plugin. It's very similar to how wp_remote_get() works -- There's one generic wrapper class, but depending on what's requested and available, it transparently chooses between about 5 different HTTP transfer methods that all operate differently, but respond to the wrapper class in the same way. Consider this rough implementation from updater.php:170 in my f/gitweb branch:
In this case, There are a few reasons why I prefer this approach over a filter. The third merits further clarification, so I've expanded it below.
While github.com is certainly the most popular Git hosting service, there are certainly many others. I think the similarity in names makes it tempting to equate the two, but imagine if we were implementing any other update service for a version control system. Would we use I know this may seem extremely nit-picky, but please consider it in the context of every time you've seen misuse of oAuthAre you saying to add another different config line, like |
Fine, I'm okay with just having
No, I don't think that the access token should be in the plugin header's at all, and only set via an option (which can be filtered if someone wants to set it permanently) |
Setting oAuth authentication through an option hadn't occurred to me, but now that you mention it, it's obviously a better solution. It'll take me more time to setup the setup assistant to serve dual purposes -- generating a key and entering keys for different plugins. I'll put some thought into it while cleaning up that pull request. |
Please reopen a new merge request if you have new work to share. Please try to keep things small and focused as that makes it easier to review and merge. |
Good call. I'll squeeze it down to header config only when I get back to it. |
I came back to this looking at how to rewrite the merge, thinking that I had included features besides configuration from the header, but then realized that it was only that one thing. With the other merge still pending, I'm not sure what to take as a next step. Was this merge rejected because it wasn't compatible with the other? Or because the changes were too significant? I'd like to see single-line config merged into your copy, but by it's nature, it's a significant change. It'd be helpful for me in trying to meet your criteria if you could provide specific guidance on what you're looking for. What form would this change need to take for you to consider it for merge? |
If I remember correctly (sorry I could be wrong here), but the patch didn't apply cleanly against the repo. Other than that, it does seem like the changes attached to this pull request did change several things beyond just the way config is loaded |
That may be the case; some of it was organizing in preparation for f/gitweb, which allows multiple transports depending on which Git service is being used. In reworking it, should I go for a lean patch on your current master, or plan on f/oauth being merged in? |
current please On 2012-09-23, at 9:36 PM, Paul Clark [email protected] wrote: That may be the case; some of it was organizing in preparation for In reworking it, should I go for a lean patch on your current master, or — |
If I'm not able to rewrite until next weekend or the weekend after, is there a chance f/oauth will be merged in then? |
I need to review those changes. I doubt I will get to it this week. Let's On 2012-09-23, at 9:42 PM, Paul Clark [email protected] wrote: If I'm not able to rewrite until next weekend or the weekend after, is — |
@mastef Bitbucket support didn't end up getting merged into Joey's plugin, but I kept maintaining and using the code in the year since this pull request. It's now available publicly with a guide at https://github.com/brainstormmedia/git-plugin-updates |
This sets WPGitHubUpdater up as a self-configuring plugin that can either enabled in WordPress or included in another plugin.
Either way, the class enables Github updates for all plugins that use a github.com repository address as the Plugin URI in the header. For example:
The class doesn't just work for one plugin -- it searches and enabled all plugins. If searching Plugin URI would be inadvisable, an additional header item, like
Git URI
could be used instead.To further reduce configuration, the plugin gets the latest version number and zip url from repository tags. The only required setup is a github repository URL.