aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/installer/context.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-09-12 16:10:09 +0200
committerGitHub <noreply@github.com>2022-09-12 16:10:09 +0200
commitb56ea0bd8b6b1c265752226666f1069d0a479438 (patch)
tree5a90f8d008438962215d18c8ad3852f1bb339875 /lua/mason-core/installer/context.lua
parentfeat: add phpcs, phpcbf, phpmd, phpstan and twigcs (#399) (diff)
downloadmason-b56ea0bd8b6b1c265752226666f1069d0a479438.tar
mason-b56ea0bd8b6b1c265752226666f1069d0a479438.tar.gz
mason-b56ea0bd8b6b1c265752226666f1069d0a479438.tar.bz2
mason-b56ea0bd8b6b1c265752226666f1069d0a479438.tar.lz
mason-b56ea0bd8b6b1c265752226666f1069d0a479438.tar.xz
mason-b56ea0bd8b6b1c265752226666f1069d0a479438.tar.zst
mason-b56ea0bd8b6b1c265752226666f1069d0a479438.zip
refactor: add ctx:write_php_exec_wrapper utility (#409)
Diffstat (limited to 'lua/mason-core/installer/context.lua')
-rw-r--r--lua/mason-core/installer/context.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/lua/mason-core/installer/context.lua b/lua/mason-core/installer/context.lua
index 9e1df72f..7d0a505b 100644
--- a/lua/mason-core/installer/context.lua
+++ b/lua/mason-core/installer/context.lua
@@ -216,6 +216,21 @@ function InstallContext:write_node_exec_wrapper(new_executable_rel_path, script_
end
---@param new_executable_rel_path string Relative path to the executable file to create.
+---@param script_rel_path string Relative path to the PHP script.
+function InstallContext:write_php_exec_wrapper(new_executable_rel_path, script_rel_path)
+ if not self.fs:file_exists(script_rel_path) then
+ error(("Cannot write PHP exec wrapper for path %q as it doesn't exist."):format(script_rel_path), 0)
+ end
+ return self:write_shell_exec_wrapper(
+ new_executable_rel_path,
+ ("php %q"):format(path.concat {
+ self.package:get_install_path(),
+ script_rel_path,
+ })
+ )
+end
+
+---@param new_executable_rel_path string Relative path to the executable file to create.
---@param module string The python module to call.
function InstallContext:write_pyvenv_exec_wrapper(new_executable_rel_path, module)
local pip3 = require "mason-core.managers.pip3"