From 9f8a6e65e9754e5282d4e4ba83b09e75e387ac1b Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 11 Apr 2019 10:46:37 +0200 Subject: [PATCH 1/8] Add additional info to the composer.json file --- composer.json | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 288294c..fb0e705 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,40 @@ { "name": "manuth/nuth.ch", "type": "silverstripe-recipe", - "description": "The source code of nuth.ch", "version": "1.0", + "description": "The source code of nuth.ch", + "authors": [ + { + "name": "Manuel Thalmann", + "email": "m@nuth.ch", + "homepage": "https://nuth.ch/" + } + ], + "license": "MIT", + "keywords": [ + "Homepage", + "Website", + "m@nuth", + "SilverStripe" + ], + "repositories": [ + { + "type": "git", + "url": "https://git.nuth.ch/manuth/nuth.ch.git" + } + ], + "support": { + "issues": "https://git.nuth.ch/manuth/nuth.ch/issues" + }, + "homepage": "https://nuth.ch/", + "scripts": { + "lint": "phpcs --report=csv ." + }, + "config": { + "process-timeout": 600 + }, + "prefer-stable": true, + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "silverstripe/recipe-plugin": "^1.2", @@ -13,9 +45,6 @@ "phpunit/phpunit": "^5.7", "squizlabs/php_codesniffer": "*" }, - "scripts": { - "lint": "phpcs --report=csv ." - }, "extra": { "project-files-installed": [ "app/.htaccess", @@ -31,10 +60,5 @@ "install.php", "web.config" ] - }, - "config": { - "process-timeout": 600 - }, - "prefer-stable": true, - "minimum-stability": "dev" + } } From 4962e89f4c3137e88975e9d4fa5ae0b573f21427 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 12 Apr 2019 10:04:07 +0200 Subject: [PATCH 2/8] Update all packages --- composer.lock | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index b055e20..096972c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a4dcebfb359ae2174165b199f26c9ef2", + "content-hash": "61f2f934e1828cc882b4efaebc45fe21", "packages": [ { "name": "composer/ca-bundle", @@ -2739,20 +2739,20 @@ }, { "name": "myclabs/deep-copy", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "78af75148f9fdd34ea727c8b529a9b4a8f7b740c" + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/78af75148f9fdd34ea727c8b529a9b4a8f7b740c", - "reference": "78af75148f9fdd34ea727c8b529a9b4a8f7b740c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", "shasum": "" }, "require": { - "php": "^7.2" + "php": "^7.1" }, "replace": { "myclabs/deep-copy": "self.version" @@ -2760,8 +2760,6 @@ "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpstan/phpstan": "^0.9.2", - "phpstan/phpstan-phpunit": "^0.9.4", "phpunit/phpunit": "^7.1" }, "type": "library", @@ -2785,7 +2783,7 @@ "object", "object graph" ], - "time": "2018-10-30T00:14:44+00:00" + "time": "2019-04-07T13:18:21+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -3908,16 +3906,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.4.1", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5b4333b4010625d29580eb4a41f1e53251be6baa" + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5b4333b4010625d29580eb4a41f1e53251be6baa", - "reference": "5b4333b4010625d29580eb4a41f1e53251be6baa", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", "shasum": "" }, "require": { @@ -3955,7 +3953,7 @@ "phpcs", "standards" ], - "time": "2019-03-19T03:22:27+00:00" + "time": "2019-04-10T23:49:02+00:00" }, { "name": "webmozart/assert", From 03ffe6e9ed400c37275fc32e2937bff56ffbaecc Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 13 Apr 2019 16:51:22 +0200 Subject: [PATCH 3/8] Rename the phpcs rule-file according to standards --- phpcs.xml.dist => .phpcs.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename phpcs.xml.dist => .phpcs.xml (100%) diff --git a/phpcs.xml.dist b/.phpcs.xml similarity index 100% rename from phpcs.xml.dist rename to .phpcs.xml From 8fec9f1dfba88c62453f99cb62f1c2e84c25161e Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 13 Apr 2019 16:51:46 +0200 Subject: [PATCH 4/8] Rework the phpcs-ruleset --- .phpcs.xml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index f6c501a..60d3624 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,6 +1,6 @@ - - Coding standard for SilverStripe 4.x + + A custom coding standard */themes/simple/* @@ -10,16 +10,24 @@ + + + + - + + + + - + + From b27b35936645684be1b5b660b25567c4511630e2 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 13 Apr 2019 17:29:27 +0200 Subject: [PATCH 5/8] Rework the files according to phpcs --- app/_config.php | 2 +- app/src/Page.php | 4 +--- app/src/PageController.php | 2 +- public/index.php | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/_config.php b/app/_config.php index 4b0ec70..d35c907 100644 --- a/app/_config.php +++ b/app/_config.php @@ -6,4 +6,4 @@ use SilverStripe\Security\Member; // remove PasswordValidator for SilverStripe 5.0 $validator = PasswordValidator::create(); // Settings are registered via Injector configuration - see passwords.yml in framework -Member::set_password_validator($validator); +Member::set_password_validator($validator); \ No newline at end of file diff --git a/app/src/Page.php b/app/src/Page.php index 010f07a..b3bbf37 100644 --- a/app/src/Page.php +++ b/app/src/Page.php @@ -10,6 +10,4 @@ namespace private static $has_one = []; } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/app/src/PageController.php b/app/src/PageController.php index f55aa2f..fa7ad25 100644 --- a/app/src/PageController.php +++ b/app/src/PageController.php @@ -30,4 +30,4 @@ namespace { // See: https://docs.silverstripe.org/en/developer_guides/templates/requirements/ } } -} +} \ No newline at end of file diff --git a/public/index.php b/public/index.php index 6ddcc98..cae08c5 100644 --- a/public/index.php +++ b/public/index.php @@ -16,4 +16,4 @@ $kernel = new CoreKernel(BASE_PATH); $app = new HTTPApplication($kernel); $app->addMiddleware(new ErrorControlChainMiddleware($app)); $response = $app->handle($request); -$response->output(); +$response->output(); \ No newline at end of file From 5fc718a534e1cd43b12d4e7adc492b5a7a513c78 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 13 Apr 2019 17:33:06 +0200 Subject: [PATCH 6/8] Improve the installation script --- scripts/install.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index b57daea..c9e6cd2 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,16 +1,13 @@ #!/bin/bash +appDir=$(dirname $(dirname $0)) destinationDir=$(pwd) tempDir=$(mktemp -d) -sourceDir="." -cd $(dirname $0) -cd .. - -rsync -a --delete $sourceDir/ $tempDir +rsync -a --delete $appDir/ $tempDir # Cleaning up the built website find $tempDir \ - -mindepth 1 -and \ + -mindepth 1 -maxdepth 1 -and \ -name "*" -and \ -not \( \ \( \ @@ -26,7 +23,7 @@ find $tempDir \ # Cleaning up the destination directory find $destinationDir \ - -mindepth 1 -and \ + -mindepth 1 -maxdepth 1 -and \ -name "*" -and \ -not -name ".env" \ -exec rm -rf {} + @@ -37,4 +34,4 @@ rsync -a $tempDir/ $destinationDir # Installing the website cd $destinationDir composer install -./vendor/bin/sake dev/build \ No newline at end of file +composer exec -- sake dev/build \ No newline at end of file From 39009e7f22cef6acdc0424940d5b832d528ac7fd Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 15 Apr 2019 10:38:15 +0200 Subject: [PATCH 7/8] Remove unnecessary commands from dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6806883..7a373e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,6 @@ RUN mv composer.phar /usr/local/bin/composer COPY --chown=www-data:www-data ./composer.* ./ RUN sudo -u www-data mkdir public RUN sudo -u www-data composer install -RUN ./vendor/bin/sake installsake COPY .docker/xdebug.ini $PHP_INI_DIR/conf.d/ COPY .docker/date.ini $PHP_INI_DIR/conf.d/ From 7e262e8fce2d7d214ae2e7603167c4496a0cdbcf Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 15 Apr 2019 13:18:46 +0200 Subject: [PATCH 8/8] Create separete dockerfiles for services --- Dockerfile => cms.Dockerfile | 0 db.Dockerfile | 1 + docker-compose.yml | 6 ++++-- 3 files changed, 5 insertions(+), 2 deletions(-) rename Dockerfile => cms.Dockerfile (100%) create mode 100644 db.Dockerfile diff --git a/Dockerfile b/cms.Dockerfile similarity index 100% rename from Dockerfile rename to cms.Dockerfile diff --git a/db.Dockerfile b/db.Dockerfile new file mode 100644 index 0000000..9aa8124 --- /dev/null +++ b/db.Dockerfile @@ -0,0 +1 @@ +FROM mysql:5 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 053694d..8b6e01b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: cms: build: context: . - dockerfile: ./Dockerfile + dockerfile: ./cms.Dockerfile networks: - nuth ports: @@ -14,7 +14,9 @@ services: depends_on: - db db: - image: mysql:5 + build: + context: . + dockerfile: ./db.Dockerfile networks: - nuth ports: