Add Drupal application

This commit is contained in:
Oliver Davies 2019-06-05 19:35:24 +01:00
parent c00b769d67
commit 4bb39011f3
261 changed files with 22997 additions and 0 deletions
drupal/.docksal

1
drupal/.docksal/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/docksal-local.*

View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
#: exec_target = cli
## Creates a phpunit.xml file and runs PHPUnit tests in Drupal 8
##
## Usage: fin phpunit <args>
##
## This first ensures that a `core/phpunit.xml` file exists, either by copying a
## stub from `.docksal/drupal/core/phpunit.xml` if that exists, or copying and
## renaming `core/phpunit.xml.dist`.
##
## If `core/phpunit.xml` exists, the phpunit command with then be run, appending
## any optional arguments such as the directory path (run `fin phpunit -h`) to
## see a full list of options.
DOCROOT_PATH="${PROJECT_ROOT}/${DOCROOT}"
DRUPAL_CORE_PATH="${DOCROOT_PATH}/core"
run_tests() {
${PROJECT_ROOT}/vendor/bin/phpunit -c ${DRUPAL_CORE_PATH} "$@"
}
if [ ! -e ${DRUPAL_CORE_PATH}/phpunit.xml ]; then
if [ -e "${PROJECT_ROOT}/.docksal/drupal/core/phpunit.xml" ]; then
echo "Copying ${PROJECT_ROOT}/.docksal/drupal/core/phpunit.xml to ${DRUPAL_CORE_PATH}/phpunit.xml"
cp "${PROJECT_ROOT}/.docksal/drupal/core/phpunit.xml" ${DRUPAL_CORE_PATH}/phpunit.xml
run_tests "$@"
else
echo "Copying phpunit.xml.dist to phpunit.xml."
echo "Please edit it's values as needed and re-run 'fin phpunit'."
cp ${DRUPAL_CORE_PATH}/phpunit.xml.dist ${DRUPAL_CORE_PATH}/phpunit.xml
exit 1;
fi
else
run_tests "$@"
fi

View file

@ -0,0 +1,67 @@
#!/usr/bin/env bash
## Opens SequelPro
##
## Usage: fin sequelpro
# Abort if anything fails
set -e
container_port=$(docker ps --all --filter 'label=com.docker.compose.service=db' --filter "label=com.docker.compose.project=${COMPOSE_PROJECT_NAME}" --format '{{.Ports}}' | sed 's/.*0.0.0.0://g'|sed 's/->.*//g')
HOST=${VIRTUAL_HOST}
DB=${MYSQL_DATABASE:-default}
USER=${MYSQL_USER:-user}
PASS=${MYSQL_PASSWORD:-user}
NAME=${COMPOSE_PROJECT_NAME}
PORT=${PORT:-$container_port}
FILENAME=/tmp/docksal-sequelpro-${RANDOM}.spf
cat <<EOT >> $FILENAME
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ContentFilters</key>
<dict/>
<key>auto_connect</key>
<true/>
<key>data</key>
<dict>
<key>connection</key>
<dict>
<key>database</key>
<string>${DB}</string>
<key>host</key>
<string>${HOST}</string>
<key>name</key>
<string>${NAME}</string>
<key>user</key>
<string>${USER}</string>
<key>password</key>
<string>${PASS}</string>
<key>port</key>
<integer>${PORT}</integer>
<key>rdbms_type</key>
<string>mysql</string>
</dict>
<key>session</key>
<dict/>
</dict>
<key>encrypted</key>
<false/>
<key>format</key>
<string>connection</string>
<key>queryFavorites</key>
<array/>
<key>queryHistory</key>
<array/>
<key>rdbms_type</key>
<string>mysql</string>
<key>version</key>
<integer>1</integer>
</dict>
</plist>
EOT
open $FILENAME

49
drupal/.docksal/addons/uli/uli Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env bash
die ()
{
echo "$1"
exit 1
}
## Generate one time user login link. Add -s to use https in url.
## Usage fin uli @drushalias -s
## The drush alias and -s flags are optional.
cd "$PROJECT_ROOT/$DOCROOT" || die "Could not change dir to $PROJECT_ROOT/$DOCROOT"
https=0 # Default to not use https
# Check the first two options / arguments given on the the command line for
# what looks like a Drush site alias or the -s option to use https in the url.
count=2
while [ $count -ne 0 ]; do
if [[ $1 == @* ]]; then
drushalias=$1
shift 1
elif [[ $1 == "-s" ]]; then
https=1
shift 1
fi
count=$[$count-1]
done
if [ $https -eq 0 ]; then
uli=$(fin drush $drushalias uli "$@" 2>&1 | sed "s/default/$VIRTUAL_HOST/")
elif [ $https -eq 1 ]; then
uli=$(fin drush $drushalias uli "$@" 2>&1 | sed "s/default/$VIRTUAL_HOST/" | sed "s/http\:/https:/")
else
exit 2
fi
echo "$uli"
[[ "$uli" == *"Error"* ]] && exit 1
# Mac OSX copy uli to clipboard with pbcopy
( which pbcopy >/dev/null 2>&1 ) &&
echo "$uli" | pbcopy &&
echo "[+] Copied to clipboard"
# Linux copy uli to both the selection buffer and clipboard with xclip.
( which xclip >/dev/null 2>&1 ) &&
echo "$uli" | xclip -i -sel c -f |xclip -i -sel p &&
echo "[+] Copied to clipboard and selection buffer"

28
drupal/.docksal/commands/init Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
## Initialise the project
##
## Usage: fin init
fin start
fin run composer install
fin drush site:install -y
# Reset the site uuid.
fin drush config:set -y system.site uuid de7ba5dc-5795-4cb5-9d38-1edcc27be491
# Delete the uuid for shortcut.set.default so that config will import.
fin drush config:delete -y shortcut.set.default uuid
# Import config.
fin drush config:import -y --source=../config/sync
fin drush php:eval '\Drupal::service("Drupal\dtc_import\Service\Importer\CsvSpeakerImporter")->import()'
fin drush php:eval '\Drupal::service("Drupal\dtc_import\Service\Importer\CsvSessionImporter")->import()'
fin drush user:create api --password=api
fin drush user:role:add api_user api
fin uli

View file

@ -0,0 +1,6 @@
COMPOSE_PROJECT_NAME="blueconf"
DOCKSAL_STACK=default
DOCROOT="web"
MYSQL_DATABASE=default
MYSQL_PASSWORD=user
MYSQL_USER=user

View file

@ -0,0 +1,8 @@
version: "2.1"
services:
cli:
environment:
- MYSQL_DATABASE
- MYSQL_PASSWORD
- MYSQL_USER