new ensure_dir logic
+ better logs + docker files + new docs
This commit is contained in:
@ -23,7 +23,12 @@ SITE_FILE = SRC_DIR / "config/site.yaml"
|
||||
THEMES_DIR = SRC_DIR / "config/themes"
|
||||
|
||||
def build():
|
||||
logging.info("🚀 Starting build...")
|
||||
build_version = "v1.3"
|
||||
logging.info("\n")
|
||||
logging.info("=" * 23)
|
||||
logging.info(f"🚀 Lumeex builder {build_version}")
|
||||
logging.info("=" * 23)
|
||||
logging.info("\n === Starting build === ")
|
||||
ensure_dir(BUILD_DIR)
|
||||
copy_assets(JS_DIR, STYLE_DIR, BUILD_DIR)
|
||||
|
||||
@ -87,7 +92,7 @@ def build():
|
||||
|
||||
# Adding Google fonts if existing
|
||||
google_fonts_link = generate_google_fonts_link(theme_vars.get("google_fonts", []))
|
||||
logging.info(f"[✓] Google Fonts link generated:\n{google_fonts_link}")
|
||||
logging.info(f"[✓] Google Fonts link generated")
|
||||
|
||||
# Generating thumbnail
|
||||
thumbnail_path = site_vars.get("social", {}).get("thumbnail")
|
||||
@ -125,7 +130,7 @@ def build():
|
||||
gallery_html = render_gallery_images(gallery_images)
|
||||
gallery = render_template(TEMPLATE_DIR / "gallery.html", {"gallery_images": gallery_html})
|
||||
|
||||
signature = f"<!-- Build with Lumeex v1.2 | https://git.djeex.fr/Djeex/lumeex | {build_date_version} -->"
|
||||
signature = f"<!-- Build with Lumeex {build_version} | https://git.djeex.fr/Djeex/lumeex | {build_date_version} -->"
|
||||
body = f"""
|
||||
<body>
|
||||
<div class="page-loader"><div class="spinner"></div></div>
|
||||
|
@ -19,10 +19,25 @@ def load_theme_config(theme_name, themes_dir):
|
||||
theme_vars = yaml.safe_load(f)
|
||||
return theme_vars, theme_dir
|
||||
|
||||
def ensure_dir(path):
|
||||
if path.exists():
|
||||
rmtree(path)
|
||||
path.mkdir(parents=True)
|
||||
def clear_dir(path: Path):
|
||||
if not path.exists():
|
||||
path.mkdir(parents=True)
|
||||
return
|
||||
|
||||
# Remove all files and subdirectories inside path, but not path itself
|
||||
for child in path.iterdir():
|
||||
if child.is_file() or child.is_symlink():
|
||||
child.unlink() # delete file or symlink
|
||||
elif child.is_dir():
|
||||
rmtree(child) # delete directory and contents
|
||||
|
||||
# Then replace your ensure_dir with this:
|
||||
|
||||
def ensure_dir(path: Path):
|
||||
if not path.exists():
|
||||
path.mkdir(parents=True)
|
||||
else:
|
||||
clear_dir(path)
|
||||
|
||||
def copy_assets(js_dir, style_dir, build_dir):
|
||||
for folder in [js_dir, style_dir]:
|
||||
|
Reference in New Issue
Block a user