Skip to content

Commit

Permalink
Make it possible to run the template without docker
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Apr 15, 2024
1 parent ab3150a commit 881472d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Welcome to **Cookiecutter Plone Starter**! Your one-stop solution to kickstart [

- **pipx**: A handy tool for installing and running Python applications.
- **NodeJS & Yarn**: Essential for managing and running JavaScript packages.
- **Docker**: For containerization and easy deployment.
- **Docker**: For containerization and easy deployment. (Optional)

### Installation Guide 🛠️

Expand Down
23 changes: 20 additions & 3 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ def _info(msg: str) -> str:
]


def _get_command_version(cmd: str) -> str:
"""Get version of a command."""
try:
raw_version = (
subprocess.run([cmd, "--version"], capture_output=True)
.stdout.decode()
.strip()
)
except FileNotFoundError:
raw_version = ""
return raw_version


def run_cmd(command: str, shell: bool, cwd: str) -> bool:
proc = subprocess.run(command, shell=shell, cwd=cwd, capture_output=True)
if proc.returncode:
Expand Down Expand Up @@ -269,9 +282,13 @@ def prepare_backend():
print("Backend codebase")
# Clean up unused test folders
clean_up_backend_tests()
steps = [
["Format generated code in the backend", ["make", "format"], False, "backend"]
]
if _get_command_version("docker"):
steps = [
["Format generated code in the backend", ["make", "format"], False, "backend"]
]
else:
steps = []
print(f" - Skipping 'make format' since Docker was not found.")
for step in steps:
msg, command, shell, cwd = step
print(f" - {msg}")
Expand Down

0 comments on commit 881472d

Please sign in to comment.