Skip to content

Instantly share code, notes, and snippets.

@meijeru
Created September 20, 2019 12:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meijeru/cdf230aa9a94d51737931bf20269587b to your computer and use it in GitHub Desktop.
Save meijeru/cdf230aa9a94d51737931bf20269587b to your computer and use it in GitHub Desktop.
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