Skip to content

Commit

Permalink
Breaking updates module completely; part of #196.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Degutis committed Jul 10, 2014
1 parent 3ad8559 commit 7d6149e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Hydra/API/updates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ function updates.check()
local thisversion = normalizeversion(updates.currentversion())

for _, version in pairs(versions) do
if normalizeversion(version) > thisversion then hasupdate = true end
if normalizeversion(version.version) > thisversion then hasupdate = true end
end

updates.available(hasupdate)
end)
end

--- updates.changelogurl
--- String of the URL that contains the changelog, rendered via Markdown
updates.changelogurl = "https://github.com/sdegutis/hydra/releases"
37 changes: 35 additions & 2 deletions Hydra/API/updates.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,41 @@ static int updates_getversions(lua_State* L) {
int i = 0;

for (NSDictionary* release in releases) {
NSString* tag_name = [release objectForKey:@"tag_name"];
lua_pushstring(L, [tag_name UTF8String]);
lua_newtable(L);

NSArray* assets = [release objectForKey:@"assets"];
NSDictionary* asset = [assets objectAtIndex:0];

lua_pushnumber(L, [[release objectForKey:@"id"] doubleValue]);
lua_setfield(L, -2, "id");

lua_pushstring(L, [[release objectForKey:@"tag_name"] UTF8String]);
lua_setfield(L, -2, "version");

lua_pushstring(L, [[release objectForKey:@"name"] UTF8String]);
lua_setfield(L, -2, "name");

lua_pushstring(L, [[release objectForKey:@"body"] UTF8String]);
lua_setfield(L, -2, "changelog");

lua_pushstring(L, [[release objectForKey:@"published_at"] UTF8String]);
lua_setfield(L, -2, "date");

lua_pushboolean(L, [[release objectForKey:@"prerelease"] boolValue]);
lua_setfield(L, -2, "beta");

lua_pushstring(L, [[release objectForKey:@"html_url"] UTF8String]);
lua_setfield(L, -2, "html_url");

lua_pushstring(L, [[asset objectForKey:@"browser_download_url"] UTF8String]);
lua_setfield(L, -2, "download_url");

lua_pushnumber(L, [[asset objectForKey:@"download_count"] doubleValue]);
lua_setfield(L, -2, "download_count");

lua_pushnumber(L, [[asset objectForKey:@"size"] doubleValue]);
lua_setfield(L, -2, "download_size");

lua_rawseti(L, -2, ++i);
}

Expand Down
Loading

0 comments on commit 7d6149e

Please sign in to comment.