-
Notifications
You must be signed in to change notification settings - Fork 446
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
feat: expose integer Tutor version parts to templates #1060
Conversation
For some context, this is related to a question that I brought up during the Tutor Users' Group about writing plugins that support multiple Tutor versions. We're currently doing something along the lines of...
But having major/minor/patch versions available to the context as integers would allow more precision and flexibility. |
@michaelwheeler I'd like to understand better your use case. Have you considered having multiple branches for your plugin, one for every major release? |
In our team, managing multiple branches for our plugins felt like more overhead than adding an occasional conditional. We also think it will slightly simplify the process of upgrading to a newer named release. |
I think this would useful to have as an option for plugin authors, particularly for cases where the plugins don't change that much between releases. |
Right. I'm still not sure if it makes sense to add these settings to Tutor core. You do know that you could define these variables in your own plugin by adding a callback to the |
I didn't know that! It still feels to me like Tutor should provide the variable, since the version is a property of Tutor itself, but if that's undesirable for other reasons then maybe |
6c2faae
to
0758f55
Compare
Sorry for the delay @michaelwheeler. I think this is ready to go. Can you review it and try it out with one of your plugins? |
Yep, thanks! I'll try to take a look before the end of next week. |
Hey @kdmccormick, I tested this out and things work as expected from my perspective. Thanks! |
@michaelwheeler Would you have any objection to me removing My thinking is that it would be nice, as maintainers, to have some flexibility with the patch version. We don't currently use alpha/beta suffixes or release candidates ( |
No objection @kdmccormick. In practice I suspect I would only ever be using |
We expose the TUTOR_MAJOR_VERSION and TUTOR_MINOR_VERSION template variables, parsed from TUTOR_VERSION. This is convenient for maintainers of plugins which target multiple Tutor/Open edX versions. We do not expose TUTOR_VERSION_PATCH because (1) plugins shouldn't really need to look at the PATCH version and (2) we don't want to prevent Tutor from ever using non-integer patch suffixes (like alpha, beta, rc, etc.) if there were ever a need for that.
0758f55
to
dbe51d4
Compare
@michaelwheeler