generated from ddev/ddev-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.yaml
218 lines (202 loc) · 8.61 KB
/
install.yaml
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# Details about the install.yaml file are at https://ddev.readthedocs.io/en/stable/users/extend/additional-services/#sections-and-features-of-ddev-get-add-on-installyaml
name: annertech-ddev
# pre_install_actions - list of actions to run before installing the addon.
# Examples would be removing an extraneous docker volume,
# or doing a sanity check for requirements.
# DDEV environment variables can be interpolated into these actions
# pre_install_actions are executed in the context of the target project's root directory.
pre_install_actions:
- |
echo "Please read:"
echo "https://github.com/Annertech/annertech-ddev/blob/main/README.md"
echo "for instructions on how to properly install the addon!"
- |
#ddev-nodisplay
#ddev-description:Removing old annertech config files
has_old_files=false
for file in "${DDEV_APPROOT}/.ddev/config.hooks.yaml"; do
if [ ! -f "${file}" ]; then
continue
fi
if grep -q '#ddev-generated' "${file}"; then
rm -f "${file}"
else
echo "${file} needs to be removed but has been modified by the user. Please check it and remove it"
has_old_files=true
fi
done
if [ "${has_old_files}" = true ]; then
exit 2
fi
# - |
# #ddev-description:check project type
# if [ "${DDEV_PROJECT_TYPE}" != "drupal*" ]; then
# echo "This addon is designed for Drupal only projects, versions 10+";
# exit 1;
# fi
# - |
# #ddev-description:Check architecture type for incompatible arm64 type
# if [ "$(uname -m)" = "arm64" -o "$(uname -m)" = "aarch64" ]; then
# echo "This package does not work on arm64 (Apple Silicon) machines";
# exit 1;
# fi
# - "docker volume rm ddev-${DDEV_PROJECT}_solr 2>/dev/null || true"
# You can also check for client DDEV version with ddev_version_constraint (see below).
# - |
# #ddev-description:Checking DDEV version
# if ! ( ddev debug capabilities 2>/dev/null | grep corepack >/dev/null 2>&1 ) ; then
# echo "This add-on requires DDEV v1.23+ or higher, please upgrade." && exit 2
# fi
# - 'echo "what is your platform.sh token" && read x'
# This item shows templating using DDEV environment variables.
# - |
# #ddev-description:Touch a file to create it
# touch ${DDEV_APPROOT}/.ddev/somefile.${DDEV_PROJECT_TYPE}.${DDEV_DOCROOT}.txt
# This item shows complex go templating possibilities based on yaml_read_files
# - |
# #ddev-description:Create a config.platformsh.yaml
# cat <<EOF >${DDEV_APPROOT}/.ddev/config.platformsh.yaml
# php_version: {{ trimPrefix "php:" .platformapp.type }}
# database:
# type: {{ regexReplaceAll ":.*$" .services.db.type "" }}
# version: {{ regexReplaceAll "^.*:" .services.db.type "" }}
# docroot: {{ dig "web" "locations" "/" "root" "notfound" .platformapp }}
# {{- if eq .platformapp.build.flavor "composer" }}
# hooks:
# post-start:
# - composer: install
# {{- if .platformapp.hooks.deploy }}
# - exec: "{{ trimAll "\n" .platformapp.hooks.deploy | splitList "\n" | join ` && ` }}"
# {{- end }}
# {{- end }}
# EOF
# list of files and directories listed that are copied into project .ddev directory
# Each file should contain #ddev-generated so it can be replaced by a later `ddev get`
# if it hasn't been modified by the user.
# DDEV environment variables can be interpolated into these filenames
# If you use directories, they must be directories that are managed
# by this add-on, or removal could remove things that are not owned by it
project_files:
- config.annertech.yaml
- settings.local.devmode.php
- settings.local.perfmode.php
- scripts
- commands/host/branch
- commands/host/cex
- commands/host/cim
- commands/host/cloudflare
- commands/host/cr
- commands/host/devmode
- commands/host/githooks
- commands/host/login
- commands/host/protect
- commands/host/remote-db
- commands/host/timeslip
- commands/web/behat
- commands/web/check-annertech-ddev
- commands/web/platform
- commands/web/robo
- commands/web/solr-update-config
- nginx
# - some-directory/file1.txt
# - some-directory/file2.txt
# - extra_files_dir_created_by_this_template/
# - somefile.sh
# List of files and directories that are copied into the global .ddev directory
# DDEV environment variables can be interpolated into these filenames
# We are copying universal commands in the global folder too, so that users can use them
# even if a project doesn't have the addon installed yet.
# Project level commands take priority.
global_files:
- commands/host/open-issue
- commands/host/timew
- commands/host/branch
- commands/host/cloudflare
- commands/host/login
- commands/host/timeslip
- commands/host/travel-mode
# Version constraint for DDEV that will be validated against the running DDEV executable
# and prevent add-on from being installed if it doesn't validate.
# See https://github.com/Masterminds/semver#checking-version-constraints for constraint rules.
# Available with DDEV v1.23.4+, and works only for DDEV v1.23.4+ binaries
# example: ddev_version_constraint: '>= v1.23.4'
ddev_version_constraint: '>= v1.24.2'
# List of add-on names that this add-on depends on
dependencies:
# - redis
# DDEV environment variables can be interpolated into these actions.
# post_install_actions are executed in the context of the target project's .ddev directory.
post_install_actions:
- |
if [ ! -f ${DDEV_APPROOT}/.ddev/.env ]; then
cp ${DDEV_APPROOT}/.ddev/scripts/sample.env ${DDEV_APPROOT}/.ddev/.env
echo "Please configure upstream provider in .ddev/.env file!"
fi
- |
if [ -f ${DDEV_APPROOT}/nginx/noindex.conf ]; then
rm ${DDEV_APPROOT}/nginx/noindex.conf
fi
- cp -r ${DDEV_APPROOT}/.ddev/scripts/.vscode ${DDEV_APPROOT}/
- git add ${DDEV_APPROOT}/.ddev/config.annertech.yaml -f
- git add ${DDEV_APPROOT}/.ddev/settings.local.*mode.php -f
- git add ${DDEV_APPROOT}/.ddev/commands/host/branch -f
- git add ${DDEV_APPROOT}/.ddev/commands/host/cloudflare -f
- git add ${DDEV_APPROOT}/.ddev/commands/host/devmode -f
- git add ${DDEV_APPROOT}/.ddev/commands/host/githooks -f
- git add ${DDEV_APPROOT}/.ddev/commands/host/login -f
- git add ${DDEV_APPROOT}/.ddev/commands/host/protect -f
- git add ${DDEV_APPROOT}/.ddev/commands/host/remote-db -f
- git add ${DDEV_APPROOT}/.ddev/commands/host/timeslip -f
- git add ${DDEV_APPROOT}/.ddev/commands/web/behat -f
- git add ${DDEV_APPROOT}/.ddev/commands/web/check-annertech-ddev -f
- git add ${DDEV_APPROOT}/.ddev/commands/web/robo -f
- git add ${DDEV_APPROOT}/.ddev/commands/web/platform -f
- git add ${DDEV_APPROOT}/.ddev/commands/web/solr-update-config -f
- git add ${DDEV_APPROOT}/.ddev/nginx/ -f
- git add ${DDEV_APPROOT}/.ddev/scripts/ -f
- git add ${DDEV_APPROOT}/.ddev/.env -f
- git add ${DDEV_APPROOT}/.ddev/addon-metadata/ -f
- git add ${DDEV_APPROOT}/.vscode -f
- cp -r ${DDEV_APPROOT}/.ddev/scripts/git-hooks/commit-msg ${DDEV_APPROOT}/.git/hooks/commit-msg
- chmod +x ${DDEV_APPROOT}/.git/hooks/commit-msg
# Shell actions that can be done during removal of the add-on.
# Files listed in project_files section will be automatically removed here if they contain #ddev-generated line.
# removal_actions are executed in the context of the target project's .ddev directory.
removal_actions:
- rm config.annertech.yaml
- rm settings.local.perfmode.php
- rm settings.local.devmode.php
- rm commands/host/branch
- rm commands/host/protect
- rm commands/host/branch
- rm commands/host/cex
- rm commands/host/cim
- rm commands/host/cloudflare
- rm commands/host/cr
- rm commands/host/devmode
- rm commands/host/githooks
- rm commands/host/login
- rm commands/host/remote-db
- rm commands/web/behat
- rm commands/web/check-annertech-ddev
- rm commands/web/platform
- rm commands/web/robo
- rm commands/web/solr-update-config
- rm nginx/libraries.conf
- rm nginx/protect.conf
- rm nginx/redirect.conf
- rm -rf scripts
- |
if [ -f ${DDEV_APPROOT}/config.hooks.yaml ]; then
if grep -q '#ddev-generated' ${DDEV_APPROOT}/config.hooks.yaml; then
rm -f ${DDEV_APPROOT}/config.hooks.yaml
echo "Unwilling to remove '${DDEV_APPROOT}/config.hooks.yaml' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete."
fi
fi
# Advanced usage - YAML files can be read in and then used as go template actions
# in pre_install_actions and post_install_actions
# See example in
# https://github.com/ddev/ddev/blob/master/cmd/ddev/cmd/testdata/TestCmdAddonComplex/recipe/install.yaml
yaml_read_files:
# someyaml: someyaml.yaml
# otheryaml: someotheryaml.yaml