-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
.ahoy.yml
150 lines (123 loc) · 5.62 KB
/
.ahoy.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
ahoyapi: v2
commands:
build:
usage: Build or rebuild project.
cmd: |
ahoy clean
(docker network prune -f > /dev/null && docker network inspect amazeeio-network > /dev/null || docker network create amazeeio-network)
ahoy up -- --build --force-recreate
docker cp -L . "$(docker compose ps -q cli)":/app/ || true
ahoy provision
ahoy info 1
info:
usage: Print information about this project.
cmd: |
echo " Project : " $(ahoy cli echo \${PROJECT})
echo " Drupal version : " $(ahoy cli echo \${DRUPAL_VERSION:-10})
echo " Site local URL : " $(ahoy cli echo \$LOCALDEV_URL)
echo " Path to project : " $(ahoy cli echo /app)
echo " Path to web root : " $(ahoy cli echo /app/build/web)
echo " DB port on host : " $(docker port $(docker compose ps -q mariadb) 3306 | cut -d : -f 2)
echo " Xdebug : " $(ahoy cli php -v|grep -q Xdebug && echo "Enabled" || echo "Disabled")
if [ -n "$1" ]; then
echo " One-time login : " $(ahoy login -- --no-browser)
fi
db:
usage: Open DB in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && mdfind -name 'Sequel Ace'|grep -q "Ace" \
&& HOST_DB_PORT="$(docker port $(docker compose ps -q mariadb 2>/dev/null) 3306 2>/dev/null | cut -d : -f 2)" \
&& open "mysql://drupal:[email protected]:${HOST_DB_PORT}/drupal" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
# ----------------------------------------------------------------------------
# Docker commands.
# ----------------------------------------------------------------------------
up:
usage: Build and start Docker containers.
cmd: docker compose up -d "$@" && if docker compose logs | grep -q "\[Error\]"; then exit 1; fi
down:
usage: Stop Docker containers and remove container, images, volumes and networks.
cmd: if [ -f "docker-compose.yml" ]; then docker compose down --volumes > /dev/null 2>&1; fi
start:
usage: Start existing Docker containers.
cmd: docker compose start "$@"
stop:
usage: Stop running Docker containers.
cmd: docker compose stop "$@"
restart:
usage: Restart all stopped and running Docker containers.
cmd: docker compose restart
logs:
usage: Show Docker logs.
cmd: docker compose logs "$@"
pull:
usage: Pull latest docker images.
cmd: if [ ! -z "$(docker image ls -q)" ]; then docker image ls --format \"{{.Repository}}:{{.Tag}}\" | grep uselagoon/ | grep -v none | xargs -n1 docker pull | cat; fi
cli:
usage: Start a shell inside CLI container or run a command.
cmd: if \[ "${#}" -ne 0 \]; then docker compose exec -e DRUPAL_VERSION=${DRUPAL_VERSION:-10} -T cli bash -c "$*"; else docker compose exec cli bash; fi
composer:
usage: Run Composer commands in the CLI service container.
cmd: docker compose exec -T cli composer "$@"
drush:
usage: Run Drush commands in the CLI service container.
cmd: docker compose exec -T cli bash -c "drush -r /app/build/web -l \${LOCALDEV_URL} $*"
# ----------------------------------------------------------------------------
# Application commands.
# ----------------------------------------------------------------------------
login:
usage: Login to a website.
cmd: ahoy drush uli "$@"
provision:
usage: Provision a fixture test site.
cmd: ahoy cli ./.circleci/provision.sh
clean:
usage: Remove containers and all build files.
cmd: |
ahoy down || true
sleep 5
chmod -Rf 777 build 2>&1 > /dev/null || true
rm -rf \
./vendor \
./composer.lock \
./build \
2>&1 > /dev/null || true
reset:
usage: "Reset environment: remove containers, all build, manually created and Drupal-Dev files."
cmd: ahoy clean && rm -rf ./.logs ./composer.lock
lint:
usage: Lint code.
cmd: |
ahoy cli "cp -Rf phpcs.xml phpstan.neon phpmd.xml gherkinlint.json rector.php build > /dev/null" \
&& ahoy cli "cd /app/build && ./vendor/bin/phpcs" \
&& ahoy cli "cd /app/build && ./vendor/bin/phpstan" \
&& ahoy cli "cd /app/build && ./vendor/bin/rector --clear-cache --dry-run" \
&& ahoy cli "cd /app/build && ./vendor/bin/phpmd ../src text phpmd.xml" \
&& ahoy cli "cd /app/build && ./vendor/bin/phpmd ../tests/behat/bootstrap text phpmd.xml" \
&& ahoy cli "cd /app/build && ./vendor/bin/gherkinlint lint ../tests/behat/features"
lint-fix:
usage: Fix code.
cmd: |
ahoy cli "cp -Rf phpcs.xml phpstan.neon phpmd.xml gherkinlint.json rector.php build > /dev/null" \
&& ahoy cli "cd /app/build && ./vendor/bin/rector --clear-cache" \
&& ahoy cli "cd /app/build && ./vendor/bin/phpcbf"
test-bdd:
usage: Run BDD tests.
cmd: ahoy cli "cd /app/build && vendor/bin/behat -c /app/behat.yml --strict --colors $@"
test-bdd-coverage:
usage: Run BDD tests.
cmd: ahoy cli "cd /app/build && php -dpcov.enabled=1 -dpcov.directory=/app/src vendor/bin/behat -c /app/behat.yml --strict --colors $@"
debug:
usage: Enable PHP Xdebug.
cmd: ahoy cli php -v | grep -q Xdebug || XDEBUG_ENABLE=true ahoy up cli php nginx && ahoy cli php -v | grep -q Xdebug && echo "Enabled debug configuration. Use 'ahoy up' to disable."
update-fixtures:
usage: Update fixture files for Drupal.
cmd: rsync -av --delete --no-progress --exclude-from=tests/behat/fixtures/d${DRUPAL_VERSION:-10}/.rsync-exclude build/ tests/behat/fixtures/d${DRUPAL_VERSION:-10}/
entrypoint:
- bash
- "-c"
- "-e"
- bash -e -c "$0" "$@"
- '{{cmd}}'
- '{{name}}'