184 lines
5.9 KiB
Lua
Executable File
184 lines
5.9 KiB
Lua
Executable File
#!/usr/bin/env luajit
|
|
package.path = (arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "lib" .. package.config:sub(1, 1) .. "?.lua;" .. package.path
|
|
local utility = require "utility"
|
|
|
|
-- reformatting the mirrors list in my new file to the format I want
|
|
local data = utility.load_data("respositories.json")
|
|
local mirrors = {
|
|
["https://github.com/"] = {
|
|
TangentFoxy = {}
|
|
}
|
|
}
|
|
for _, name in ipairs(data.mirrors) do
|
|
mirrors["https://github.com/"].TangentFoxy[name] = {}
|
|
end
|
|
data.mirrors = mirrors
|
|
utility.save_data(data)
|
|
os.exit()
|
|
|
|
-- making sure all mirror keys are repos under my name on GitHub
|
|
local data = utility.load_data("export.json")
|
|
for _, name in ipairs(data.mirrors) do
|
|
os.execute("open " .. ("https://github.com/TangentFoxy/" .. name):enquote())
|
|
end
|
|
os.exit()
|
|
|
|
-- TODO add support for private repos by making it warn the user
|
|
|
|
-- defaults: organization "tangent", public, a string alone means the description
|
|
local repositories = {
|
|
["2dcraft"] = "A 2D infinite world survival game concept. (Minetest meets Factorio?)",
|
|
auroraclone = "Another attempted clone of Aurora, the 4X spreadsheet game.",
|
|
["52-cards"] = "Playing cards.",
|
|
BSG = "Battlestar Galactica fan-game (not even prototype yet).",
|
|
["bullet-hell"] = {
|
|
organization = "prototype",
|
|
description = "A prototype bullet hell game!",
|
|
},
|
|
["Drabble-Readings"] = "Recordings of me reading my drabble (for submission to the 100 Word Stories Podcast).",
|
|
erectus = {
|
|
organization = "prototype",
|
|
description = "Basic simulation of an enclosed space & life support systems.",
|
|
},
|
|
fade = "A very impermanent drawing tool.",
|
|
Fluid = {
|
|
organization = "prototype",
|
|
description = "A better system for basic simulation of fluids in containers.",
|
|
},
|
|
ideas = {
|
|
description = "design docs / misc. ideas",
|
|
website = "https://share.note.sx/gdon3y36",
|
|
},
|
|
neralie = {
|
|
organization = "tools",
|
|
description = "A simple clock for the Neralie decimal time format.",
|
|
website = "https://wiki.xxiivv.com/site/time",
|
|
},
|
|
["one-off-scripts"] = "An archive for old scripts.",
|
|
owen = {
|
|
organization = "prototype",
|
|
description = "Small polygonal ship generator.",
|
|
},
|
|
particular = {
|
|
organization = "prototype",
|
|
description = "A super basic particle simulator (better as a visualizer.. of nothing in particular).",
|
|
},
|
|
RGB = "My first successful game, where you have to try to match colors using the 3 mouse buttons.", -- default org: tangent, string means description
|
|
sever = {
|
|
organization = "prototype",
|
|
description = "Prototype simplistic engine simulation for generating power.",
|
|
},
|
|
["Simple-Kerbal-Mods"] = "KSP Agencies!",
|
|
slab = "A very not usable (yet?) Love2D GUI library.",
|
|
SpaceLove = "My first \"fly a fighter\" prototype... FROM 2014! D:",
|
|
["The-Snap"] = {
|
|
description = "The Snap balances your browsing habits by closing a random half of open tabs.",
|
|
website = "https://blog.tangentfox.com/the-snap-browser-extension/",
|
|
},
|
|
ThompsonWasAClone = "shit Thomas Was Alone clone",
|
|
xi = {
|
|
organization = "prototype",
|
|
description = "A borderless fullscreen \"screensaver\" of a galactic travel network.",
|
|
},
|
|
}
|
|
|
|
-- TODO figure out how to use API to automatically set these up
|
|
local mirrors = {
|
|
"markdown.lua",
|
|
"love-pe",
|
|
"slam",
|
|
"Piefiller",
|
|
"heightmap",
|
|
"rxi-json.lua",
|
|
"etlua",
|
|
"lua-date",
|
|
"lurker",
|
|
"lua-htmlparser",
|
|
"baton",
|
|
"lovebird",
|
|
"argparse",
|
|
"love-release",
|
|
"lume",
|
|
"semver.lua",
|
|
"lua-sandbox",
|
|
"dkjson.lua",
|
|
"inspect.lua",
|
|
}
|
|
|
|
local organizations = {}
|
|
local repository_names = {}
|
|
|
|
for name, info in pairs(repositories) do
|
|
if type(info) == "string" then
|
|
info = { description = info }
|
|
repositories[name] = info
|
|
end
|
|
if not info.organization then
|
|
info.organization = "tangent"
|
|
end
|
|
|
|
organizations[info.organization] = true
|
|
table.insert(repository_names, info.organization .. "/" .. name)
|
|
|
|
-- TODO figure out how to detect and exclude repos that don't need to be cloned (check what exists on my domain!)
|
|
-- os.execute("git clone https://TangentFoxy@github.com/TangentFoxy/" .. name)
|
|
|
|
-- os.execute("cd " .. name .. " && git branch") -- TODO figure out why I had this? do I need to manually push each branch or does that happen automatically?
|
|
end
|
|
|
|
-- if true then os.exit() end
|
|
|
|
organizations = (function()
|
|
local ordered = {}
|
|
for name in pairs(organizations) do
|
|
table.insert(ordered, name)
|
|
end
|
|
table.sort(ordered)
|
|
return ordered
|
|
end)()
|
|
|
|
table.sort(repository_names)
|
|
|
|
-- I don't know what data I actually need from this script or how to organize it
|
|
-- so I'm just exporting everything for the moment
|
|
local data = {
|
|
repositories = repositories,
|
|
organizations = organizations,
|
|
mirrors = mirrors,
|
|
repository_names = repository_names,
|
|
}
|
|
utility.save_data(data, "export.json")
|
|
os.exit()
|
|
|
|
-- TODO figure out how to use the API to do this automatically
|
|
-- TODO figure out how to set a description as well
|
|
print("Create the following organizations:")
|
|
for _, name in ipairs(organizations) do
|
|
print(" " .. name)
|
|
end
|
|
|
|
print("Press enter to continue.")
|
|
io.read("*line")
|
|
|
|
-- TODO figure out how to use the API to do this automatically
|
|
-- TODO figure out how to set their descriptions and URLs as well
|
|
print("Create the following repos:")
|
|
for _, name in ipairs(repository_names) do
|
|
print(" " .. name)
|
|
end
|
|
|
|
print("Press enter to continue.")
|
|
io.read("*line")
|
|
|
|
-- NOTE assumes main branch is the only thing that exists / matters
|
|
-- TODO make it detect and handle or warn about other branches
|
|
for name, info in pairs(repositories) do
|
|
local command = "cd " .. name
|
|
command = command .. " && git remote set-url origin https://tangent@gitea.tangentfox.com/" .. info.organization .. "/" .. name .. ".git"
|
|
command = command .. " && git push -u origin main"
|
|
os.execute(command)
|
|
os.execute("sleep 1") -- I assume my server can't handle it as well as GitHub's
|
|
end
|
|
|
|
-- TODO figure out how to set up the push sync using the API
|