diff --git a/.docker/main/.profile b/.docker/main/.profile new file mode 100644 index 0000000..ed0d6ca --- /dev/null +++ b/.docker/main/.profile @@ -0,0 +1,2 @@ +PATH=$(echo "$PATH" | sed -e "s/:\/opt\/drupal\/vendor\/bin//") +export PATH="/opt/drall/.docker/main/bin:$PATH" diff --git a/.docker/main/Dockerfile b/.docker/main/Dockerfile index 7542749..b5824c6 100644 --- a/.docker/main/Dockerfile +++ b/.docker/main/Dockerfile @@ -13,8 +13,9 @@ RUN cp "$PHP_INI_DIR/php.ini-development" "$PHP_INI_PATH" \ RUN docker-php-ext-configure pcntl --enable-pcntl \ && docker-php-ext-install pcntl -# Provision Drall. COPY . /opt/drall - -# Provision Drupal. COPY Makefile /opt/drupal/Makefile +COPY Makefile /opt/no-drupal/Makefile + +RUN echo ". /opt/drall/.docker/main/.profile" >> /root/.profile +RUN echo ". /opt/drall/.docker/main/.profile" >> /root/.bashrc diff --git a/.docker/main/bin/drall b/.docker/main/bin/drall new file mode 100755 index 0000000..8089960 --- /dev/null +++ b/.docker/main/bin/drall @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +dir=$(pwd) +while [ "$dir" != "/" ]; do + if [ -x "$dir/vendor/bin/drall" ]; then + "$dir/vendor/bin/drall" "$@" + break + fi + dir=$(dirname "$dir") +done + +if [ "$dir" == "/" ]; then + echo "Drall executable not found." + exit 1 +fi diff --git a/.docker/main/bin/drush b/.docker/main/bin/drush new file mode 100755 index 0000000..e164779 --- /dev/null +++ b/.docker/main/bin/drush @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +dir=$(pwd) +while [ "$dir" != "/" ]; do + if [ -x "$dir/vendor/bin/drush" ]; then + "$dir/vendor/bin/drush" "$@" + break + fi + dir=$(dirname "$dir") +done + +if [ "$dir" == "/" ]; then + echo "Drush executable not found." + exit 1 +fi diff --git a/.docker/main/composer.json b/.docker/main/drupal/composer.json similarity index 86% rename from .docker/main/composer.json rename to .docker/main/drupal/composer.json index c1f07ed..84c0e1c 100644 --- a/.docker/main/composer.json +++ b/.docker/main/drupal/composer.json @@ -1,13 +1,7 @@ { - "name": "jigarius/drall-demo", - "description": "A Drupal demo site for developing and testing Drall.", + "description": "A Drupal site for developing and testing Drall.", "type": "project", "license": "GPL-2.0-or-later", - "homepage": "https://www.drupal.org/project/drupal", - "support": { - "docs": "https://www.drupal.org/docs/user_guide/en/index.html", - "chat": "https://www.drupal.org/node/314178" - }, "repositories": [ { "type": "composer", diff --git a/.docker/main/drush/sites/donnie.site.yml b/.docker/main/drupal/drush/sites/donnie.site.yml similarity index 100% rename from .docker/main/drush/sites/donnie.site.yml rename to .docker/main/drupal/drush/sites/donnie.site.yml diff --git a/.docker/main/drush/sites/leo.site.yml b/.docker/main/drupal/drush/sites/leo.site.yml similarity index 100% rename from .docker/main/drush/sites/leo.site.yml rename to .docker/main/drupal/drush/sites/leo.site.yml diff --git a/.docker/main/drush/sites/mikey.site.yml b/.docker/main/drupal/drush/sites/mikey.site.yml similarity index 100% rename from .docker/main/drush/sites/mikey.site.yml rename to .docker/main/drupal/drush/sites/mikey.site.yml diff --git a/.docker/main/drush/sites/ralph.site.yml b/.docker/main/drupal/drush/sites/ralph.site.yml similarity index 100% rename from .docker/main/drush/sites/ralph.site.yml rename to .docker/main/drupal/drush/sites/ralph.site.yml diff --git a/.docker/main/drush/sites/tmnt.site.yml b/.docker/main/drupal/drush/sites/tmnt.site.yml similarity index 100% rename from .docker/main/drush/sites/tmnt.site.yml rename to .docker/main/drupal/drush/sites/tmnt.site.yml diff --git a/.docker/main/sites/sites.bluish.php b/.docker/main/drupal/web/sites/sites.bluish.php similarity index 100% rename from .docker/main/sites/sites.bluish.php rename to .docker/main/drupal/web/sites/sites.bluish.php diff --git a/.docker/main/sites/sites.php b/.docker/main/drupal/web/sites/sites.php similarity index 100% rename from .docker/main/sites/sites.php rename to .docker/main/drupal/web/sites/sites.php diff --git a/.docker/main/sites/sites.reddish.php b/.docker/main/drupal/web/sites/sites.reddish.php similarity index 100% rename from .docker/main/sites/sites.reddish.php rename to .docker/main/drupal/web/sites/sites.reddish.php diff --git a/.docker/main/no-drupal/composer.json b/.docker/main/no-drupal/composer.json new file mode 100644 index 0000000..6469ae6 --- /dev/null +++ b/.docker/main/no-drupal/composer.json @@ -0,0 +1,29 @@ +{ + "description": "Project that contains Drall without Drupal.", + "type": "project", + "license": "GPL-2.0-or-later", + "repositories": [ + { + "type": "composer", + "url": "https://packages.drupal.org/8" + }, + { + "type": "path", + "url": "/opt/drall", + "options": { + "symlink": false + } + } + ], + "require": { + "jigarius/drall": "*" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "sort-packages": true, + "allow-plugins": { + "composer/installers": true + } + } +} diff --git a/Makefile b/Makefile index 64dac0d..754936f 100644 --- a/Makefile +++ b/Makefile @@ -4,18 +4,18 @@ ssh: .PHONY: provision -provision: provision/drall provision/drupal +provision: provision/drall provision/drupal provision/no-drupal .PHONY: provision/drupal provision/drupal: mkdir -p /opt/drupal - cp /opt/drall/.docker/main/composer.json /opt/drupal/ || echo "Skipping drupal/composer.json" + + cp /opt/drall/.docker/main/drupal/composer.json /opt/drupal/ || echo "Skipping: drupal/composer.json" rm -f /opt/drupal/composer.lock composer --working-dir=/opt/drupal install --no-progress - - cp -r /opt/drall/.docker/main/drush /opt/drupal/ || echo "Skipping drush directory." - cp -r /opt/drall/.docker/main/sites /opt/drupal/web/ || echo "Skipping sites directory." + cp -r /opt/drall/.docker/main/drupal/drush /opt/drupal/ || echo "Skipping: drupal/drush" + cp -r /opt/drall/.docker/main/drupal/web/sites /opt/drupal/web/ || echo "Skipping: drupal/web/sites." mkdir -p /opt/drupal/web/sites/default mkdir -p /opt/drupal/web/sites/donnie @@ -32,6 +32,14 @@ provision/drupal: @echo 'Drupal databases can be provisioned with: make provision/drupal/database' +.PHONY: provision/no-drupal +provision/no-drupal: + mkdir -p /opt/no-drupal + cp /opt/drall/.docker/main/no-drupal/composer.json /opt/no-drupal/ || echo "Skipping: no-drupal/composer.json" + rm -f /opt/no-drupal/composer.lock + composer --working-dir=/opt/no-drupal install --no-progress + + .PHONY: provision/drupal/database provision/drupal/database: rm -f web/sites/*/settings.php @@ -68,6 +76,7 @@ provision/drall: .PHONY: refresh refresh: rsync -Ervu --inplace --delete --exclude=.coverage --exclude=.phpunit.cache --exclude=.idea --exclude=.git --exclude=vendor /opt/drall/ /opt/drupal/vendor/jigarius/drall/ + rsync -Ervu --inplace --delete --exclude=.coverage --exclude=.phpunit.cache --exclude=.idea --exclude=.git --exclude=vendor /opt/drall/ /opt/no-drupal/vendor/jigarius/drall/ .PHONY: coverage-report/text @@ -92,17 +101,6 @@ test: .PHONY: info info: - @cd $(DRUPAL_PATH) + @echo "PWD: $(PWD)" @echo "Drupal path: $(DRUPAL_PATH)" - - which php - @php --version - - which composer @composer --version - - which drush - @drush --version - - which drall - @drall --version diff --git a/docker-compose.yml b/docker-compose.yml index 4645951..95594e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,12 +11,14 @@ services: - "8080:80" volumes: - .:/opt/drall - - .docker/main/sites/sites.php:/opt/drupal/web/sites/sites.php - - .docker/main/sites/sites.reddish.php:/opt/drupal/web/sites/sites.reddish.php - - .docker/main/sites/sites.bluish.php:/opt/drupal/web/sites/sites.bluish.php - - .docker/main/composer.json:/opt/drupal/composer.json - - .docker/main/drush:/opt/drupal/drush + - .docker/main/drupal/web/sites/sites.php:/opt/drupal/web/sites/sites.php + - .docker/main/drupal/web/sites/sites.reddish.php:/opt/drupal/web/sites/sites.reddish.php + - .docker/main/drupal/web/sites/sites.bluish.php:/opt/drupal/web/sites/sites.bluish.php + - .docker/main/drupal/composer.json:/opt/drupal/composer.json + - .docker/main/drupal/drush:/opt/drupal/drush + - .docker/main/no-drupal/composer.json:/opt/no-drupal/composer.json - ./Makefile:/opt/drupal/Makefile + - ./Makefile:/opt/no-drupal/Makefile environment: - DRALL_ENVIRONMENT=development