54 lines
2.0 KiB
Python
54 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
import shutil, os
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
OUT = ROOT / "install"
|
|
VER = (ROOT / "VERSION").read_text().strip() if (ROOT / "VERSION").exists() else "0.1.0"
|
|
BUNDLE = OUT / f"cascadingdev-{VER}"
|
|
|
|
def main():
|
|
# Removes the old install bundle if it already exists
|
|
if BUNDLE.exists():
|
|
shutil.rmtree(BUNDLE)
|
|
# Create the directories
|
|
(BUNDLE / "assets" / "hooks").mkdir(parents=True, exist_ok=True)
|
|
(BUNDLE / "assets" / "templates").mkdir(parents=True, exist_ok=True)
|
|
|
|
# Copy the git hook and any other runtime utilities.
|
|
shutil.copy2(ROOT / "assets" / "runtime" / "ramble.py", BUNDLE / "ramble.py")
|
|
shutil.copy2(ROOT / "assets" / "runtime" / "create_feature.py", BUNDLE / "create_feature.py")
|
|
|
|
shutil.copy2(ROOT / "assets" / "hooks" / "pre-commit", BUNDLE / "assets" / "hooks" / "pre-commit")
|
|
|
|
# copy core templates
|
|
|
|
for t in [
|
|
"feature_request.md",
|
|
"feature.discussion.md",
|
|
"feature.discussion.sum.md",
|
|
"design_doc.md",
|
|
"USER_GUIDE.md",
|
|
"root_gitignore",
|
|
]:
|
|
shutil.copy2(ROOT / "assets" / "templates" / t, BUNDLE / "assets" / "templates" / t)
|
|
|
|
# copy (recursively) the contents of process/ and rules/ templates folders
|
|
def copy_tree(src, dst):
|
|
if dst.exists():
|
|
shutil.rmtree(dst)
|
|
shutil.copytree(src, dst)
|
|
copy_tree(ROOT / "assets" / "templates" / "process", BUNDLE / "assets" / "templates" / "process")
|
|
copy_tree(ROOT / "assets" / "templates" / "rules", BUNDLE / "assets" / "templates" / "rules")
|
|
|
|
# write installer entrypoint
|
|
shutil.copy2(ROOT / "src" / "cascadingdev" / "setup_project.py",
|
|
BUNDLE / "setup_cascadingdev.py")
|
|
|
|
(BUNDLE / "INSTALL.md").write_text("Unzip, then run:\n\n python3 setup_cascadingdev.py\n", encoding="utf-8")
|
|
(BUNDLE / "VERSION").write_text(VER, encoding="utf-8")
|
|
print(f"[✓] Built installer → {BUNDLE}")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|