1
0
mirror of https://github.com/kepler155c/opus synced 2024-12-24 23:50:26 +00:00

branch support

This commit is contained in:
kepler155c@gmail.com 2017-05-19 20:55:19 -04:00
parent 8ecfea1524
commit 558d271ae0
4 changed files with 18 additions and 4 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/ignore

View File

@ -8,8 +8,9 @@ function gitfs.mount(dir, user, repo, branch)
end
local list = git.list(user, repo, branch)
for path, url in pairs(list) do
fs.mount(fs.combine(dir, path), 'urlfs', url)
for path, entry in pairs(list) do
local node = fs.mount(fs.combine(dir, path), 'urlfs', entry.url)
node.size = entry.size
end
end

View File

@ -31,7 +31,10 @@ function git.list(user, repo, branch)
for k,v in pairs(data.tree) do
if v.type == "blob" then
v.path = v.path:gsub("%s","%%20")
list[v.path] = string.format(FILE_URL, user, repo, branch, v.path)
list[v.path] = {
url = string.format(FILE_URL, user, repo, branch, v.path),
size = v.size,
}
end
end

View File

@ -1,4 +1,13 @@
local DEFAULT_UPATH = 'https://raw.githubusercontent.com/kepler155c/opus/master/sys/apis'
local branch = 'master'
if fs.exists('.branch') then
local f = fs.open('.branch', "r")
if f then
branch = f.readAll()
f.close()
end
end
local DEFAULT_UPATH = 'https://raw.githubusercontent.com/kepler155c/opus/' .. branch .. '/sys/apis'
local PASTEBIN_URL = 'http://pastebin.com/raw'
local GIT_URL = 'https://raw.githubusercontent.com'