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 f55bbc3
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 35 deletions.
23 changes: 23 additions & 0 deletions .docker/main/.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function drush() {
local dir=$(pwd)
while [ "$dir" != "/" ]; do
if [ -x "$dir/vendor/bin/drush" ]; then
"$dir/vendor/bin/drush" "$@"
return
fi
dir=$(dirname "$dir")
done
echo "Drush executable not found."
}

function drall() {
local dir=$(pwd)
while [ "$dir" != "/" ]; do
if [ -x "$dir/vendor/bin/drall" ]; then
"$dir/vendor/bin/drall" "$@"
return
fi
dir=$(dirname "$dir")
done
echo "Drall executable not found."
}
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
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
}
}
}
7 changes: 4 additions & 3 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Path Setup
run: |
echo "/opt/drupal/vendor/bin" >> $GITHUB_PATH
# - name: Path Setup
# run: |
# echo "/opt/drupal/vendor/bin" >> $GITHUB_PATH
- name: Determine Composer Cache Directory
id: composer-cache
run: |
Expand All @@ -31,6 +31,7 @@ jobs:
- name: Prepare
run: |
cp -r . /opt/drall
make provision/env
make provision
- name: Info
run: make info
Expand Down
37 changes: 20 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@ ssh:


.PHONY: provision
provision: provision/drall provision/drupal
provision: provision/drall provision/drupal provision/no-drupal


.PHONY: provision/env
provision/env:
cat /opt/drall/.docker/main/.profile >> ~/.profile
cat /opt/drall/.docker/main/.profile >> ~/.bashrc


.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 +38,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 +82,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 +107,5 @@ test:

.PHONY: info
info:
@cd $(DRUPAL_PATH)
@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 f55bbc3

Please sign in to comment.