raiguard / ModernGadgets

Sleek, minimalist, information-dense gadgets for the modern desktop. Inspired by the AddGadgets.com system monitoring gadgets. Built on the Rainmeter platform.
MIT License
300 stars 32 forks source link

Update Checker Improvements #63

Closed raiguard closed 6 years ago

raiguard commented 6 years ago

Currently the update checker executes a series of hard-coded bangs. This is usually fine, but I want to make the update checker script available for others to use. So, it will be generalized. The new script will not require any hard-coding on the user's part.

The script measure will now accept additional options: UpToDateAction, UpdateAvailableAction, and ErrorAction. Each of these will have a series of bangs to execute when the corresponding outcome is given.

To invoke an update check, a !CommandMeasure bang will be used: [!CommandMeasure MeasureUpdateCheckerScript "CheckForUpdate(section, key, cVersion)"]. section specifies the section of the INI to check; key specifies which key in that section to use as the version for comparison; cVersion specifies the suite's current version that you wish to compare.

The script will also be able to return any of the options in the INI through the GetIniOption(section, key) function, invoked through Inline LUA. If the option is nil, it will return nothing.

These enhancements will allow the inclusion of changelogs in the update notification screen, rather than the user needing to go to GitHub to view the changelog. It will also make the script ready for general use, rather than being specifically designed for ModernGadgets.

To-do

raiguard commented 6 years ago

Documentation for future purposes:

Rainmeter Update Checker

This script compares semver-formatted version strings and executes Rainmeter bang actions based on the result. It can be used to notify users of a skin suite that an update is available for download. It can also be utilized to extract options from a downloaded INI file

Implementation

Copy the script into your skin suite and create a script measure pointing to it. You will need to add the following additional options to the measure: IniFilePath - The path to the file that will be used for comparison. UpToDateAction - Bangs to execute when the skin suite is up to date. UpdateAvailableAction - Bangs to execute when there is an available update. ErrorAction - Bangs to execute when the script encounters an error.

By default, IniFilePath will point to DownloadFile.inc in the current skin's folder. If any of the action options are not provided, nothing will happen when that result is given.

The GetIniOption(section, key) function can be used with Inline LUA to retrieve and display options from the INI file.

TO BE CONTINUED

raiguard commented 6 years ago

Done!