From be422bfa6557150bf37ea160f2c69906beaa7959 Mon Sep 17 00:00:00 2001 From: Michael Strelan Date: Fri, 9 Sep 2022 08:44:23 +1000 Subject: [PATCH 1/6] Add manual installation instructions --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 34ba6cd..5f54bc5 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ ## Prerequisites - * Composer * Docker / Docker compose + * Composer (optional) * PhpStorm (optional) ## Getting started @@ -16,6 +16,20 @@ To get started run the following command: composer create-project mstrelan/drupal-contrib ``` +### Manual installation + +You can install to project manually without php or composer on your host machine. + +``` +git clone git@github.com:mstrelan/drupal-contrib.git +cd drupal-contrib +make start +docker-compose exec php-cli composer run post-root-package-install +make clean +``` + +You may need to edit the .env file to set your UID and GID. + ## Directory structure * **app/** - this is the web root. The Drupal repo will be checked out here. From 75ebece96eb42c42c1ec4f9d5839666b4e4af29d Mon Sep 17 00:00:00 2001 From: Michael Strelan Date: Fri, 9 Sep 2022 08:45:35 +1000 Subject: [PATCH 2/6] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f54bc5..8650567 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ composer create-project mstrelan/drupal-contrib ### Manual installation -You can install to project manually without php or composer on your host machine. +You can install this project manually without php or composer on your host machine. ``` git clone git@github.com:mstrelan/drupal-contrib.git From a3f181d782da74a89a0f4f28565f672bb5585753 Mon Sep 17 00:00:00 2001 From: Michael Strelan Date: Fri, 9 Sep 2022 13:35:17 +1000 Subject: [PATCH 3/6] Improve manual installation process --- Makefile | 19 +++++++++++-- README.md | 6 ++--- assets/scaffold/{files => .idea}/php.xml | 0 assets/scaffold/{files => .idea}/symfony2.xml | 0 .../scaffold/{files => .idea}/workspace.xml | 0 src/ComposerScripts.php | 27 +++---------------- 6 files changed, 23 insertions(+), 29 deletions(-) rename assets/scaffold/{files => .idea}/php.xml (100%) rename assets/scaffold/{files => .idea}/symfony2.xml (100%) rename assets/scaffold/{files => .idea}/workspace.xml (100%) diff --git a/Makefile b/Makefile index fa20ff7..3b9f03b 100644 --- a/Makefile +++ b/Makefile @@ -9,13 +9,17 @@ DRUSH_INSTALL=$(DRUSH) -y site:install --account-pass=password GIT_SWITCH=cd app && git switch PHP_VERSION=8.0 -clean: composer minimal login +.PHONY: init clean composer start stop stop-php minimal standard umami login switch 9.3 9.4 9.5 10.0 10.1 php7.4 php8.0 php8.1 + +init: .env .idea app + +clean: app composer minimal login composer: rm -rf composer.lock vendor app/vendor $(EXEC) composer install -start: stop-php +start: stop-php .env PHP_VERSION=$(PHP_VERSION) docker-compose up --build -d stop: @@ -67,3 +71,14 @@ php8.0: php8.1: make start -e PHP_VERSION=8.1 + +.env: + cp .env.dist .env + sed -i 's/UID=1000/UID=$(shell id -u)/g' .env + sed -i 's/GID=1000/GID=$(shell id -g)/g' .env + +.idea: + cp -R assets/scaffold/.idea/ .idea/ + +app: + git clone git@git.drupal.org:project/drupal.git app/ diff --git a/README.md b/README.md index 8650567..4599500 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ To get started run the following command: ``` composer create-project mstrelan/drupal-contrib +make start clean ``` ### Manual installation @@ -23,9 +24,7 @@ You can install this project manually without php or composer on your host machi ``` git clone git@github.com:mstrelan/drupal-contrib.git cd drupal-contrib -make start -docker-compose exec php-cli composer run post-root-package-install -make clean +make init start clean ``` You may need to edit the .env file to set your UID and GID. @@ -56,6 +55,7 @@ The following services are available: Make commands should be executed on the host machine. +* `init` - initialises the project for the first time * `clean` - runs composer install, installs minimal profile and provides a one-time login link * `start` - starts the stack * `stop` - stops the stack diff --git a/assets/scaffold/files/php.xml b/assets/scaffold/.idea/php.xml similarity index 100% rename from assets/scaffold/files/php.xml rename to assets/scaffold/.idea/php.xml diff --git a/assets/scaffold/files/symfony2.xml b/assets/scaffold/.idea/symfony2.xml similarity index 100% rename from assets/scaffold/files/symfony2.xml rename to assets/scaffold/.idea/symfony2.xml diff --git a/assets/scaffold/files/workspace.xml b/assets/scaffold/.idea/workspace.xml similarity index 100% rename from assets/scaffold/files/workspace.xml rename to assets/scaffold/.idea/workspace.xml diff --git a/src/ComposerScripts.php b/src/ComposerScripts.php index d341110..d6166b7 100644 --- a/src/ComposerScripts.php +++ b/src/ComposerScripts.php @@ -12,32 +12,14 @@ class ComposerScripts { * Configure environment variables. */ public static function configureEnvironment(Event $event): void { - if (file_exists('.env')) { - return; - } - $io = $event->getIO(); - $io->write("Configuring environment"); - $dist = file_get_contents('.env.dist'); - file_put_contents('.env', str_replace([ - 'UID=1000', - 'GID=1000', - ], [ - sprintf('UID=%d', posix_geteuid()), - sprintf('GID=%d', posix_getegid()), - ], $dist)); - $io->write(file_get_contents('.env')); + system('make .env'); } /** * Clones Drupal core in to the app directory. */ public static function gitCloneDrupalCore(Event $event): void { - if (file_exists('app/.git')) { - return; - } - $io = $event->getIO(); - $io->write("Cloning Drupal core into 'app'"); - system('git clone https://git.drupalcode.org/project/drupal.git app'); + system('make app'); } /** @@ -52,10 +34,7 @@ public static function configurePhpStorm(Event $event): void { return; } $io->write("Configuring PhpStorm"); - mkdir('.idea'); - copy('assets/scaffold/files/php.xml', '.idea/php.xml'); - copy('assets/scaffold/files/symfony2.xml', '.idea/symfony2.xml'); - copy('assets/scaffold/files/workspace.xml', '.idea/workspace.xml'); + system('make .idea'); } } From 5ebb0ecad5b966f151cc97fbd29ff7f80790e039 Mon Sep 17 00:00:00 2001 From: Michael Strelan Date: Fri, 9 Sep 2022 13:36:16 +1000 Subject: [PATCH 4/6] README update --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 4599500..abb2c09 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,6 @@ cd drupal-contrib make init start clean ``` -You may need to edit the .env file to set your UID and GID. - ## Directory structure * **app/** - this is the web root. The Drupal repo will be checked out here. From 2c1d310d419c5f06440380336fa81affb2309823 Mon Sep 17 00:00:00 2001 From: Michael Strelan Date: Fri, 9 Sep 2022 13:37:17 +1000 Subject: [PATCH 5/6] README update --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index abb2c09..db0772d 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ To get started run the following command: ``` composer create-project mstrelan/drupal-contrib +cd drupal-contrib make start clean ``` From b46acf5abdf1bdd316b695b47300e3d8e5410ee6 Mon Sep 17 00:00:00 2001 From: Michael Strelan Date: Fri, 9 Sep 2022 13:44:12 +1000 Subject: [PATCH 6/6] HTTP checkout --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3b9f03b..0514d8d 100644 --- a/Makefile +++ b/Makefile @@ -81,4 +81,4 @@ php8.1: cp -R assets/scaffold/.idea/ .idea/ app: - git clone git@git.drupal.org:project/drupal.git app/ + git clone https://git.drupalcode.org/project/drupal.git app/