summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generate.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/generate.py b/generate.py
index c043194..d5c7fb6 100644
--- a/generate.py
+++ b/generate.py
@@ -27,6 +27,10 @@ if __name__ == '__main__':
gemini_output_dir = os.path.join(root_dir, "capsule")
html_output_dir = os.path.join(root_dir, "website")
+ # detect static files
+ os.chdir(os.path.join(root_dir, "static"))
+ static_files = [os.path.join(root, name) for root, dirs, files in os.walk(".") for name in files]
+
# delete output directories
shutil.rmtree(output_dir, ignore_errors=True)
shutil.rmtree(gemini_output_dir, ignore_errors=True)
@@ -38,14 +42,20 @@ if __name__ == '__main__':
# generate Gemini output directory
shutil.copytree(output_dir, gemini_output_dir, ignore=shutil.ignore_patterns("*.html"))
- shutil.copytree(os.path.join(output_dir, "resource"), os.path.join(gemini_output_dir, "resource"), dirs_exist_ok=True)
+
+ os.chdir(os.path.join(root_dir, "static"))
+
os.chdir(gemini_output_dir)
os.remove("robots.txt")
os.remove("sitemap.xml")
shutil.move(os.path.join("gemini_atom", "atom.xml"), "atom.xml")
os.rmdir("gemini_atom")
+ for file in static_files:
+ shutil.copy(os.path.join(output_dir, file), file)
# generate HTML output directory
shutil.copytree(output_dir, html_output_dir, ignore=shutil.ignore_patterns("*.gmi", "gemini_atom"))
- shutil.copytree(os.path.join(output_dir, "resource"), os.path.join(html_output_dir, "resource"), dirs_exist_ok=True)
+ os.chdir(html_output_dir)
+ for file in static_files:
+ shutil.copy(os.path.join(output_dir, file), file)