diff --git a/Dockerfile b/Dockerfile index ed085ba4405acc5aaa25c729c49159b10ae08684..3ea3d8b1f3594d965971a207805d19d0a23c8d68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,13 +4,14 @@ FROM registry.lakedrops.com/docker/gitlab-drupal-ci:php-${PHP_VERSION} LABEL com.example.vendor="LakeDrops" \ maintainer="juergen.haas@lakedrops.com" \ - version="1.2.0" \ + version="1.2.1" \ description="Drupal development environment from LakeDrops." ENV LAKEDROPS_DEV_ENV 1 ENV LAKEDROPS_DEV_DC_OPTIONS " " ADD config.fish /etc/fish/ +ADD start-new-project /usr/local/bin/ RUN echo "Install dorgflow" && \ cd /var/opt && \ diff --git a/l3d b/l3d index 50357a6952bb42db6a68a860a66bb6fe448588c9..a3ff1f1dc2645656243d961603b1af6647a4235c 100755 --- a/l3d +++ b/l3d @@ -97,7 +97,13 @@ function start { --restart unless-stopped \ registry.lakedrops.com/docker/l3d:php-${PHP_VERSION} fi - docker exec -it ${COMPOSE_PROJECT_NAME}_l3d /usr/bin/fish + + EXISTING=$(ls -1) + if [[ -n "$EXISTING" ]]; then + docker exec -it ${COMPOSE_PROJECT_NAME}_l3d /usr/bin/fish + else + docker exec -it ${COMPOSE_PROJECT_NAME}_l3d /usr/local/bin/start-new-project + fi fi } diff --git a/start-new-project b/start-new-project new file mode 100755 index 0000000000000000000000000000000000000000..7aca5de49f63a8d7f806f7b852e4d5e1d28cd33a --- /dev/null +++ b/start-new-project @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +EXISTING=$(ls -1) +if [[ -n "$EXISTING" ]]; then + exit +fi + +echo "Lets start a new project here ..." +echo "" +echo "Options to start:" +echo " 1 LakeDrops Drupal 8 project template" +echo " 2 Drupal's community project template" +echo " 3 Existing git repository" +echo "" +echo "" + +function truncateCurrentDirectory { + if [[ -f ".env" ]]; then + export $(cat .env | xargs) > /dev/null 2>&1 + fi + rm .* > /dev/null 2>&1 +} + +function create { + truncateCurrentDirectory + composer create-project ${PROJECT} . --no-interaction +} + +while true; do + read -p "Choose an option: " OPTION + case ${OPTION} in + + 1 ) + PROJECT="lakedrops/d8-project" + create + break + ;; + + 2 ) + PROJECT="drupal-composer/drupal-project:8.x-dev" + create + break + ;; + + 3 ) + read -p "Repository URL: " REPOSITORY + if [[ -n "${REPOSITORY}" ]]; then + truncateCurrentDirectory + git clone ${REPOSITORY} . + composer update + break + fi + ;; + + * ) + echo "Please try again." + ;; + esac +done + +/usr/bin/fish