-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (43 loc) · 1.61 KB
/
Makefile
File metadata and controls
54 lines (43 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Variables
CMS_DIR := cms
COMPOSER_FILE := $(CMS_DIR)/composer.json
.PHONY: clean ddev setup launch start restart
# Default target to run all steps
all: clean ddev setup launch
# Clean the cms/ folder but keep composer.json and drupal_cms_installer profile
clean:
@echo "Cleaning the $(CMS_DIR) folder but keeping $(COMPOSER_FILE) and drupal_cms_installer..."
@find $(CMS_DIR) -mindepth 1 -depth -ignore_readdir_race ! -name $(notdir $(COMPOSER_FILE)) ! -path "*/web/profiles/drupal_cms_installer" -exec rm -rf {} +
# Start ddev and always reset the project database first
ddev:
@echo "Checking ddev status and resetting DB before starting..."
@if ddev describe >/dev/null 2>&1; then \
echo "ddev is already running — stopping, deleting project (destructive), then starting..."; \
ddev stop || true; \
ddev delete --omit-snapshot -Oy || true; \
ddev start; \
else \
echo "ddev is not running — deleting any existing project data then starting..."; \
ddev delete --omit-snapshot -Oy || true; \
ddev start; \
fi
start:
@echo "Starting ddev..."
@ddev start
restart:
@echo "Restarting ddev..."
@ddev restart
# Run setup commands inside the ddev container
setup:
@echo "Running setup commands inside the ddev container..."
@echo "Commands to be executed:"
@echo "1. cd $(CMS_DIR)"
@echo "2. composer install"
@echo "3. composer run-script post-install-cmd"
@ddev exec "cd $(CMS_DIR) && composer install && composer run-script post-install-cmd"
# Launch the browser using ddev
launch:
@echo "Launching the browser with ddev..."
@ddev launch
# Dropping Drupal database inside ddev...
# drush sql:drop -y