File tree Expand file tree Collapse file tree 7 files changed +76
-3
lines changed
Expand file tree Collapse file tree 7 files changed +76
-3
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # # Description: Run PHP_CodeSniffer's code beautifier
4+ # # Usage: phpcbf [flags] [args]
5+ # # Example: "ddev phpcbf --standard=core/phpcs.xml.dist index.php" or "ddev phpcbf index.php"
6+ # # HostWorkingDir: true
7+ # # ExecRaw: true
8+
9+ if ! command -v phpcbf > /dev/null; then
10+ echo " phpcbf is not available. You may need to 'ddev composer require squizlabs/php_codesniffer'"
11+ exit 1
12+ fi
13+ phpcbf " $@ "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # # Description: Run PHP_CodeSniffer's codesniffer
4+ # # Usage: phpcs [flags] [args]
5+ # # Example: "ddev phpcs --standard=core/phpcs.xml.dist index.php" or "ddev phpcs index.php"
6+ # # HostWorkingDir: true
7+ # # ExecRaw: true
8+
9+ if ! command -v phpcs > /dev/null; then
10+ echo " phpcs is not available. You may need to 'ddev composer require squizlabs/php_codesniffer'"
11+ exit 1
12+ fi
13+ phpcs " $@ "
Original file line number Diff line number Diff line change @@ -83,9 +83,12 @@ if [ ! -f "${GITPOD_REPO_ROOT}"/.drupalpod_initiated ]; then
8383 fi
8484
8585 time " ${GITPOD_REPO_ROOT} " /.gitpod/drupal/install-essential-packages.sh
86- # Configure phpcs for drupal.
87- cd " $GITPOD_REPO_ROOT " &&
88- vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer
86+
87+ # Configure phpcs for drupal if it's not already set up by the
88+ # dealerdirect/phpcodesniffer-composer-installer composer plugin.
89+ if ! ddev phpcs --config-show | \g rep -q ' installed_paths:' ; then
90+ ddev phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer
91+ fi
8992
9093 # ddev config auto updates settings.php and generates settings.ddev.php
9194 ddev config --auto
Original file line number Diff line number Diff line change @@ -17,6 +17,15 @@ sudo cp protect-my-git.template.sh /usr/local/bin/protect-my-git
1717# Create php command (run php inside ddev container)
1818sudo cp ddev-php.template.sh /usr/local/bin/php
1919
20+ # Create phpunit command (run phpunit inside ddev container)
21+ sudo cp ddev-phpunit.template.sh /usr/local/bin/phpunit
22+
23+ # Create phpcs command (run phpcs inside ddev container)
24+ sudo cp ddev-phpcs.template.sh /usr/local/bin/phpcs
25+
26+ # Create phpcbf command (run phpcbf inside ddev container)
27+ sudo cp ddev-phpcbf.template.sh /usr/local/bin/phpcbf
28+
2029# Create drush command (run drush inside ddev container)
2130sudo cp ddev-drush.template.sh /usr/local/bin/drush
2231
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ >&2 echo " Notice: running 'phpcbf $* ' in ddev"
3+
4+ if [ -n " ${GITPOD_REPO_ROOT:- } " ]; then
5+ # Replace all references to the absolute paths to the repo root.
6+ # This will ensure IDEs like PHPStorm can pass files into it without issue.
7+ arguments=()
8+ for arg in " $@ " ; do
9+ new_arg=" ${arg// ${GITPOD_REPO_ROOT} // var/ www/ html} "
10+ arguments+=(" $new_arg " )
11+ done
12+ else
13+ arguments=(" $@ " )
14+ fi
15+
16+ ddev exec_d phpcbf " ${arguments[@]} "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ >&2 echo " Notice: running 'phpcs $* ' in ddev"
3+
4+ if [ -n " ${GITPOD_REPO_ROOT:- } " ]; then
5+ # Replace all references to the absolute paths to the repo root.
6+ # This will ensure IDEs like PHPStorm can pass files into it without issue.
7+ arguments=()
8+ for arg in " $@ " ; do
9+ new_arg=" ${arg// ${GITPOD_REPO_ROOT} // var/ www/ html} "
10+ arguments+=(" $new_arg " )
11+ done
12+ else
13+ arguments=(" $@ " )
14+ fi
15+
16+ ddev exec_d phpcs " ${arguments[@]} "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ >&2 echo " Notice: running 'phpunit $* ' in ddev"
3+ ddev exec_d phpunit " $@ "
You can’t perform that action at this time.
0 commit comments