From a10e3eea93057a85cefd6f49db770abd0d5b865c Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 23 Jan 2019 00:39:03 +1100 Subject: [PATCH] Updated development stack and fixed CI. (#31) --- .circleci/config.yml | 55 +++----- .dockerignore | 4 - .editorconfig | 5 - .env | 58 ++++++-- .gitattributes | 11 +- .gitignore | 16 ++- Makefile | 215 ----------------------------- README.md | 4 - behat.yml | 76 ---------- composer.dev.json | 194 -------------------------- composer.json | 44 ++---- dev-init.sh | 21 +++ docker-compose.local.yml | 29 ---- docker-compose.yml | 33 ----- phpcs.xml | 36 ----- scripts/composer/ScriptHandler.php | 100 -------------- tide.install | 4 +- 17 files changed, 116 insertions(+), 789 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .editorconfig delete mode 100644 Makefile delete mode 100644 behat.yml delete mode 100644 composer.dev.json create mode 100755 dev-init.sh delete mode 100644 docker-compose.local.yml delete mode 100644 docker-compose.yml delete mode 100644 phpcs.xml delete mode 100644 scripts/composer/ScriptHandler.php diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ae349a..3c1167d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,55 +1,41 @@ version: 2 aliases: - - - &build + # Re-usable job to run different types of builds. + - &job-build working_directory: /app docker: - - image: singledigital/bay-circle:latest - environment: &environment - COMPOSER_ALLOW_SUPERUSER: 1 - COMPOSE_PROJECT_NAME: mysite - COMPOSE_FILE: docker-compose.yml - INSTALL_SUGGEST: 0 - BEHAT_PROFILE: "" + - image: &builder-image integratedexperts/ci-builder + environment: + INSTALL_NEW_SITE: 1 + LAGOON_ENVIRONMENT_TYPE: ci steps: - attach_workspace: at: /workspace - checkout + # Init environment for development. + - run: if [ -f "./dev-init.sh" ] && [ ! "$DEV_TOOLS" ]; then ./dev-init.sh; fi - setup_remote_docker: docker_layer_caching: true - version: 17.06.0-ce - - run: - name: Composer validate - # @dev - command: composer validate --ansi --strict --no-check-all - - run: - name: Start containers - command: | - printenv - echo "COMPOSE_FILE=$COMPOSE_FILE" >> .env.local - echo "GITHUB_TOKEN=$GITHUB_TOKEN" >> .env.local - echo "BEHAT_PROFILE=$BEHAT_PROFILE" >> .env.local - make docker-start - - run: - name: Copy files into container - command: docker cp -L /app/. $(docker-compose ps -q cli):/app/ - - run: - name: Install dev dependencies - command: make install + - run: .circleci/build.sh + - run: .circleci/test.sh - run: - name: Lint code - command: make lint + name: Copy artifacts + command: .circleci/test-artifacts.sh + when: always + - store_artifacts: + path: /tmp/artifacts jobs: build: - <<: *build + <<: *job-build build_suggest: - <<: *build + <<: *job-build docker: - - image: singledigital/bay-circle:latest + - image: *builder-image environment: - <<: *environment + INSTALL_NEW_SITE: 1 + LAGOON_ENVIRONMENT_TYPE: ci INSTALL_SUGGEST: 1 BEHAT_PROFILE: "--profile=suggest" @@ -58,3 +44,4 @@ workflows: main: jobs: - build + - build_suggest diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 49f7420..0000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -vendor -build -.idea -.git diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 5de2bca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,5 +0,0 @@ -[composer.{json,lock}] -indent_size = 4 - -[composer.*.{json,lock}] -indent_size = 4 diff --git a/.env b/.env index afcd454..b1adcbf 100644 --- a/.env +++ b/.env @@ -1,18 +1,48 @@ -MODULE_NAME=tide -COMPOSE_FILE=docker-compose.yml:docker-compose.local.yml -PHP_LINT_TARGETS="." -PHPCS_TARGETS="tide.info.yml" -COMPOSER_DEV_URL=https://raw.githubusercontent.com/dpc-sdp/tide/master/composer.dev.json?token=AAHUz0o0rlonLN0CbgcxwADlZo5zVyhvks5bVRWowA - -################################################################################ -# Local overrides. +## +# File with per-project environment variables. # -# Copy lines below into "env.local" file and exclude "env.local" file globally. -################################################################################ +# It is used by Ahoy and other scripts to read default values. +# +# The values must be scalar (cannot be another variable). This file must have +# at least 1 valid (exportable) assignment of value. +# +# You may create .env.local file and store your local environment variables +# there - it will also be loaded by Ahoy and it is excluded from git. +# +# This file may be left as is to assume default values specified in .ahoy.yml. -# Uncomment and epcify your GitHub token below (CI already uses this). -# GITHUB_TOKEN= +# Project name. +# Defaults to the name of the current directory with stripped hyphens and +# underscores. +# PROJECT_NAME=mysite -# Uncomment below to install suggsted packages. -# INSTALL_SUGGEST=1 +# Path to the root of the project inside of the container. +# APP=/app + +# Path to the site installation relative to the current directory. +# WEBROOT=docroot + +# Local development URL. +# Make sure that there is no trailing slash in the value. +# Defaults to http://.docker.amazee.io +# LOCALDEV_URL=http://mysite.docker.amazee.io +# Docker Compose project name. +# All containers will have this prefix. +# Defaults to $PROJECT_NAME +# COMPOSE_PROJECT_NAME=mysite + +# Database connection details. +# MYSQL_HOST=mariadb +# MYSQL_PORT=3306 + +# Change to composer.json for site build. +COMPOSER=composer.build.json + +# Uncomment this for site build and set the profile name. +DRUPAL_PROFILE=tide + +# Uncomment to run the build in suggest mode. +# In this mode, modules from "suggested" part of composer.json will be +# installed. +# INSTALL_SUGGEST=1 diff --git a/.gitattributes b/.gitattributes index 43d61a4..17ee2d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,11 +1,10 @@ # Ignore files for distribution archives. - .gitattributes export-ignore .gitignore export-ignore .github export-ignore +.circleci export-ignore +.circleci/config.yml export-ignore +.env export-ignore tests export-ignore -circle.yml export-ignore -composer.lock export-ignore -phpcs.xml export-ignore -phpunit.xml export-ignore -xdebug.sh export-ignore +composer.json export-ignore +dev-init.sh export-ignore diff --git a/.gitignore b/.gitignore index 17a4757..b1bbca1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,12 @@ -vendor -vendor-local +# To ignore OS temporary files use global .gitignore +# https://help.github.com/articles/ignoring-files/#create-a-global-gitignore + /composer.lock -build +/composer.build.json +/composer.build.lock +/docroot +/dpc-sdp +.env.local +docker-compose.override.yml screenshots -composer.dev.json -composer.build.json -composer.build.lock +vendor diff --git a/Makefile b/Makefile deleted file mode 100644 index 86acc5b..0000000 --- a/Makefile +++ /dev/null @@ -1,215 +0,0 @@ -## -# Build project dependncies. -# -# Usage: -# make -# -# make help - show a list of available targets. -# make build - build project -# -include .env --include .env.local - -.DEFAULT_GOAL := help -.PHONY: build clean clean-full docker-cli docker-destroy docker-restart docker-start docker-stop help install install-site install-module lint rebuild rebuild-full test-behat update-fixtures -.EXPORT_ALL_VARIABLES: ; - -## Build project. -build: - $(call title,Building project) - $(call exec,$(MAKE) docker-start) - $(call exec,$(MAKE) install) - $(call exec,$(MAKE) install-site) - @echo '' - $(call title,Build complete) - -## Remove dependencies. -clean: - $(call title,Removing dependencies) - $(call exec,[ -d $(WEBROOT)/sites/default ] && chmod -Rf 777 $(WEBROOT)/sites/default||true) - $(call exec,git ls-files --directory --other -i --exclude-from=.gitignore | xargs rm -Rf) - -## Remove dependencies and Docker images. -clean-full: docker-stop docker-destroy clean - -## Destroy Docker containers. -docker-destroy: - $(call title,Destroying Dockert containers) - $(call exec,docker-compose down) - -## Re-start Docker containers. -docker-restart: - $(call title,Restarting Docker containers) - $(call exec,docker-compose restart) - -## Start Docker containers. -docker-start: - $(call title,Starting Docker containers) - $(call exec,COMPOSE_CONVERT_WINDOWS_PATHS=1 docker-compose up -d $(filter-out $@,$(MAKECMDGOALS))) - $(call exec,if docker-compose logs |grep "\[Error\]"; then exit 1; fi) - @docker ps -a --filter name=^/$(COMPOSE_PROJECT_NAME)_ - -## Stop Docker containers. -docker-stop: - $(call title,Stopping Docker containers) - $(call exec,docker-compose stop $(filter-out $@,$(MAKECMDGOALS))) - -## Run Drush command. -drush: - $(call title,Executing Drush command inside CLI container) - $(call exec,docker-compose exec cli drush -r $(APP)/$(WEBROOT) $(filter-out $@,$(MAKECMDGOALS))) - -## Display this help message. -help: - @echo '' - @echo 'Usage:' - @echo ' ${YELLOW}make${RESET} ${GREEN}${RESET}' - @echo '' - @echo 'Targets:' - @awk '/^[a-zA-Z\-0-9][a-zA-Z\-\_0-9]+:/ { \ - helpMessage = match(lastLine, /^## (.*)/); \ - if (helpMessage) { \ - helpCommand = substr($$1, 0, index($$1, ":")-1); \ - helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ - printf " ${YELLOW}%-$(HELP_TARGET_WIDTH)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ - } \ - } \ - { lastLine = $$0 }' $(MAKEFILE_LIST) - -## Install dependencies -install: - $(call title,Installing dependencies) - $(call exec,docker-compose exec cli bash -c "if [ \"$(GITHUB_TOKEN)\" != \"\" ]; then composer config -g github-oauth.github.com $(GITHUB_TOKEN); fi") - $(call exec,docker-compose exec cli apk add --update make jq) - # Merge module's and development composer configs. - $(call exec,docker-compose exec cli bash -c "jq --indent 4 -M -s '.[0] * .[1]' $(APP)/composer.json $(APP)/composer.dev.json > $(COMPOSER_BUILD)") - $(call exec,docker-compose exec cli bash -c "COMPOSER=$(COMPOSER_BUILD) composer install -n --ansi --prefer-dist --no-suggest") - -## Install current module. -install-module: - $(call title,Installing current module and dependencies) - # If running with suggested modules, requre them first. - $(call exec,docker-compose exec cli bash -c "if [ "$(INSTALL_SUGGEST)" = "1" ] ; then cat $(COMPOSER_BUILD) | jq -r 'select(.suggest != null) | .suggest | keys[]' | xargs -i composer require {}; fi") - # Copy module code into local vendor directory. - $(call exec,docker-compose exec cli rm -Rf $(APP)/vendor-local/$(MODULE_NAME)) - $(call exec,docker-compose exec cli mkdir -p $(APP)/vendor-local/$(MODULE_NAME)) - $(call exec,docker-compose exec cli bash -c "git ls-tree HEAD --name-only|xargs -I '{}' cp -R '{}' $(APP)/vendor-local/$(MODULE_NAME)/") - # Add local module repository. - $(call exec,docker-compose exec cli bash -c "COMPOSER=$(COMPOSER_BUILD) composer config repositories.dpc-sdp/$(MODULE_NAME) path vendor-local/$(MODULE_NAME)") - # Require module from local repository. - $(call exec,docker-compose exec cli bash -c "COMPOSER=$(COMPOSER_BUILD) composer require dpc-sdp/$(MODULE_NAME)") - # If running with suggested modules, install them first. - $(call exec,docker-compose exec cli bash -c "if [ "$(INSTALL_SUGGEST)" = "1" ] ; then cat $(COMPOSER_BUILD) | jq -r 'select(.suggest != null) | .suggest | keys[]' | sed 's/dpc-sdp\///' | xargs -i drush -r $(APP)/$(WEBROOT) en -y {}; fi") - # Enable current module. - $(call exec,docker-compose exec cli drush -r $(APP)/$(WEBROOT) en -y $(MODULE_NAME)) - -## Install site. -install-site: - $(call title,Installing a site) - # Copy module code into local vendor directory. - $(call exec,docker-compose exec cli rm -Rf $(APP)/vendor-local/$(MODULE_NAME)) - $(call exec,docker-compose exec cli mkdir -p $(APP)/vendor-local/$(MODULE_NAME)) - $(call exec,docker-compose exec cli bash -c "git ls-tree HEAD --name-only|xargs -I '{}' cp -R '{}' $(APP)/vendor-local/$(MODULE_NAME)/") - # Add local module repository. - $(call exec,docker-compose exec cli bash -c "COMPOSER=$(COMPOSER_BUILD) composer config repositories.dpc-sdp/$(MODULE_NAME) path vendor-local/$(MODULE_NAME)") - # Require module from local repository. - $(call exec,docker-compose exec cli bash -c "COMPOSER=$(COMPOSER_BUILD) composer require dpc-sdp/$(MODULE_NAME)") - $(call exec,docker-compose exec cli drush -r $(APP)/$(WEBROOT) si tide -y --db-url=mysql://drupal:drupal@$(MYSQL_HOST)/drupal --account-name=admin --account-pass=admin install_configure_form.enable_update_status_module=NULL install_configure_form.enable_update_status_emails=NULL) - $(call exec,docker-compose exec cli bash -c "COMPOSER=$(COMPOSER_BUILD) composer --working-dir=$(APP)/$(BUILD) drupal-post-install") - -## Lint code. -lint: - $(call title,Linting code) - $(call exec,docker-compose exec cli vendor/bin/parallel-lint --exclude vendor $(PHP_LINT_EXCLUDES) -e $(PHP_LINT_EXTENSIONS) $(PHP_LINT_TARGETS)) - $(call exec,docker-compose exec cli vendor/bin/phpcs $(PHPCS_TARGETS)) - -update-fixtures: - $(call title,Updating fixture files for Drupal $(DRUPAL_VERSION)) - $(call exec,rsync -av --delete --no-progress --exclude-from=$(BUILD)/.rsync-exclude $(BUILD)/ $(FIXTURES)/d$(DRUPAL_VERSION)/) - -## Re-build project dependencies. -rebuild: clean build - -## Clean and fully re-build project dependencies. -rebuild-full: clean-full build - -## Run Behat tests. -test-behat: - $(call title,Running behat tests) - $(call exec,docker-compose exec cli vendor/bin/behat --format=progress_fail --strict --colors $(BEHAT_PROFILE) $(filter-out $@,$(MAKECMDGOALS))) - -#------------------------------------------------------------------------------- -# VARIABLES. -#------------------------------------------------------------------------------- -COMPOSE_PROJECT_NAME ?= app - -APP ?= /app -WEBROOT ?= build/docroot -BUILD ?= build -FIXTURES ?= tests/behat/fixtures -URL ?= http://$(MODULE_NAME).docker.amazee.io/ - -DRUPAL_VERSION ?= 8 -MODULES_PATH ?= modules -INSTALL_SUGGEST ?= 0 - -MYSQL_HOST ?= mariadb -MYSQL_PORT ?= 3306 - -PHP_LINT_EXTENSIONS ?= php,inc,module,theme,install -PHP_LINT_TARGETS ?= ./ -PHP_LINT_TARGETS := $(subst $\",,$(PHP_LINT_TARGETS)) -PHP_LINT_EXCLUDES ?= --exclude vendor --exclude node_modules --exclude build -PHP_LINT_EXCLUDES := $(subst $\",,$(PHP_LINT_EXCLUDES)) - -PHPCS_TARGETS := $(subst $\",,$(PHPCS_TARGETS)) - -# Path to a file with additional sanitization commands. -DB_SANITIZE_SQL ?= .dev/sanitize.sql - -# Prefix of the Docker images. -DOCKER_IMAGE_PREFIX ?= amazeeio - -# GitHub token to not be limited by API calls. -GITHUB_TOKEN ?= "" - -# Override composer configuration file with the one used for build. -COMPOSER_BUILD ?= $(APP)/composer.build.json - -# URL of the development Composer configuration file. -COMPOSER_DEV_URL ?= file:///composer.dev.json - -# Width of the target column in help target. -HELP_TARGET_WIDTH = 20 - -# Print verbose messages. -VERBOSE ?= 1 - -# Colors for output text. -GREEN := $(shell tput -Txterm setaf 2) -YELLOW := $(shell tput -Txterm setaf 3) -WHITE := $(shell tput -Txterm setaf 7) -RESET := $(shell tput -Txterm sgr0) - -#------------------------------------------------------------------------------- -# FUNCTIONS. -#------------------------------------------------------------------------------- - -## -# Execute command and display executed command to user. -# -define exec - @printf "$$ ${YELLOW}${subst ",',${1}}${RESET}\n" && $1 -endef - -## -# Display the target title to user. -# -define title - $(if $(VERBOSE),@printf "${GREEN}==> ${1}...${RESET}\n") -endef - -# Pass arguments from CLI to commands. -# @see https://stackoverflow.com/a/6273809/1826109 -%: - @: diff --git a/README.md b/README.md index 2acd77d..1b3afdf 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,6 @@ Tide is a Drupal 8 distribution focused on delivering an API first, headless Dru [![CircleCI](https://circleci.com/gh/dpc-sdp/tide.svg?style=svg)](https://circleci.com/gh/dpc-sdp/tide) -# Caveats - -Tide is on the alpha release, use with caution. APIs are likely to change before the stable version, that there will be breaking changes and that we're not supporting it for external production sites at the moment. - ## Tide modules - [tide_api](https://github.com/dpc-sdp/tide_api) - [tide_core](https://github.com/dpc-sdp/tide_core) diff --git a/behat.yml b/behat.yml deleted file mode 100644 index 230c13b..0000000 --- a/behat.yml +++ /dev/null @@ -1,76 +0,0 @@ -default: - autoload: [ %paths.base%/tests/behat/bootstrap ] - gherkin: - filters: - tags: "~@suggest&&~@skipped" - suites: - default: - paths: [ %paths.base%/tests/behat/features ] - contexts: - - FeatureContext - - Drupal\DrupalExtension\Context\MinkContext - - Drupal\DrupalExtension\Context\MarkupContext - - Drupal\DrupalExtension\Context\MessageContext - - IntegratedExperts\BehatScreenshotExtension\Context\ScreenshotContext - - Ubirak\RestApiBehatExtension\RestApiContext - - Ubirak\RestApiBehatExtension\Json\JsonContext - - extensions: - Behat\MinkExtension: - goutte: ~ - base_url: http://nginx:8080 - files_path: %paths.base%/tests/behat/fixtures - browser_name: chrome - selenium2: - wd_host: "http://selenium:4444/wd/hub" - capabilities: { "browser": "chrome", "version": "*", "marionette": true } - javascript_session: selenium2 - # Provides integration with Drupal APIs. - Drupal\DrupalExtension: - blackbox: ~ - api_driver: drupal - drush_driver: drush - drupal: - drupal_root: build/docroot - drush: - root: build/docroot - selectors: - message_selector: '.messages' - error_message_selector: '.messages.error' - success_message_selector: '.messages.status' - warning_message_selector: '.messages.warning' - region_map: - alert: '.region-alert' - header: '.region-header' - header_search: '.region-header-search' - menu: '.region-menu' - breadcrumb: '.region-breadcrumb' - feature: '.region-feature' - above_content: '.region-above-content' - content: '.region-content' - sidebar: '.region-sidebar' - above_footer: '.region-above-footer' - footer_first: '.region-footer-first' - footer_second: '.region-footer-second' - footer_third: '.region-footer-third' - footer_fourth: '.region-footer-fourth' - footer_fifth: '.region-footer-fifth' - footer_sixth: '.region-footer-sixth' - splash: '.region-splash' - disabled: '.region-disabled' - # Allows to capture HTML and JPG screenshots (based on the driver used). - IntegratedExperts\BehatScreenshotExtension: - dir: %paths.base%/screenshots - fail: true - purge: false - # Show explicit fail information and continue the test run. - IntegratedExperts\BehatFormatProgressFail\FormatExtension: ~ - Ubirak\RestApiBehatExtension\Extension: - rest: - base_url: http://nginx:8080 - store_response: true - -suggest: - gherkin: - filters: - tags: "~@nosuggest&&~@skipped" diff --git a/composer.dev.json b/composer.dev.json deleted file mode 100644 index c9bc51b..0000000 --- a/composer.dev.json +++ /dev/null @@ -1,194 +0,0 @@ - -{ - "name": "dpc-sdp/tide-dev", - "description": "Development configuration for all Tide modules. This file is merged with module's composer.json for development and testing.", - "license": "proprietary", - "require": { - "composer/installers": "^1.2.0", - "cweagans/composer-patches": "^1.6.0", - "drupal-composer/drupal-scaffold": "^2.3", - "webflo/drupal-finder": "^1.0", - "webmozart/path-util": "^2.3" - }, - "require-dev": { - "behat/behat": "^3.4", - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", - "drupal/coder": "^8.2.12", - "drupal/drupal-extension": "^v3.4", - "integratedexperts/behat-format-progress-fail": "^0.2", - "integratedexperts/behat-screenshot": "^0.7", - "integratedexperts/behat-steps": "^0.1.2", - "integratedexperts/behat-relativity": "^0.3", - "jakub-onderka/php-parallel-lint": "^1.0", - "php-http/curl-client": "^1.7", - "wimg/php-compatibility": "^8.1", - "ubirak/rest-api-behat-extension": "dev-feature/drupalextension-compatibility as 7.0.0" - }, - "autoload": { - "classmap": [ - "scripts/composer/" - ] - }, - "conflict": { - "drupal/core": "7.*" - }, - "repositories": { - "dpc-sdp/tide": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide.git" - }, - "dpc-sdp/tide_api": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_api.git" - }, - "dpc-sdp/tide_core": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_core.git" - }, - "dpc-sdp/tide_event": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_event.git" - }, - "dpc-sdp/tide_landing_page": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_landing_page.git" - }, - "dpc-sdp/tide_media": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_media.git" - }, - "dpc-sdp/tide_monsido": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_monsido.git" - }, - "dpc-sdp/tide_news": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_news.git" - }, - "dpc-sdp/tide_page": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_page.git" - }, - "dpc-sdp/tide_search": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_search.git" - }, - "dpc-sdp/tide_site": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_site.git" - }, - "dpc-sdp/tide_test": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_test.git" - }, - "dpc-sdp/tide_webform": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/dpc-sdp/tide_webform.git" - }, - "library/dropzone": { - "type": "package", - "package": { - "name": "library/dropzone", - "version": "4.3.0", - "type": "drupal-library", - "dist": { - "url": "https://github.com/enyo/dropzone/archive/v4.3.0.zip", - "type": "zip" - } - } - }, - "ckeditor/iframe": { - "type": "package", - "package": { - "name": "ckeditor/iframe", - "type": "drupal-library", - "version": "4.5.11", - "dist": { - "type": "zip", - "url": "https://download.ckeditor.com/iframe/releases/iframe_4.5.11.zip" - }, - "require": { - "composer/installers": "~1.0" - } - } - }, - "ckeditor/fakeobjects": { - "type": "package", - "package": { - "name": "ckeditor/fakeobjects", - "type": "drupal-library", - "version": "4.5.11", - "dist": { - "type": "zip", - "url": "https://download.ckeditor.com/fakeobjects/releases/fakeobjects_4.5.11.zip" - }, - "require": { - "composer/installers": "~1.0" - } - } - }, - "ckeditor/templates": { - "type": "package", - "package": { - "name": "ckeditor/templates", - "type": "drupal-library", - "version": "4.5.7", - "dist": { - "type": "zip", - "url": "https://download.ckeditor.com/templates/releases/templates_4.5.7.zip" - } - } - }, - "ubirak/rest-api-behat-extension": { - "type": "vcs", - "no-api": true, - "url": "https://github.com/integratedexperts/rest-api-behat-extension" - } - }, - "minimum-stability": "dev", - "prefer-stable": true, - "extra": { - "enable-patching": true, - "composer-exit-on-patch-failure": true, - "installer-paths": { - "build/docroot/core": [ - "type:drupal-core" - ], - "build/docroot/modules/contrib/{$name}": [ - "type:drupal-module" - ], - "build/docroot/themes/contrib/{$name}": [ - "type:drupal-theme" - ], - "build/docroot/profiles/contrib/{$name}": [ - "type:drupal-profile" - ], - "build/docroot/libraries/{$name}": [ - "type:drupal-library" - ] - } - }, - "scripts": { - "post-install-cmd": [ - "DrupalComposer\\DrupalScaffold\\Plugin::scaffold", - "rm -f docroot/sites/default/settings.php", - "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" - ], - "drupal-post-install": [ - "drush -r docroot cr" - ] - } -} diff --git a/composer.json b/composer.json index 0b51280..c32f930 100644 --- a/composer.json +++ b/composer.json @@ -2,43 +2,25 @@ "name": "dpc-sdp/tide", "description": "Tide Drupal 8 profile", "type": "drupal-profile", - "license": "GPL-2.0+", + "license": "GPL-2.0-or-later", "require": { - "dpc-sdp/tide_api": "dev-master", - "dpc-sdp/tide_core": "dev-master", - "dpc-sdp/tide_event": "dev-master", - "dpc-sdp/tide_landing_page": "dev-master", - "dpc-sdp/tide_media": "dev-master", - "dpc-sdp/tide_news": "dev-master", - "dpc-sdp/tide_page": "dev-master", - "dpc-sdp/tide_search": "dev-master", - "dpc-sdp/tide_site": "dev-master", - "dpc-sdp/tide_test": "dev-master", - "dpc-sdp/tide_monsido": "dev-master", - "dpc-sdp/tide_webform": "dev-master", - "drupal/core": "8.5.10" + "dpc-sdp/tide_api": "^1.0", + "dpc-sdp/tide_core": "^1.0", + "dpc-sdp/tide_event": "^1.0", + "dpc-sdp/tide_landing_page": "^1.0", + "dpc-sdp/tide_media": "^1.0", + "dpc-sdp/tide_monsido": "^1.0", + "dpc-sdp/tide_news": "^1.0", + "dpc-sdp/tide_page": "^1.0", + "dpc-sdp/tide_search": "^1.0", + "dpc-sdp/tide_site": "^1.0", + "dpc-sdp/tide_test": "^1.0", + "dpc-sdp/tide_webform": "^1.0" }, "repositories": { "drupal": { "type": "composer", "url": "https://packages.drupal.org/8" } - }, - "minimum-stability": "dev", - "prefer-stable": true, - "extra": { - "enable-patching": true, - "composer-exit-on-patch-failure": true, - "patches": { - "drupal/core": { - "Contextual links should not be added inside another link - https://www.drupal.org/node/2898875": "https://www.drupal.org/files/issues/2018-03-16/contextual_links_should-2898875-6.patch", - "No validation on text length for menu description when editing node - https://www.drupal.org/node/2852665#comment-12650295": "https://www.drupal.org/files/issues/2018-06-13/fatal_error_remove_menu_add_with_tests.patch", - "active-link.js throws JS error if query string parameter contains a single quote - https://www.drupal.org/node/2902769": "https://www.drupal.org/files/issues/active_link_js_throws-2902769-5_0.patch", - "getUuid() in class MenuLinkContent not returning any value - https://www.drupal.org/node/2737741": "https://www.drupal.org/files/issues/drupal-menulinkcontent-getuuid-return-missing-2737741-2.patch", - "RSS view with fields give wrong URL from path field - https://www.drupal.org/node/2673980#comment-12180229": "https://www.drupal.org/files/issues/rss_view_with_fields-2673980-28.patch", - "Installation profiles do not support project:module format for dependencies - https://www.drupal.org/node/2855026": "https://www.drupal.org/files/issues/2855026-30.patch", - "DateTimeIso8601::getDateTime() does not specify the storage timezone when constructing DrupalDateTime object - https://www.drupal.org/project/drupal/issues/3002164": "https://www.drupal.org/files/issues/2018-09-25/3002164-7.patch" - } - } } } diff --git a/dev-init.sh b/dev-init.sh new file mode 100755 index 0000000..1729349 --- /dev/null +++ b/dev-init.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +## +# Install development files from the centralised location. +# +# Files already committed within current repository will not be overridden. +## +# To override any files coming from Dev Tools to persist in the current +# repository, modify `.git/info/exclude` file and commit them. +# +# Usage: +# . dev-init.sh +# +# To update all files, including committed: +# ALLOW_OVERRIDE=1 . dev-init.sh +# + +# Development only: uncomment and set the commit value to fetch Dev Tools at +# specific commit. +#export GH_COMMIT=COMMIT_SHA + +curl https://raw.githubusercontent.com/dpc-sdp/dev-tools/master/install | bash diff --git a/docker-compose.local.yml b/docker-compose.local.yml deleted file mode 100644 index 2543b29..0000000 --- a/docker-compose.local.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '2' -services: - cli: - volumes_from: - - container:amazeeio-ssh-agent - environment: - - XDEBUG_ENABLE=true - volumes: - - .:/app:delegated - php: - environment: - - XDEBUG_ENABLE=true - volumes: - - .:/app:delegated - nginx: - networks: - - amazeeio-network - environment: - - AMAZEEIO_URL=tide-module.docker.amazee.io - - AMAZEEIO=AMAZEEIO - - AMAZEEIO_HTTP_PORT=8080 - volumes: - - .:/app:delegated - mariadb: - ports: - - 13309:3306 -networks: - amazeeio-network: - external: true diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index a4534ca..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: '2' -services: - cli: - image: amazeeio/php:7.1-cli-drupal - environment: - - WEBROOT=build/docroot - - COMPOSER=composer.build.json - volumes: - - .:/app - php: - image: amazeeio/php:7.1-fpm - environment: - - WEBROOT=build/docroot - volumes: - - .:/app - depends_on: - - cli - nginx: - image: amazeeio/nginx-drupal - environment: - - WEBROOT=build/docroot - volumes: - - .:/app - networks: - - default - depends_on: - - cli - expose: - - "8080" - mariadb: - image: amazeeio/centos7-mariadb10-drupal - selenium: - image: selenium/standalone-chrome diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 59ec8c1..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - PHPCS Standard for Tide modules. - - - - - - - - - - - - circle\.yml - \.circle\/config\.yml - - - - warning - - - - * - - - - src/* - tests/behat/bootstrap/* - - - - * - - diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php deleted file mode 100644 index a75e4d3..0000000 --- a/scripts/composer/ScriptHandler.php +++ /dev/null @@ -1,100 +0,0 @@ -locateRoot(getcwd()); - $drupalRoot = $drupalFinder->getDrupalRoot(); - - $dirs = [ - 'modules', - 'profiles', - 'themes', - ]; - - // Required for unit testing - foreach ($dirs as $dir) { - if (!$fs->exists($drupalRoot . '/'. $dir)) { - $fs->mkdir($drupalRoot . '/'. $dir); - $fs->touch($drupalRoot . '/'. $dir . '/.gitkeep'); - } - } - - // Prepare the settings file for installation - if (!$fs->exists($drupalRoot . '/sites/default/settings.php') and $fs->exists($drupalRoot . '/sites/default/default.settings.php')) { - $fs->copy($drupalRoot . '/sites/default/default.settings.php', $drupalRoot . '/sites/default/settings.php'); - require_once $drupalRoot . '/core/includes/bootstrap.inc'; - require_once $drupalRoot . '/core/includes/install.inc'; - $settings['config_directories'] = [ - CONFIG_SYNC_DIRECTORY => (object) [ - 'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot), - 'required' => TRUE, - ], - ]; - drupal_rewrite_settings($settings, $drupalRoot . '/sites/default/settings.php'); - $fs->chmod($drupalRoot . '/sites/default/settings.php', 0666); - $event->getIO()->write("Create a sites/default/settings.php file with chmod 0666"); - } - - // Create the files directory with chmod 0777 - if (!$fs->exists($drupalRoot . '/sites/default/files')) { - $oldmask = umask(0); - $fs->mkdir($drupalRoot . '/sites/default/files', 0777); - umask($oldmask); - $event->getIO()->write("Create a sites/default/files directory with chmod 0777"); - } - } - - /** - * Checks if the installed version of Composer is compatible. - * - * Composer 1.0.0 and higher consider a `composer install` without having a - * lock file present as equal to `composer update`. We do not ship with a lock - * file to avoid merge conflicts downstream, meaning that if a project is - * installed with an older version of Composer the scaffolding of Drupal will - * not be triggered. We check this here instead of in drupal-scaffold to be - * able to give immediate feedback to the end user, rather than failing the - * installation after going through the lengthy process of compiling and - * downloading the Composer dependencies. - * - * @see https://github.com/composer/composer/pull/5035 - */ - public static function checkComposerVersion(Event $event) { - $composer = $event->getComposer(); - $io = $event->getIO(); - - $version = $composer::VERSION; - - // The dev-channel of composer uses the git revision as version number, - // try to the branch alias instead. - if (preg_match('/^[0-9a-f]{40}$/i', $version)) { - $version = $composer::BRANCH_ALIAS_VERSION; - } - - // If Composer is installed through git we have no easy way to determine if - // it is new enough, just display a warning. - if ($version === '@package_version@' || $version === '@package_branch_alias_version@') { - $io->writeError('You are running a development version of Composer. If you experience problems, please update Composer to the latest stable version.'); - } - elseif (Comparator::lessThan($version, '1.0.0')) { - $io->writeError('Drupal-project requires Composer version 1.0.0 or higher. Please update your Composer before continuing.'); - exit(1); - } - } - -} diff --git a/tide.install b/tide.install index 0e9539f..ee48509 100644 --- a/tide.install +++ b/tide.install @@ -45,8 +45,8 @@ function tide_install() { // Workaround for redis module: it must be enabled before configuration can // be bootstrapped. We are already using installation phase to exclude redis - // configuration in settings.php and to install the module itself. - if (drupal_get_path('module', 'bay') && drupal_get_path('module', 'redis')) { + // configuration in /bay/settings.php and to install the module itself. + if (file_exists(DRUPAL_ROOT . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'contrib' . DIRECTORY_SEPARATOR . 'redis')) { \Drupal::service('module_installer')->install(['redis']); } }