Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add manual installation instructions #8

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 https://git.drupalcode.org/project/drupal.git app/
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

## Prerequisites

* Composer
* Docker / Docker compose
* Composer (optional)
* PhpStorm (optional)

## Getting started
Expand All @@ -14,6 +14,18 @@ To get started run the following command:

```
composer create-project mstrelan/drupal-contrib
cd drupal-contrib
make start clean
```

### Manual installation

You can install this project manually without php or composer on your host machine.

```
git clone [email protected]:mstrelan/drupal-contrib.git
cd drupal-contrib
make init start clean
```

## Directory structure
Expand Down Expand Up @@ -42,6 +54,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
Expand Down
File renamed without changes.
File renamed without changes.
27 changes: 3 additions & 24 deletions src/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand All @@ -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');
}

}