extracted bundles and sent them
This commit is contained in:
+20
-14
@@ -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
|
||||
|
||||
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
|
||||
if utility.path_exists(output_path) then
|
||||
return
|
||||
end
|
||||
|
||||
utility.save_data(data)
|
||||
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
|
||||
|
||||
extract_bundles(".")
|
||||
os.exit()
|
||||
|
||||
-- TODO add support for private repos by making it warn the user
|
||||
|
||||
Reference in New Issue
Block a user