-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.py
94 lines (76 loc) · 2.72 KB
/
generate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import os
import shutil
import glob
# TODO - Configure the project with the variables before generating.
# This is done to not have to enter it all on command line arguments.
orx_location = os.environ["ORX"] + "\.."
print (orx_location)
orx_init_cmd = "init.bat"
orx_options = [
# bundle: orxBundle support (resources can be automatically packaged and encrypted)=[no], optional
# c++: Create a C++ project instead of C=[yes], optional
# imgui: Dear ImGui support (https://github.com/ocornut/imgui)=[no], triggers [+c++], optional
# mod: MOD (ProTracker) decoding support=[no], optional
# movie: Movie (MPEG-1) decoding support=[no], optional
# nuklear: Nuklear support (https://github.com/immediate-mode-ui/nuklear)=[no], optional
# remote: orxRemote support (resources can be stored on a web server, HTTP-only)=[no], optional
# scroll: C++ convenience layer with config-object binding=[no], triggers [+c++], optional
"+c++",
# "-c++",
"+scroll",
# "+remote",
# "+bundle",
# "+imgui",
# "+mod",
# "+movie",
# "+nuklear"
]
target_location = r"<YourProjectLocation>"
project_name = "<YourProjectName>"
new_project = target_location + "/" + project_name
original_location = os.getcwd()
class colors:
""" Colors for terminal output. """
END = "\033[0m"
GO = "\033[1;32m"
TASK = "\033[1;94m"
ALERT = "\033[1;31m"
def orx_init():
os.chdir(orx_location)
final_command = "{} {}".format(orx_init_cmd, new_project)
for item in orx_options:
final_command = final_command + " " + item
os.system(final_command)
os.chdir(original_location)
def copy_vscode():
os.chdir(original_location)
shutil.copytree(original_location + "/.vscode", new_project + "/.vscode")
def clean_up():
os.chdir(new_project)
for f in glob.glob("*.sublime-project"):
os.remove(f)
# TODO - Consider also removing the initial orx assets?
def git_init():
os.chdir(new_project)
with open("readme.md", "w") as fp:
fp.write("# " + project_name)
with open(".gitignore", "w") as fp:
fp.write(".vscode\n")
fp.write("bin\n")
fp.write("build/**/obj\n")
os.system("git init .")
os.system("git lfs track \"data/sound/**\"")
os.system("git lfs track \"data/texture/**\"")
os.system("git add --all")
os.system("git commit -m \"Project Generated!\"")
print(colors.GO + "Generating ORX Project")
print(colors.GO + " - {} at {}".format(project_name, target_location))
print(colors.TASK + "Running ORX Init Command" + colors.END)
orx_init()
print(colors.TASK + "Copying VS Code Settings" + colors.END)
copy_vscode()
print(colors.TASK + "Cleaning Up!" + colors.END)
clean_up()
print(colors.TASK + "Initialize Git Repository" + colors.END)
git_init()
print(colors.GO + "Finished Creating " + project_name + colors.END)