iteration

This commit is contained in:
Layla 2023-10-08 04:06:34 -04:00
parent 8623e9cdd9
commit 8eeaad61d5

View File

@ -6,29 +6,29 @@ local lib_path = "/lib/"
local startup_path = "/startup/" local startup_path = "/startup/"
function download_lua(remote_path, local_path) function download(remote_path, local_path)
io.write("Downloading " .. remote_path .. " to " .. local_path .. "\n") io.write("Downloading " .. remote_path .. " to " .. local_path .. "\n")
response = http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/" .. target_branch .. "/" .. program_name .. ".lua", nil) response = http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/" .. target_branch .. "/" .. remote_path, nil)
if response.getResponseCode() == 200 then if response.getResponseCode() == 200 then
file = fs.open(local_path, "w") file = fs.open(local_path, "w")
file.write(response.readAll()) file.write(response.readAll())
file.close() file.close()
else else
io.write("Failed to update " .. program_name .. ".lua\n") io.write("Failed to update " .. remote_path .. "\n")
io.write(response) io.write(response)
end end
end end
-- Startup -- Startup
download_lua("utils/lsh.lua", startup_path .. "lsh.lua") download("utils/lsh.lua", startup_path .. "lsh.lua")
-- Lib -- Lib
download_lua("lib/lns.lua", lib_path .. "lns.lua") download("lib/lns.lua", lib_path .. "lns.lua")
download_lua("lib/lum.lua", lib_path .. "lum.lua") download("lib/lum.lua", lib_path .. "lum.lua")
-- Bin -- Bin
download_lua("lum.lua", bin_path .. "lum.lua") download("lum.lua", bin_path .. "lum.lua")
-- Run lsh -- Run lsh
ok = shell.run(startup_path .. "lsh.lua") ok = shell.run(startup_path .. "lsh.lua")