Skip to content

Commit

Permalink
Add versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachase committed May 19, 2018
1 parent 3b2e970 commit 93d7c18
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local discordName = config.discordName
local externName

local function time()
return os.epoch()
return os.epoch("utc")
end

function logger.init(prints, tExternName, noColor)
Expand Down
4 changes: 4 additions & 0 deletions src/main.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- vim: syntax=lua
-- luacheck: globals loadRemote getRemote fs loadstring peripheral

local versionTag = "v0.0.1"

local args = {...}
local layoutMode = args[1] == "--layout" or args[1] == "-l"

Expand Down Expand Up @@ -29,6 +31,8 @@ local function xenon()

--#include "src/sections/requires.lua"

--#include "src/sections/updates.lua"

--#include "src/sections/renderer.lua"

if layoutMode then
Expand Down
18 changes: 18 additions & 0 deletions src/sections/updates.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
local ghURL = "https://api.github.com/repos/incinirate/Xenon/releases/latest"

if config.checkForUpdates ~= false then
local handle = http.get(ghURL)

if handle then
local releaseData = handle.readAll()
handle.close()

local release = json.decode(releaseData)
if release.tag_name ~= versionTag then
logger.warn("Version mismatch, latest release is "
.. release.version_tag .. ", but running version is " .. versionTag)
end
else
logger.warn("Unable to fetch release data")
end
end

0 comments on commit 93d7c18

Please sign in to comment.