diff options
author | github-actions <41898282+github-actions[bot]@users.noreply.github.com> | 2025-06-04 00:51:45 +0000 |
---|---|---|
committer | github-actions <41898282+github-actions[bot]@users.noreply.github.com> | 2025-06-04 00:51:45 +0000 |
commit | daaca95cfa933cb3654e9e5596453fe4947ea96c (patch) | |
tree | 9208d9cdadbcd8bc26f12d9587520c01e9aba1cb | |
parent | 4fcd8373ed91679552cd9e8c77109877aa286a89 (diff) | |
download | cleberg.net-daaca95cfa933cb3654e9e5596453fe4947ea96c.tar.gz cleberg.net-daaca95cfa933cb3654e9e5596453fe4947ea96c.tar.bz2 cleberg.net-daaca95cfa933cb3654e9e5596453fe4947ea96c.zip |
Commit from GitHub Actions (Ruff)
-rw-r--r-- | build.py | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -5,11 +5,13 @@ import subprocess import sys from pathlib import Path + def prompt(prompt_text): try: return input(prompt_text).strip() except EOFError: - return '' + return "" + def remove_build_directory(build_dir): if build_dir.exists(): @@ -17,6 +19,7 @@ def remove_build_directory(build_dir): shutil.rmtree(build_dir) build_dir.mkdir(parents=True, exist_ok=True) + def minify_css(src_css, dest_css): print(f"Minifying CSS: {src_css} → {dest_css}") result = subprocess.run( @@ -30,6 +33,7 @@ def minify_css(src_css, dest_css): print(result.stderr, file=sys.stderr) sys.exit(1) + def run_emacs_publish(dev_mode=True): if dev_mode: print("Running Emacs publish script (development)...") @@ -53,6 +57,7 @@ def run_emacs_publish(dev_mode=True): print(result.stderr, file=sys.stderr) sys.exit(1) + def deploy_to_server(build_dir, server): remote_path = f"{server}:/var/www/cleberg.net/" print(f"Deploying .build/ → {remote_path}") @@ -67,21 +72,20 @@ def deploy_to_server(build_dir, server): print(result.stderr, file=sys.stderr) sys.exit(1) + def start_dev_server(build_dir): print(f"Starting development HTTP server from {build_dir}/ on port 8000") os.chdir(build_dir) # This will run until interrupted (Ctrl+C) try: - subprocess.run( - [sys.executable, "-m", "http.server", "8000"], - check=True - ) + subprocess.run([sys.executable, "-m", "http.server", "8000"], check=True) except KeyboardInterrupt: print("\nDevelopment server stopped.") except subprocess.CalledProcessError as e: print(f"Error starting development server: {e}", file=sys.stderr) sys.exit(1) + def main(): build_dir = Path(".build") theme_dir = Path("theme/static") @@ -132,5 +136,6 @@ def main(): # Launch development web server start_dev_server(build_dir) + if __name__ == "__main__": - main()
\ No newline at end of file + main() |