diff --git a/roles/devserver/userland-software/dev.sls b/roles/devserver/userland-software/dev.sls index e70373b..6a8a5a3 100644 --- a/roles/devserver/userland-software/dev.sls +++ b/roles/devserver/userland-software/dev.sls @@ -1,182 +1,197 @@ # ------------------------------------------------------------- # Salt — Provision dev software # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Nasqueron # Created: 2017-10-20 # License: Trivial work, not eligible to copyright # ------------------------------------------------------------- {% from "map.jinja" import dirs, packages, packages_prefixes with context %} # ------------------------------------------------------------- # C/C++ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_c: pkg.installed: - pkgs: - {{ packages.boost }} - cmocka - {{ packages.librabbitmq }} # ------------------------------------------------------------- # Java # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_java: pkg.installed: - pkgs: - openjdk8 - apache-ant - maven # ------------------------------------------------------------- # .Net languages # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_dotnet: pkg.installed: - pkgs: - mono # ------------------------------------------------------------- # Node # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_node: pkg.installed: - pkgs: - {{ packages.node }} - npm devserver_node_packages: npm.installed: - pkgs: - bower - browserify - csslint - eslint - gulp - grunt - jscs - jshint - jsonlint - react-tools - require: - pkg: devserver_software_dev_node # ------------------------------------------------------------- # PHP # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_php: pkg.installed: - pkgs: - {{ 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 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_python: pkg.installed: - pkgs: # Modern Python 3 packages - {{ packages_prefixes.python3 }}beautifulsoup # Legacy packages - {{ packages_prefixes.python2 }}nltk - {{ packages_prefixes.python2 }}numpy - {{ packages_prefixes.python2 }}virtualenv # ------------------------------------------------------------- # Ruby # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_ruby: pkg.installed: - pkgs: - {{ packages_prefixes.rubygem }}rubocop # ------------------------------------------------------------- # Rust # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_rust: pkg.installed: - pkgs: - rust {{ dirs.bin }}/rustup-init: file.managed: - source: salt://roles/devserver/userland-software/files/rustup-init.sh - mode: 755 # ------------------------------------------------------------- # Shell # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_shell: pkg.installed: - pkgs: - hs-ShellCheck # ------------------------------------------------------------- # TCL # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_tcl: pkg.installed: - pkgs: - rlwrap - tcllib - tclsoap - {{ packages.tcltls }} - {{ packages.tdom }} # ------------------------------------------------------------- # Web development # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_web: pkg.installed: - pkgs: - memcached # ------------------------------------------------------------- # Editors and IDE # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_vim: pkg.installed: - pkgs: # Vim itself is already declared in core role. # FreeBSD also offers nvi in base system. # Neovim - neovim - {{ packages_prefixes.python3 }}pynvim # ------------------------------------------------------------- # Tools like code review utilities # # Arcanist is installed in the Phabricator states # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_misctools: pkg.installed: - pkgs: - git-review # ------------------------------------------------------------- # MediaWiki development # # Include tools for some extensions like ProofreadPage # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devserver_software_dev_mediawiki: pkg.installed: - pkgs: - netpbm - {{ packages['djvulibre'] }} 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 index 0000000..88b6ae5 --- /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 index 0000000..7bac7f8 --- /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" "$@"