45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
import os
|
|
import shutil
|
|
|
|
def simulate_scaffold(name, type, projects_dir, gtd_file):
|
|
project_dir = os.path.join(projects_dir, name)
|
|
|
|
if os.path.exists(project_dir):
|
|
return f"ERROR - Project {name} already exists."
|
|
|
|
# 1. Create Structure
|
|
os.makedirs(os.path.join(project_dir, "src"))
|
|
os.makedirs(os.path.join(project_dir, "tests"))
|
|
os.makedirs(os.path.join(project_dir, "docs"))
|
|
|
|
# 2. Create Boilerplate
|
|
with open(os.path.join(project_dir, "README.org"), "w") as f:
|
|
f.write(f"#+TITLE: {name}\n#+CREATED: [2026-03-31]\n")
|
|
|
|
# 3. GTD Integration
|
|
with open(gtd_file, "a") as f:
|
|
f.write(f"\n** NEXT {name}\n :PROPERTIES:\n :ID: proj-{name}\n :END:\n")
|
|
|
|
return f"SUCCESS - PSF Project {name} scaffolded."
|
|
|
|
if __name__ == "__main__":
|
|
test_projects_dir = "/tmp/psf_test_projects"
|
|
test_gtd_file = "/tmp/psf_test_gtd.org"
|
|
|
|
if os.path.exists(test_projects_dir):
|
|
shutil.rmtree(test_projects_dir)
|
|
os.makedirs(test_projects_dir)
|
|
|
|
with open(test_gtd_file, "w") as f:
|
|
f.write("* Projects\n")
|
|
|
|
print("--- Test: Project Scaffolding ---")
|
|
result = simulate_scaffold("test-project", "Lisp", test_projects_dir, test_gtd_file)
|
|
print(result)
|
|
|
|
# Verify
|
|
if os.path.exists(os.path.join(test_projects_dir, "test-project/src")) and "test-project" in open(test_gtd_file).read():
|
|
print("Status: PASS")
|
|
else:
|
|
print("Status: FAIL")
|