Skip to content

Commit

Permalink
Allow running project-specific Drall
Browse files Browse the repository at this point in the history
  • Loading branch information
jigarius committed Dec 25, 2024
1 parent 4cef948 commit a6081b8
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .docker/main/.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PATH=$(echo "$PATH" | sed -e "s/:\/opt\/drupal\/vendor\/bin//")
export PATH="/opt/drall/.docker/main/bin:$PATH"
7 changes: 4 additions & 3 deletions .docker/main/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions .docker/main/bin/drall
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions .docker/main/bin/drush
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions .docker/main/no-drupal/composer.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
32 changes: 15 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
12 changes: 7 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a6081b8

Please sign in to comment.