local utils = require("utils") local git = require("git_commands") ngx.say([[]]) ngx.say("") local print_table print_table = function(t, l) l = l or 0 local n = 0 for i,v in pairs(t) do n = n + 1 break end if n > 0 then ngx.print("{\n") for i,v in pairs(t) do for i=0,l do ngx.print(" ") end ngx.print("",i,": ") if type(v) ~= "table" then if type(v) == "string" then ngx.print("\"") local s = v:gsub("&", "&"):gsub("<","<"):gsub(">",">") ngx.print(s) ngx.print("\"") else ngx.print(v) end else print_table(v,l+1) end ngx.print("\n") end for i=0,l-1 do ngx.print(" ") end ngx.print("}") else ngx.print("{}") end end local name = "ncurses-minesweeper" --local name = "lognestmonster" --local name = "auto-plow" --local name = "joshstock.in" local repo = "/home/josh/repos/"..name local headname = git.get_head(repo) ngx.say("

"..name.." / "..headname.name.."

") ngx.say("

< DESCRIPTION GOES HERE >

") ngx.print("

") ngx.print("Refs | ") ngx.print("Commit Log | ") ngx.print("Files | ") ngx.print("README | ") ngx.print("LICENSE") ngx.print("

") local commits_head = git.log(repo, "@", "", 1, 0, true) ngx.say("

Latest Commit

") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print([[]]) ngx.print("") for i,commit in pairs(commits_head) do ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.print("") ngx.say("") end ngx.say("
TimeHashSubjectAuthorEmail#(+)(-)GPG?
",utils.iso8601(commit.timestamp),"",commit.shorthash,"",commit.subject,"",commit.author,"",commit.email,"",commit.diff.num,"commit.diff.minus and " style=\"color:green;font-weight:bold\"" or "",">",commit.diff.plus~=0 and commit.diff.plus or "","commit.diff.plus and " style=\"color:red;font-weight:bold\"" or "",">",commit.diff.minus~=0 and commit.diff.minus or "","",commit.gpggood,"
") ngx.say("
") ngx.say("

Files

") ngx.print("") ngx.print("") ngx.say("") local files = git.list_tree(repo, "@", "") local iconfolder = [[]] local iconfile = [[]] for i,v in pairs(files.dirs) do ngx.print("") ngx.print("") local lastedit = git.log(repo, "@ -1", v, 1, 0, false)[1] ngx.print("") ngx.print("") ngx.print("") ngx.say("") end for i,v in pairs(files.files) do ngx.print("") ngx.print("") local lastedit = git.log(repo, "@ -1", v, 1, 0, false)[1] ngx.print("") ngx.print("") ngx.print("") ngx.say("") end ngx.say("
ObjectLatest Commit SubjectTimeHash
",iconfolder," ",v,"",lastedit.subject,"",utils.iso8601(lastedit.timestamp),"",lastedit.shorthash,"
",iconfile," ",v,"",lastedit.subject,"",utils.iso8601(lastedit.timestamp),"",lastedit.shorthash,"
") ngx.say("

README

") local README = git.show_file(repo, "@", "README.md") ngx.say(utils.markdown(README)) ngx.say("
") ngx.say("") ngx.exit(ngx.HTTP_OK)