[+] Deploy script
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# abort on errors
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# navigate into the build output directory
|
||||||
|
cd dist
|
||||||
|
|
||||||
|
# if you are deploying to a custom domain
|
||||||
|
echo 'csc110.hydev.org' > CNAME
|
||||||
|
|
||||||
|
git init
|
||||||
|
git add -A
|
||||||
|
git commit -m 'deploy'
|
||||||
|
|
||||||
|
# if you are deploying to https://<USERNAME>.github.io/<REPO>
|
||||||
|
git push -f git@github.com:Hykilpikonna/CSC110-Project.git master:gh-pages
|
||||||
|
|
||||||
|
cd -
|
||||||
+18
-2
@@ -1,14 +1,14 @@
|
|||||||
import base64
|
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
import traceback
|
import traceback
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
from distutils.dir_util import copy_tree
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from flask import Flask, send_from_directory, Response
|
from flask import Flask, send_from_directory, Response
|
||||||
|
|
||||||
from constants import REPORT_DIR, DEBUG
|
from constants import REPORT_DIR, DEBUG
|
||||||
from utils import read
|
from utils import read, write
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
src_dir = Path(os.path.realpath(__file__)).parent
|
src_dir = Path(os.path.realpath(__file__)).parent
|
||||||
@@ -76,6 +76,21 @@ def generate_html() -> str:
|
|||||||
return html
|
return html
|
||||||
|
|
||||||
|
|
||||||
|
def write_html() -> None:
|
||||||
|
"""
|
||||||
|
Write HTML and copy files to ./dist
|
||||||
|
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
|
if os.path.isdir('./dist'):
|
||||||
|
os.remove('./dist')
|
||||||
|
Path('./dist/resources').mkdir(parents=True, exist_ok=True)
|
||||||
|
write('./dist/index.html', generate_html())
|
||||||
|
|
||||||
|
copy_tree(str(src_dir.joinpath('resources/').absolute()), './dist/resources')
|
||||||
|
copy_tree(REPORT_DIR, './dist')
|
||||||
|
|
||||||
|
|
||||||
def serve_report() -> None:
|
def serve_report() -> None:
|
||||||
"""
|
"""
|
||||||
Serve report page in a http server.
|
Serve report page in a http server.
|
||||||
@@ -125,4 +140,5 @@ def serve_report() -> None:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
write_html()
|
||||||
serve_report()
|
serve_report()
|
||||||
|
|||||||
Reference in New Issue
Block a user