-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path.ahoy.yml
More file actions
172 lines (139 loc) · 6.13 KB
/
.ahoy.yml
File metadata and controls
172 lines (139 loc) · 6.13 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
---
ahoyapi: v2
commands:
build:
usage: Build or rebuild project.
cmd: |
ahoy clean
ahoy up -- --build --force-recreate
docker cp -L . "$(docker compose ps -q cli)":/app/ || true
[ ! -d vendor ] && ahoy cli "composer install --prefer-dist --no-progress --no-suggest --no-interaction"
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:-11})
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")
echo " Selenium VNC URL on host : http://localhost:$(docker compose port chrome 7900 2>/dev/null | cut -d : -f 2)/?autoconnect=1&password=secret"
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:drupal@127.0.0.1:${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:-11} -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.
# Call the built Drush executable from the project build vendor directory.
cmd: docker compose exec -T cli bash -c "/app/build/vendor/bin/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 ./scripts/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 "vendor/bin/phpcs" && \
ahoy cli "DRUPAL_ROOT=build/web DRUPAL_VENDOR_ROOT=build/vendor vendor/bin/phpstan" && \
ahoy cli "vendor/bin/rector --dry-run" && \
ahoy cli "vendor/bin/gherkinlint lint tests/behat/features"
lint-fix:
usage: Fix code.
cmd: |
ahoy cli "vendor/bin/rector" && \
ahoy cli "vendor/bin/phpcbf"
lint-docs:
usage: Lint docs.
cmd: ahoy cli "php docs.php --fail-on-change"
update-docs:
usage: Lint docs.
cmd: ahoy cli "php docs.php"
test-unit:
usage: Run Unit tests.
cmd: ahoy cli "./vendor/bin/phpunit -c phpunit.xml --no-coverage $@"
test-unit-coverage:
usage: Run Unit tests with coverage.
cmd: ahoy cli "php -d pcov.directory=. ./vendor/bin/phpunit -c phpunit.xml $@"
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 with coverage.
cmd: |
ahoy cli "rm -rf /app/.logs/coverage/behat_cli/phpcov/*.php 2>/dev/null || true"
ahoy cli "cd /app/build && php -d pcov.enabled=1 -d pcov.directory=/app/src vendor/bin/behat -c /app/behat.yml --strict --colors $@"
ahoy cli "php /app/scripts/merge-coverage.php"
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 from the current build.
cmd: rsync -av --delete --no-progress --exclude-from=tests/behat/fixtures_drupal/d${DRUPAL_VERSION:-11}/.rsync-exclude build/ tests/behat/fixtures_drupal/d${DRUPAL_VERSION:-11}/
copy-files:
usage: Update fixture files to the current build.
cmd: find tests/behat/fixtures/ -maxdepth 1 -type f -exec cp {} build/web/sites/default/files/ \;
entrypoint:
- bash
- "-c"
- "-e"
- bash -e -c "$0" "$@"
- '{{cmd}}'
- '{{name}}'