Browse Source

otb-shared-brand v0.2.0: add deploy scripts

main
def670 1 month ago
parent
commit
bafd3adfcf
  1. 10
      deploy-mintme.sh
  2. 4
      deploy-monitor.sh
  3. 8
      deploy-portal.sh

10
deploy-mintme.sh

@ -29,21 +29,21 @@ for name in ["index.html", "pricing.html", "terms.html", "contact.html"]:
elif '<header class="header">' in text:
text = re.sub(r'<header class="header">.*?</header>', header, text, count=1, flags=re.S)
else:
text = text.replace('<body>', '<body>\n' + header, 1)
text = text.replace('<body>', '<body>\\n' + header, 1)
if '<div class="otb-statusbar">' in text:
text = re.sub(r'<div class="otb-statusbar">.*?</div>\s*</div>', footer, text, count=1, flags=re.S)
text = re.sub(r'<div class="otb-statusbar">.*?</div>\\s*</div>', footer, text, count=1, flags=re.S)
else:
text = text.replace('</body>', footer + '\n</body>', 1)
text = text.replace('</body>', footer + '\\n</body>', 1)
p.write_text(text, encoding="utf-8")
cssp = Path("assets/style.css")
css = cssp.read_text(encoding="utf-8")
if "/* ===== OTB shared branding ===== */" in css:
css = re.sub(r'/\* ===== OTB shared branding ===== \*/.*', brandcss, css, flags=re.S)
css = re.sub(r'/\\* ===== OTB shared branding ===== \\*/.*', brandcss, css, flags=re.S)
else:
css += "\n\n" + brandcss
css += "\\n\\n" + brandcss
cssp.write_text(css, encoding="utf-8")
print("mintme deploy complete")
PY

4
deploy-monitor.sh

@ -61,9 +61,9 @@ brandcss = """$BRANDCSS"""
p = Path("frontend/styles.css")
css = p.read_text(encoding="utf-8")
if "/* ===== OTB shared branding ===== */" in css:
css = re.sub(r'/\* ===== OTB shared branding ===== \*/.*', brandcss, css, flags=re.S)
css = re.sub(r'/\\* ===== OTB shared branding ===== \\*/.*', brandcss, css, flags=re.S)
else:
css = brandcss + "\n\n" + css
css = brandcss + "\\n\\n" + css
p.write_text(css, encoding="utf-8")
print("monitor branding css updated")
PY

8
deploy-portal.sh

@ -23,17 +23,17 @@ brandcss = """$BRANDCSS"""
for p in Path("templates").glob("portal_*.html"):
text = p.read_text(encoding="utf-8")
if '<div class="otb-statusbar">' in text:
text = re.sub(r'<div class="otb-statusbar">.*?</div>\s*</div>', footer, text, count=1, flags=re.S)
text = re.sub(r'<div class="otb-statusbar">.*?</div>\\s*</div>', footer, text, count=1, flags=re.S)
else:
text = text.replace('{% include "footer.html" %}', footer + '\n\n {% include "footer.html" %}')
text = text.replace('{% include "footer.html" %}', footer + '\\n\\n {% include "footer.html" %}')
p.write_text(text, encoding="utf-8")
cssp = Path("static/css/style.css")
css = cssp.read_text(encoding="utf-8")
if "/* ===== OTB shared branding ===== */" in css:
css = re.sub(r'/\* ===== OTB shared branding ===== \*/.*', brandcss, css, flags=re.S)
css = re.sub(r'/\\* ===== OTB shared branding ===== \\*/.*', brandcss, css, flags=re.S)
else:
css += "\n\n" + brandcss
css += "\\n\\n" + brandcss
cssp.write_text(css, encoding="utf-8")
print("portal deploy complete")
PY

Loading…
Cancel
Save