-
Notifications
You must be signed in to change notification settings - Fork 1
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
Test my user documentation + make a new JSON card #7
Comments
@petecooper thanks for the smd_query card. I've created the corresponding page stub for this on the plugins website as follows: https://plugins.textpattern.com/plugins/smd_query If you can add a 'homepage' entry in the 'repos' section of that card too, you'll then see that appear in the plugins site as a link on the sidebar when it's been committed to this repo and the latest sync has taken place. |
Yep - that's my plan, I'll drip feed in some bits over the day to check it's all playing nicely. |
Great! I'll eventually document the process of getting a new plugin into the plugins site and the process for validating a plugin for a particular Textpattern version. Plan is that validated plugins (and only validated ones) will be used by future Textpattern to allow users to auto-update their plugins via a new JSON card, that is generated by the plugins site itself (a kind of amalgamation of these JSON cards plus the validation flags and endpoints). It's all fairly simple to generate though, so don't worry! |
Great work Phil + Stef (and anyone else involved)! I added a simple library card for one of my plugins. What I wasn't quite sure about:
How do you get the actual description of the plugin into the directory? Does that have to be added manually after the event? Could/should it also be part of the library card? |
I've not tested trying to import a GitHub 'zip' archive - the one available when you click Clone or Download - via the Plugins panel. It might install as a .zip directly, depending on how the author has set the plugin's file structure out. |
Thanks. Ok then, that needs clarifying in the docs, also that for Also, again just for clarification, for
I've updated the library card regarding the php source. The other library cards may also need updating where the zip has been specified, though maybe the |
Ok, thanks for clarifying. I'll amend the cards we've done where necessary and also try to document this in an understandable way. I think we can browse the filetree at a given release tag so that would be where we would need to pick up the php file from. To be honest I was hoping we could just download the release zip and the system could figure out what it needs, but that's probably not going to work in hindsight.
I'd say option two, as preference. There may be cases where a GitHub user doesn't tag their plugins with releases, in which case we maybe would need to use option one. Haven't investigated yet. |
Actually I don't think we can use |
Edit: actually, we don't - ignore me. But the update check stuff happens with |
That would solve it on core, if available, yes. Not sure how that would impact downloading from the site itself though (if we link to raw plugins on GitHub it would probably show them in browser not download). For reference: Or probably better use |
From Txp and the Plugin repo's perspective, it doesn't matter if you link to
That would be nice. I just tried it and it didn't work right now but it could be made to work, IF there's a manifest in the package. At the moment the main problem is that the downloaded file is tagged with the branch name. So the zip file is something like To facilitate this, the Plugins panel looks at the filename and assumes the zip file structure follows:
In GitHub download zips, that's actually:
That means when looking inside the zip for the plugin .php file and the help to display them in the Preview step, the uploader can't find the files. They don't match the expected structure. So we need to be more clever about this. A few ways we could do it:
In short, yes we could handle GitHub .zip files if we tweak the uploader to make fewer assumptions about its structure and defer structural information to the author via an implicit The downside is that if the manifest is wrong, well the plugin won't install. Down to the author to fix. If the manifest is missing or has missing entries, we'll have to do our best to sniff out the files we need based on some conventions that repos such as GitHub employ. EDIT: I don't want to pander to one particular vendor, so the manifest gives us a nice way of letting plugin authors help us to provide a seamless installation experience for users (which plugin authors want, right, with minimal extra work on their part?). Plus, the same manifest helps define stuff for Packagist, doesn't it, so a doubly good reason for using it? Howzat? |
Note that we already support 'help' in the manifest.json file. Here's an example from smd_thumbnail:
All we really need to do is come up with a structure for Textpacks and (maybe) data files and hold that manifest aloft as a shining example of how to do it "right". Then I'll code the uploader on the Plugins panel to read it so we can then use the 'php' endpoint URL as the release's .zip file and be done with it. |
The manifest.json route would be my preferred route too. It's a pretty widely accepted way of describing a package. We can always encourage plugin authors to use it and send PRs where it's not currently in place. Any plugin that doesn't have a manifest I guess would be excluded from auto-updates (maybe we need to flag whether a manifest is available in these JSON cards or on the plugins site?). |
Definitely.
That's a nice end goal. In practice if the endpoint is a .zip file, somewhere it's going to have to be expanded to read the contents and then decide if it's valid or not. It puts load on the Plugin repo to do that, but I'd rather do it there than have everyone's Plugins panels have to check to see if all plugins are valid. Lots of network traffic! For now, let's assume:
Longer term, we can either burden the end user with failings on the plugin author's part or, if we can reasonably decode the plugin's intent, maybe we let it proceed. Without a manifest, some stuff might not be installed if it doesn't conform to a standard naming convention so we need to weigh up whether that's a risk we're willing to expose to end users. If not, then yes, we should find a way to flag this card as "not upgradable" and (perhaps) show this to people on their Plugins panels. If they see a plugin that they really, really want is mangled in some way, it might spur them into action to either contact the author or pop into the forum to see if anyone can patch or maintain it. |
How about this: {
"name": "smd_thumbnail",
"description": "Multiple image thumbnails of arbitrary dimensions",
"version": "0.5.3",
"type": 5,
"author": "Stef Dawson",
"author_uri": "https://stefdawson.com/",
"order": 5,
"flags": 2,
"help": {"file" : ["./README.textile"]},
"code": {"file" : ["./smd_thumbnail.php"]},
"textpack": {"file" : ["./textpack.txp"]},
"data": {"file" : ["./data.txp"]}
} Those last three blocks, however, could be: }
...
"code": {"file" : [
"./src/Functions.php",
"./src/Index.php"
]},
"textpack": {"file" : [
{
"en": "./lang/en.textpack",
"de": "./lang/de.textpack",
"es": "./lang/es.textpack"
}
]},
"data": {"file" : [
{
"lib": "./data/library.js",
"style": "./data/pretty-file.css"
}
]}
} Any better structures? EDIT by Phil: added |
Fine by me. What are your thoughts on a That only affects PHP download though, TXT download doesn't need a manifest. I can code this condition into the plugin site's JSON output. |
|
Just re-looking at @Bloke the manifest, maybe just change the final entry from |
We don't have a |
Ah, OK, but yes I think we should include Rationale and use in core auto-update:
|
Perfect! |
@Bloke got another usage case where we will probably need a JSON entry in cards: |
Oooh, dependencies. Good thinking. Is there anything we can cadge from composer, without the awkward syntax? |
Seems to be a standard syntax:
Not sure if it would be |
That's cool. I'm used to seeing comparators like:
(braces, not square brackets it seems) We could support that syntax if we needed to. Doesn't make it that much trickier to implement, and is fairly beneficial. From the plugin verify step (and hence, upgrade step), if there are unmet dependencies in your installation, I think we should highlight them but still permit installation. It's annoying to be told "you can't install this because you don't have such-and-such available" so I think a warning is sufficient and you can then fulfill that dependency yourself prior to enabling/using the plugin. |
OK, added that to the plugin in question: a69fcd3 |
Sweet. I'll factor that into the plugin class next time I have a stab at the uploader/importer. |
@Bloke great! Can you please supply me some code to go in here that can grab any |
As a starter: if (!empty($json->require)) {
foreach ($json->require as $rplug => $rver) {
$vars['require-plug-name'] = '<txp:variable name="json-require-plugin">'.txpspecialchars($rplug).'</txp:variable>';
preg_match('/([\<\=\>]+)?([\d.]+)/', $rver, $matches);
$matchType = 'equal';
switch ($matches[1]) {
case '>':
$matchType = 'greater than';
break;
case '>=':
$matchType = 'at least';
break;
case '<':
$matchType = 'less than';
break;
case '<=':
$matchType = 'no greater than';
break;
case '=':
default:
$matchType = 'equal';
break;
}
$plain_ver = $matches[2];
$vars['require-plug-match'] = '<txp:variable name="json-require-match">'.txpspecialchars($matchType).'</txp:variable>';
$vars['require-plug-version'] = '<txp:variable name="json-require-version">'.txpspecialchars($plain_ver).'</txp:variable>';
}
} But that only works if there's one entry in the But see if that suits your needs for now and we'll advance it if necessary. EDIT: Also doesn't take into account alpha/beta/rc versions and stuff like that. |
Closing this issue as all stuff discussed within is now done. Any new discussions can be had in new issues. Thanks for the feedback all. |
Forum announcement about plugins site being live: https://forum.textpattern.com/viewtopic.php?id=50877 |
Hi @Bloke @petecooper @bloatware @jools-r - hope you are all well?
We are getting closer to launching a new plugins site 🎉! To that end, can you please (when you get a spare moment) peruse the README file of this repo for understandability, typos and/or missing info and let me know if you spot anything amiss.
If you could also attempt to fill out a new plugin JSON card for an existing Textpattern plugin that doesn't yet appear in the
library-of-plugins
that would be wonderful. I think you all have direct write access to this repo but if not then just shout and I'll provide.Once the above is done successfully, I can demonstrate the process of how these cards are then used to power the plugins site. Then we can all retire as millionaires1.
Thanks for your time.
1 payment not guaranteed.
The text was updated successfully, but these errors were encountered: