-
-
Save Marsgames/1d4d745d9220b6f5e85dbb3724ea950e to your computer and use it in GitHub Desktop.
Setup script for Headcrab Unity project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
os.system("pip install requests") | |
os.system("pip install pygit2") | |
os.system("clear") | |
import requests | |
from pygit2 import Repository | |
def AddHook(): | |
if not os.path.exists(".git/hooks"): | |
os.makedirs(".git/hooks") | |
elif os.path.exists(".git/hooks.post-checkout"): | |
return | |
hookUrl = "https://gist.githubusercontent.com/Marsgames/97bf56e89bebddf913cc3b4a55ba874a/raw/b9ab4e9054cfbe161cfdc20f3f975360a550fbd1/post-checkout" | |
r = requests.get(hookUrl) | |
with open(".git/hooks/post-checkout", "wb") as file: | |
file.write(r.content) | |
def AddAutoSave(): | |
if not os.path.exists("Assets/Editor"): | |
os.makedirs("Assets/Editor") | |
elif os.path.exists("Assets/Editor/AutoSave.cs"): | |
return | |
autoSaveUrl = "https://gist.githubusercontent.com/Marsgames/40635c471ea962dd55a7afac5348c385/raw/254b3c9931e1904f3f112ab35b676387965e197e/AutoSave.cs" | |
r = requests.get(autoSaveUrl, allow_redirects=True) | |
with open("Assets/Editor/AutoSave.cs", "wb") as file: | |
file.write(r.content) | |
def AddGitignore(): | |
if os.path.exists(".gitignore"): | |
return | |
gitignoreUrl = "https://gist.githubusercontent.com/Marsgames/6b84af0d8dc2f6dd2080addc9213f87e/raw/91d243608b53befae38083b7848c3be8fd7420c8/.gitignore" | |
r = requests.get(gitignoreUrl, allow_redirects=True) | |
with open(".gitignore", "wb") as file: | |
file.write(r.content) | |
def RemoveCSC(): | |
repo = Repository(".") | |
head = repo.head | |
if "develop" in head.name or "master" in head.name or "main" in head.name: | |
if os.path.exists("Assets/csc.rsp"): | |
os.remove("Assets/csc.rsp") | |
if "__main__" == __name__: | |
AddHook() | |
AddAutoSave() | |
AddGitignore() | |
RemoveCSC() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment