Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3904722
D2676.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D2676.diff
View Options
diff --git a/roles/devserver/userland-software/dev.sls b/roles/devserver/userland-software/dev.sls
--- a/roles/devserver/userland-software/dev.sls
+++ b/roles/devserver/userland-software/dev.sls
@@ -75,6 +75,21 @@
- {{ packages.phpunit }}
- {{ packages_prefixes.pecl }}ast
+{{ dirs.bin }}/run-php-script:
+ file.managed:
+ - source: salt://roles/devserver/userland-software/files/run-php-script.sh
+ - mode: 755
+
+{% for command in ["phan", "phpmd", "phpstan", "psalm", "rector"] %}
+{{ dirs.bin }}/{{ command }}:
+ file.managed:
+ - source: salt://roles/devserver/userland-software/files/run-php-script-alias.sh.jinja
+ - mode: 755
+ - template: jinja
+ - context:
+ command: {{ command }}
+{% endfor %}
+
# -------------------------------------------------------------
# Python
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/roles/devserver/userland-software/files/run-php-script-alias.sh.jinja b/roles/devserver/userland-software/files/run-php-script-alias.sh.jinja
new file mode 100644
--- /dev/null
+++ b/roles/devserver/userland-software/files/run-php-script-alias.sh.jinja
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Run Composer version if found, or find a system one if not
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Source: roles/devserver/userland-software/files/run-php-script-alias.sh
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+run-php-script {{ command }} "$@"
diff --git a/roles/devserver/userland-software/files/run-php-script.sh b/roles/devserver/userland-software/files/run-php-script.sh
new file mode 100755
--- /dev/null
+++ b/roles/devserver/userland-software/files/run-php-script.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Wrapper to launch PHP command from known places
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Source: roles/devserver/userland-software/files/run-php-script.sh
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+COMMAND=$1
+shift
+
+if [ -f "vendor/bin/$COMMAND" ]; then
+ echo "Switching to Composer $COMMAND:"
+ SCRIPT="vendor/bin/$COMMAND"
+elif [ -f "/opt/$COMMAND.phar" ]; then
+ SCRIPT="/opt/$COMMAND.phar"
+elif [ -f "/opt/$COMMAND" ]; then
+ SCRIPT="/opt/$COMMAND"
+else
+ echo "No $COMMAND has been found."
+ exit 1
+fi
+
+php "$SCRIPT" "$@"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 18, 21:43 (1 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2305474
Default Alt Text
D2676.diff (2 KB)
Attached To
Mode
D2676: Deploy run-php-script wrapper on devserver
Attached
Detach File
Event Timeline
Log In to Comment