diff --git a/CHANGELOG b/CHANGELOG index 763d4747af77b6fa59f1056c3e25a2d2c38e3845..ef3a5982b19e5292ca4f0326a08f6399629bd0d0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,22 @@ +v1.12.4 2020-03-31 +------------------ +Ensure .composer/auth.json and .gitconfig more explicitly +Make sure to always write the .env file after having started the container +Add mechanism to interact with extra|l3d in composer.json when starting l3d + +v1.12.3 2020-02-17 +------------------ +Correct the path to the user home directory on Mac OS X in the readme file +Make sure that .gitconfig and composer's auth.json exist even before l3drun gets started, not before l3d project container starts as that's too late + +v1.12.2 2020-02-12 +------------------ +Better define the destination for composer create project which is required on some Macs + +v1.12.1 2020-02-10 +------------------ +Force update to update to composer version 1.9.3 + v1.12.0 2020-01-12 ------------------ docker/l3d#4 Set permissions after "drush generate" diff --git a/Dockerfile b/Dockerfile index 05d54a45644d4c96af7a770f2edfd8d07c70930a..81e56ab0005db346fb91501f022152682cec16e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ ENV LAKEDROPS_DEV_DC_OPTIONS " " ADD config.fish /etc/fish/ ADD start.sh /usr/local/bin/.start ADD configIdea.sh /usr/local/bin/.configIdea +ADD l3dComposer.php /usr/local/bin/.l3dComposer.php RUN echo "Install dorgflow" && \ cd /var/opt && \ diff --git a/README.md b/README.md index f89865944f0f44cb7dac3ef4e123f95196488626..dc8bcdef41bab194282e685f6a84d1c5c0004cdc 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,10 @@ This requires [socat](https://linux.die.net/man/1/socat). You can install that w Then use the following command to install L3D (replace `myname` with your correct username: ```bash -docker run -v /User/myname/bin:/setup --rm registry.lakedrops.com/docker/l3d/setup:latest +docker run -v /Users/myname/bin:/setup --rm registry.lakedrops.com/docker/l3d/setup:latest ``` -Then make sure that the directory `/User/myname/bin` is included in the PATH environment variable or create a symbolic link in `/usr/local/bin`. If you work with a symbolic link, MacOS also requires [coreutils](https://de.wikipedia.org/wiki/GNU_Core_Utilities) which can be installed with `brew install coreutils` or `sudo port install coreutils`. +Then make sure that the directory `/Users/myname/bin` is included in the PATH environment variable or create a symbolic link in `/usr/local/bin`. If you work with a symbolic link, MacOS also requires [coreutils](https://de.wikipedia.org/wiki/GNU_Core_Utilities) which can be installed with `brew install coreutils` or `sudo port install coreutils`. ## Verifying SSH diff --git a/l3dComposer.php b/l3dComposer.php new file mode 100644 index 0000000000000000000000000000000000000000..494381ce19aeab775506b8ba5acc2548cd75961a --- /dev/null +++ b/l3dComposer.php @@ -0,0 +1,28 @@ +<?php + +function loadEarly($items) { + foreach ($items as $path => $source) { + if (!file_exists($path)) { + if (!mkdir($path, 0777, TRUE) || !is_dir($path)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $path)); + } + exec('git clone ' . $source . ' ' . $path); + } + } +} + +print("a1"); +if (file_exists('composer.json')) { + print("a2"); + $composer = json_decode(file_get_contents('composer.json'), TRUE); + print("a2n"); + if (isset($composer['extra']['l3d'])) { + print("a3"); + foreach ($composer['extra']['l3d'] as $type => $args) { + print("a4: " . $type); + if ($type === 'load-early') { + loadEarly($args); + } + } + } +} diff --git a/run/scripts/start b/run/scripts/start index 445e18395ee4de6e52feb3048a0a2f1cdb913822..e580c360b2a51a38bba39668f8798b91f0f0203f 100755 --- a/run/scripts/start +++ b/run/scripts/start @@ -24,9 +24,6 @@ function startContainer { if [[ -n ${ID} ]]; then docker start ${COMPOSE_PROJECT_NAME}_l3d else - mkdir -p ${HOMEDIR}/.composer - touch ${HOMEDIR}/.composer/auth.json - touch ${HOMEDIR}/.gitconfig docker run --name ${COMPOSE_PROJECT_NAME}_l3d -dt \ --hostname ${COMPOSE_PROJECT_NAME}-l3d \ --env L3DSHELL=${L3DSHELL} \ diff --git a/setup/scripts/l3d b/setup/scripts/l3d index dc818f69d35d7eee05fc4867b4ebc34b468ce4fb..c478a9ddf9aa2296a4ad3dd631e3a68f10d4083c 100755 --- a/setup/scripts/l3d +++ b/setup/scripts/l3d @@ -22,6 +22,10 @@ case "${L3DHOSTOS}" in SCRIPTPATH="$(dirname "$(readlink -f "$0")")" esac +mkdir -p ${HOME}/.composer +touch ${HOME}/.composer/auth.json +touch ${HOME}/.gitconfig + ID=$(docker container ls --all -q -f name=^l3drun$) if [[ ! -n ${ID} ]]; then docker run --name=l3drun -dt --rm \ diff --git a/start.sh b/start.sh index 0eada59b482721c9c73e51bb02980cbd3a794901..3d17afaa9d960d5ef600e76c3a24dae66eace96f 100755 --- a/start.sh +++ b/start.sh @@ -1,5 +1,9 @@ #!/bin/bash +function l3dComposer { + php /usr/local/bin/.l3dComposer.php +} + function readEnv { if [[ -f ".env" ]]; then # shellcheck disable=SC2046 @@ -34,10 +38,11 @@ function create { fi truncateCurrentDirectory if [[ -n ${REPOSITORY} ]]; then - composer create-project "${PROJECT}" . --no-interaction --repository "${REPOSITORY}" + composer create-project "${PROJECT}" ./ --no-interaction --repository "${REPOSITORY}" else - composer create-project "${PROJECT}" . --no-interaction + composer create-project "${PROJECT}" ./ --no-interaction fi + l3dComposer restoreEnvFile if [[ -f "docker-compose.yml" ]]; then @@ -89,6 +94,7 @@ function create { function clone { truncateCurrentDirectory git clone "${REPOSITORY}" . + l3dComposer composer update restoreEnvFile } @@ -111,6 +117,7 @@ function initialSetup { case ${OPTION} in 0 ) restoreEnvFile + l3dComposer break ;; @@ -161,6 +168,8 @@ if [[ -z "$EXISTING" ]]; then else initialSetup fi +else + l3dComposer fi if [[ -d /drupal/.idea ]]; then @@ -172,3 +181,4 @@ if [[ -x "${L3DSHELL}" ]]; then else /usr/bin/fish fi +restoreEnvFile