This repository was archived by the owner on Dec 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserve.py
More file actions
executable file
·53 lines (44 loc) · 1.62 KB
/
serve.py
File metadata and controls
executable file
·53 lines (44 loc) · 1.62 KB
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
#!/usr/bin/python
from shutil import copyfile
import os
import sys
def run_build():
print "Attempting to delete any existing builds before running..."
if os.path.exists("docs"):
os.system("rm -rf docs")
else:
pass
print "Building documentation with documentation-builder..."
try:
os.system("documentation-builder --template template.html --output-path ./docs --build-version-branches")
except:
print "Something went wrong. Are you sure you have documentation-builder installed?"
print "Copying GitHub Pages files over..."
try:
# copyfile(".htaccess", "docs/.htaccess")
with open("docs/CNAME", "w+") as cname:
cname.write("docs.aliceos.app")
copyfile("index.html", "docs/index.html")
except:
"Something went wrong. Are you sure that you have the right files?"
def start_serve(action):
if action == "build-only":
run_build()
print "Build completed."
elif action == "build-local-test":
run_build()
print "Attempting to serve content locally..."
if os.path.exists("docs"):
os.chdir("docs")
print "The content will now be served."
print "Press CTRL+C to quit the serving process."
os.system("python -m SimpleHTTPServer")
else:
print "There's no build directory, silly."
os.system("clear")
print "All done!"
print "Make sure the docs folder remains when you push to GitHub!"
else:
print "Error: Argument " + action + " not recognized."
if __name__ == "__main__":
start_serve(sys.argv[1])