Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check for update to the Red executable
Red [
Title: {Update checker}
Purpose: {Check for update to Red executable}
Author: "Rudolf W. MEIJER"
File: %check-update.red
Rights: "Copyright (c) 2019 Rudolf W. MEIJER"
Language: 'English
Tabs: 4
]
; read commit history from github site
commits: load https://api.github.com/repos/red/red/commits
; this yields a block of maps, the first component being the most recent
; extract the date and short sha of the latest commit
latest-date: to-local-date load commits/1/commit/committer/date
latest-sha: copy/part commits/1/sha 7
; compare date of latest commit to date of Red build that is running
either latest-date = system/build/git/date
[
alert "you are up-to-date"
][
alert rejoin ["download the latest Red (#" latest-sha ")"]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment