From 6fc08030950c198cec443da13ed9294c558cd327 Mon Sep 17 00:00:00 2001 From: Tangent Date: Mon, 17 Aug 2026 19:24:39 -0600 Subject: [PATCH] extracted bundles and sent them --- rescue-from-github.lua | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/rescue-from-github.lua b/rescue-from-github.lua index fd19780..ac0ece7 100755 --- a/rescue-from-github.lua +++ b/rescue-from-github.lua @@ -2,25 +2,31 @@ package.path = (arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "lib" .. package.config:sub(1, 1) .. "?.lua;" .. package.path local utility = require "utility" --- TEMP import repos from export, add target information to mirrors -local export = utility.load_data("export.json") -local data = utility.load_data("respositories.json") -data.respositories["https://gitea.tangentfox.com/"] = {} -local old_site = data.respositories["https://gitea.tangentfox.com/"] +local extract_bundles = function(path) + utility.list(path, function(file_name) + local _, name, extension = utility.split_path_components(file_name) + if not extension or not (extension == "bundle") then return end -- only work on bundles -for name, repo in pairs(export.repositories) do - local org = repo.organization - if not old_site[org] then old_site[org] = {} end - old_site[org][name] = { description = repo.description, website = repo.website, } + local output_path, repo_name + if extension then + repo_name = name:sub(1, -(#extension + 2) - #("-main")) + output_path = path .. "/" .. repo_name + end + + if utility.path_exists(output_path) then + return + end + + os.execute("git clone " .. name:enquote() .. " " .. output_path:enquote()) + -- TEMP since I happen to be moving Minecraft organization items right now.. + -- os.execute("git clone " .. name:enquote() .. " " .. output_path:enquote() + -- .. " && cd " .. output_path:enquote() + -- .. " && git remote set-url origin https://tangent@gitea2.tangentfox.com/Minecraft/" .. repo_name + -- .. " && git push origin") + end) end -for url, org in pairs(data.mirrors["https://github.com/"]) do - for name, repo in pairs(org) do - repo.target = "https://gitea2.tangentfox.com/mirrors/" .. name - end -end - -utility.save_data(data) +extract_bundles(".") os.exit() -- TODO add support for private repos by making it warn the user