diff --git a/composer.json b/composer.json
index 1ea8214..244784b 100644
--- a/composer.json
+++ b/composer.json
@@ -1,5 +1,6 @@
{
"name": "digitalpolygon/polymer-pantheon-drupal",
+ "type": "polymer-plugin",
"description": "Helpful scripts and tools for integrating Drupal with Pantheon.",
"authors":[
{
@@ -14,11 +15,6 @@
},
"minimum-stability": "dev",
"prefer-stable": true,
- "autoload": {
- "psr-4": {
- "DigitalPolygon\\PolymerPantheon\\Drupal\\": "./src/"
- }
- },
"require": {
"digitalpolygon/polymer-drupal": "0.x-dev",
"pantheon-systems/drupal-integrations": "* !=11.0.0"
@@ -35,17 +31,23 @@
"digitalpolygon/polymer": true,
"digitalpolygon/drupal-upgrade-plugin": true,
"phpstan/extension-installer": true,
- "phpro/grumphp-shim": true
+ "phpro/grumphp-shim": true,
+ "composer/installers": true
}
},
"scripts": {
"lint": "find src test/src -name '*.php' -print0 | xargs -0 -n1 -P4 -- php -l",
- "cs": "phpcs",
+ "cs": "phpcs --standard=phpcs-non-drupal.xml.dist --report=full -s",
"sa": "phpstan analyse -v -c phpstan.neon",
"validations": [
"@lint",
"@cs",
"@sa"
]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "DigitalPolygon\\Polymer\\polymer_drupal\\": "vendor/digitalpolygon/polymer-drupal/src/"
}
+ }
}
diff --git a/grumphp.yml b/grumphp.yml
index afcf7ec..3114804 100644
--- a/grumphp.yml
+++ b/grumphp.yml
@@ -1,2 +1,19 @@
grumphp:
- tasks: { }
+ hooks_dir: grumphp/hooks
+ tasks:
+ phpcs:
+ standard: PSR12
+ warning_severity: 0
+ whitelist_patterns:
+ - src
+# phpcs_drupal:
+# standard:
+# - Drupal
+# - DrupalPractice
+# warning_severity: 0
+# whitelist_patterns:
+# - settings
+# metadata:
+# task: phpcs
+ phpstan: null
+ phplint: null
diff --git a/grumphp/hooks/commit-msg b/grumphp/hooks/commit-msg
new file mode 100644
index 0000000..aca41c6
--- /dev/null
+++ b/grumphp/hooks/commit-msg
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+#
+# Run the hook command.
+# Note: this will be replaced by the real command during copy.
+#
+
+GIT_USER=$(git config user.name)
+GIT_EMAIL=$(git config user.email)
+COMMIT_MSG_FILE=$1
+
+# Fetch the GIT diff and format it as command input:
+DIFF=$(git -c diff.mnemonicprefix=false -c diff.noprefix=false --no-pager diff -r -p -m -M --full-index --no-color --staged | cat)
+
+# Grumphp env vars
+$(ENV)
+export GRUMPHP_GIT_WORKING_DIR="$(git rev-parse --show-toplevel)"
+
+DDEV_PREFIX="ddev exec --"
+COMMAND_PREFIX=""
+
+if [ -z "${IS_DDEV_PROJECT}" ] && [ -d .ddev ] && command -v ddev >/dev/null 2>&1; then
+ COMMAND_PREFIX="${DDEV_PREFIX}"
+fi
+
+# Run GrumPHP
+(cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}" | $COMMAND_PREFIX $(EXEC_GRUMPHP_COMMAND) $(HOOK_COMMAND) "--git-user='$GIT_USER'" "--git-email='$GIT_EMAIL'" "$COMMIT_MSG_FILE")
diff --git a/grumphp/hooks/pre-commit b/grumphp/hooks/pre-commit
new file mode 100644
index 0000000..9c406cf
--- /dev/null
+++ b/grumphp/hooks/pre-commit
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#
+# Run the hook command.
+# Note: this will be replaced by the real command during copy.
+#
+
+# Fetch the GIT diff and format it as command input:
+DIFF=$(git -c diff.mnemonicprefix=false -c diff.noprefix=false --no-pager diff -r -p -m -M --full-index --no-color --staged | cat)
+
+# Grumphp env vars
+$(ENV)
+export GRUMPHP_GIT_WORKING_DIR="$(git rev-parse --show-toplevel)"
+
+DDEV_PREFIX="ddev exec --"
+COMMAND_PREFIX=""
+
+if [ -z "${IS_DDEV_PROJECT}" ] && [ -d .ddev ] && command -v ddev >/dev/null 2>&1; then
+ COMMAND_PREFIX="${DDEV_PREFIX}"
+fi
+
+# Run GrumPHP
+(cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}" | $COMMAND_PREFIX $(EXEC_GRUMPHP_COMMAND) $(HOOK_COMMAND) '--skip-success-output')
diff --git a/phpcs-drupal.xml.dist b/phpcs-drupal.xml.dist
new file mode 100644
index 0000000..bdffee2
--- /dev/null
+++ b/phpcs-drupal.xml.dist
@@ -0,0 +1,9 @@
+
+
+ Default PHP CodeSniffer configuration for the Drupal Integration for Polymer WebOps Tooling project.
+ settings
+
+
+
+
+
diff --git a/phpcs-non-drupal.xml.dist b/phpcs-non-drupal.xml.dist
new file mode 100644
index 0000000..5402af2
--- /dev/null
+++ b/phpcs-non-drupal.xml.dist
@@ -0,0 +1,8 @@
+
+
+ Default PHP CodeSniffer configuration for the Drupal Integration for Polymer WebOps Tooling project.
+ src
+
+
+
+
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
deleted file mode 100644
index 2bd91f5..0000000
--- a/phpcs.xml.dist
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- Default PHP CodeSniffer configuration for Polymer projects and extensions.
- src
-
-
-
-
-
-
-
-
-
-
diff --git a/polymer_pantheon_drupal.poly_info.yml b/polymer_pantheon_drupal.poly_info.yml
new file mode 100644
index 0000000..437f77e
--- /dev/null
+++ b/polymer_pantheon_drupal.poly_info.yml
@@ -0,0 +1 @@
+name: Polymer Pantheon Drupal
diff --git a/src/Polymer/Exception/TerminusPluginNotInstalledException.php b/src/Exception/TerminusPluginNotInstalledException.php
similarity index 77%
rename from src/Polymer/Exception/TerminusPluginNotInstalledException.php
rename to src/Exception/TerminusPluginNotInstalledException.php
index ad7ca68..b912c26 100644
--- a/src/Polymer/Exception/TerminusPluginNotInstalledException.php
+++ b/src/Exception/TerminusPluginNotInstalledException.php
@@ -1,6 +1,6 @@