forked from govCMS/scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ahoy.yml
158 lines (131 loc) · 5.48 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
151
152
153
154
155
156
157
158
---
ahoyapi: v2
commands:
up:
usage: Build project.
cmd: |
docker-compose up -d "$@" &&
docker-compose exec -T test dockerize -wait tcp://mariadb:3306 -timeout 2m &&
ahoy info;
down:
usage: Delete project (CAUTION).
cmd: |
if [ "$1" == "y" ]; then
docker-compose down --volumes
else
ahoy confirm "Running this command will destroy your current site, database and build? Are you sure you didn't mean ahoy stop?" &&
# Run this if confirm returns true
docker-compose down --volumes ||
# Run this if confirm returns false
echo "OK, probably a wise choice..."
fi
build:
usage: Build project.
cmd: |
docker-compose up -d --build "$@" &&
docker-compose exec -T test dockerize -wait tcp://mariadb:3306 -timeout 2m &&
ahoy govcms-deploy && ahoy info;
cli:
usage: Start a shell inside cli container.
cmd: docker-compose exec cli bash
run:
usage: Run command inside cli container.
cmd: docker-compose exec -T cli bash -c "$*"
govcms-deploy:
usage: Runs deployment commands (e.g. config import, updb, cr, set up file_stage_proxy).
cmd: |
docker-compose exec -T cli mkdir -p /app/web/sites/default/files/private/tmp && \
docker-compose exec -T cli /app/vendor/bin/govcms-db-update && \
docker-compose exec -T cli /app/vendor/bin/govcms-config-import && \
docker-compose exec -T cli /app/vendor/bin/govcms-cache-rebuild && \
docker-compose exec -T cli /app/vendor/bin/govcms-enable_modules
drush:
usage: Run drush commands in cli container.
cmd: docker-compose exec -T cli drush "$@"
logs:
usage: Show Docker logs.
cmd: docker-compose logs "$@"
ps:
usage: List running Docker containers.
cmd: docker-compose ps
restart:
usage: Restart Docker containers.
cmd: docker-compose restart
stop:
usage: Stop Docker containers.
cmd: docker-compose stop "$@"
install:
usage: Install the profile.
cmd: docker-compose exec -T cli drush si -y govcms "$@" && ahoy govcms-deploy
login:
usage: Login to a website.
cmd: |
docker-compose exec -T cli drush -y cset tfa.settings reset_pass_skip_enabled true && \
docker-compose exec -T cli drush uinf --uid 1 --field name | xargs docker-compose exec -T cli drush uublk && \
docker-compose exec -T cli drush uli
unloop:
usage: Fix local redirect loop
cmd: |
docker-compose exec -T cli drush ev '$u=\Drupal\user\Entity\User::load(1); $u->set("field_password_expiration", "0"); $u->save()' && \
docker-compose exec -T cli drush ev '$u=\Drupal\user\Entity\User::load(1); $u->set("field_last_password_reset", date("Y-m-d\TH:i:s")); $u->save()'
mysql-import:
usage: Pipe in a sql file. `ahoy mysql-import local.sql`
cmd: |
if [ -e "$@" ] ; then
docker-compose exec cli bash -c 'drush sql-drop' &&
docker-compose exec -T cli bash -c 'drush sql-cli' < "$@"
else echo "Provided sql file" "$@" "does not exist"
fi
mysql-dump:
usage: Dump data out into a file. `ahoy mysql-dump local.sql`
cmd: docker-compose exec -T cli bash -c 'drush sql-dump --ordered-dump' > "$@"
lint:
usage: Lint code
cmd: |
docker-compose exec -T test ./vendor/bin/govcms-lint web/modules/custom
docker-compose exec -T test ./vendor/bin/govcms-lint web/themes/custom
test-behat:
usage: Run Behat tests.
cmd: docker-compose exec -T test ./vendor/bin/govcms-behat "$@"
test-phpunit:
usage: Run phpunit tests
cmd: docker-compose exec -T test ./vendor/bin/govcms-phpunit --testsuite govcms
pull:
usage: Pull latest docker images.
cmd: docker image ls --format \"{{.Repository}}:{{.Tag}}\" | grep govcms/ | grep -v none | xargs -n1 docker pull | cat
refresh-db:
usage: Refresh the database container with latest nightly dump.
cmd: |
ahoy confirm "Running this command will replace your current database. Are you sure?" &&
# Run this if confirm returns true
( cat .env | grep ^MARIADB_DATA_IMAGE | cut -c20- | xargs -n1 docker pull; docker-compose rm -f -s -v mariadb && ahoy up ) ||
# Run this if confirm returns false
echo "OK, probably a wise choice..."
ship-shape:
usage: Run site validation scripts locally
cmd: |
docker-compose exec -T cli shipshape -f /app/vendor/govcms/scaffold-tooling/shipshape.yml --exclude-db --error-code "$@"
debug:
usage: Enable debug configuration.
cmd: |
{ ahoy run "php -v|grep -q Xdebug" && echo "Debug is already enabled"; } \
|| { export XDEBUG_ENABLE="true" && ahoy up cli test php nginx && ahoy run "php -v|grep -q Xdebug" && echo "Enabled debug configuration. Use 'ahoy up' to disable."; }
info:
usage: Print information about this project.
cmd: |
echo "Project : " $(ahoy run "echo \$LAGOON_PROJECT")
echo "Site local URL : " $(ahoy run "echo \$LAGOON_ROUTE")
echo "DB port on host : " $(docker port $(docker-compose ps -q mariadb) 3306 | cut -d : -f 2)
if [ "$1" ]; then
echo "One-time login : " $(ahoy login -- --no-browser)
fi
confirm:
cmd: read -r -p "${@} [y/N] " response; [ ${response} = "y" ]
hide: true
my:
usage: Custom commands for this project. See `ahoy my help`.
imports:
- 'custom/ahoy.yml'
init:
usage: Initialise codebase with project name, type (saas|paas|saasplus) and version (8|9)
cmd: scripts/scaffold-init.sh -n $1 -t $2 -v $3