Replace Makefile with workspace

This commit is contained in:
Oliver Davies 2020-07-23 22:32:43 +01:00 committed by Oliver Davies
parent bb5572dfd5
commit 177e19f7d2
5 changed files with 52 additions and 37 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@
!/patches/ !/patches/
!/README.md !/README.md
!/tools/ !/tools/
!/workspace.yml

View file

@ -1,23 +0,0 @@
default: init
app-install: copy-required-files
docker-compose run --rm php vendor/bin/drush site:install -y \
--existing-config \
--site-name="Stream Demo" \
--account-pass=admin123
copy-required-files: vendor
cp .env.example .env
cp .docker.env.example .docker.env
init: copy-required-files start app-install
start: copy-required-files
docker-compose up -d
stop:
docker-compose down --remove-orphans
vendor: composer.json composer.lock
docker-compose run --rm composer validate
docker-compose run --rm composer install

View file

@ -23,38 +23,32 @@ Using Drupal's Composer Scaffold
### Starting the project ### Starting the project
The project is using Docker and Docker Compose for local development. The project is using Docker, Docker Compose and [Workspace](https://github.com/my127/workspace) for local development.
Run the `make` command to create the required files, download Drupal core, the additional contrib modules and PHP libraries, and install Drupal. Once Workspace is installed, run `ws install` to create the required files, download Drupal core, the additional contrib modules and PHP libraries, and install Drupal.
If you are using [Traefik](https://docs.traefik.io) (recommended), then the site should now be available at <http://stream-demo.docker.localhost>. If you are using [Traefik](https://docs.traefik.io) (recommended), then the site should now be available at <http://stream-demo.docker.localhost>.
### Running Composer commands ### Running Composer commands
Compser commands can be run via the `docker-compose run` command: Compser commands can be run via the `ws composer` command:
``` ```
docker-compose run --rm composer <command> ws composer <command>
``` ```
For example, to add the Admin Toolbar module: For example, to add the Admin Toolbar module:
``` ```
docker-compose run --rm composer require drupal/admin_toolbar ws composer require drupal/admin_toolbar
``` ```
### Running Drush commands ### Running Drush commands
Drush commands can be run via the `docker-compose run` command: Drush commands can be run via the `ws drush` command. For example, to rebuild the cache:
``` ```
docker-compose run --rm php vendor/bin/drush <command> ws drush cache:rebuild
``` ```
For example, to rebuild the cache: Alternatively, you could connect to the `php` container using `ws console` and run `vendor/bin/drush <command>` within the container.
```
docker-compose run --rm php vendor/bin/drush cache:rebuild
```
Alternatively, you could connect to the `php` container using `docker-compose exec php` and run `vendor/bin/drush <command>` within the container.

View file

@ -28,6 +28,8 @@ services:
- .:/srv/app - .:/srv/app
env_file: env_file:
- .env - .env
environment:
- DRUSH_OPTIONS_URI
links: links:
- mysql - mysql
networks: networks:

41
workspace.yml Normal file
View file

@ -0,0 +1,41 @@
command('composer %'): |
#!bash|=
passthru "docker-compose run --rm composer ={ input.argument('%') }"
command('console'): |
#!bash
passthru "docker-compose run --rm php bash"
command('disable'): |
#!bash
run "docker-compose down --remove-orphans"
command('destroy'): |
#!bash
run "docker-compose down --remove-orphans -v"
command('drush %'):
env:
DRUSH_OPTIONS_URI: = @('app.url')
exec: |
#!bash|=
passthru "docker-compose run --rm php vendor/bin/drush ={ input.argument('%') }"
command('enable'): |
#!bash
run "docker-compose up -d"
command('install'): |
#!bash|@
run "cp .docker.env.example .docker.env"
run "cp .env.example .env"
run "ws composer validate"
run "ws composer install"
run "ws enable"
run "ws drush site:install -y --existing-config --account-pass=@('admin.password')"
attributes:
admin:
password: secret
app:
url: http://stream-demo.docker.localhost