aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/installer/managers/gem.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2025-02-16 17:07:22 +0100
committerWilliam Boman <william@redwill.se>2025-02-19 12:15:49 +0100
commit5063ba98dc220a754caf68e510fb192755b1bdf0 (patch)
tree174abf2bd4339e3ea1db3652610469f3f09e24b2 /lua/mason-core/installer/managers/gem.lua
parentfeat(context): add ctx:fetch() (diff)
downloadmason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.gz
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.bz2
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.lz
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.xz
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.zst
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.zip
refactor: turn StdioSink into a proper class
Diffstat (limited to 'lua/mason-core/installer/managers/gem.lua')
-rw-r--r--lua/mason-core/installer/managers/gem.lua28
1 files changed, 11 insertions, 17 deletions
diff --git a/lua/mason-core/installer/managers/gem.lua b/lua/mason-core/installer/managers/gem.lua
index e8723d7e..30bff29d 100644
--- a/lua/mason-core/installer/managers/gem.lua
+++ b/lua/mason-core/installer/managers/gem.lua
@@ -15,7 +15,7 @@ function M.install(pkg, version, opts)
opts = opts or {}
log.fmt_debug("gem: install %s %s %s", pkg, version, opts)
local ctx = installer.context()
- ctx.stdio_sink.stdout(("Installing gem %s@%s…\n"):format(pkg, version))
+ ctx.stdio_sink:stdout(("Installing gem %s@%s…\n"):format(pkg, version))
return ctx.spawn.gem {
"install",
"--no-user-install",
@@ -50,22 +50,16 @@ function M.create_bin_wrapper(bin)
return Result.failure(("Cannot link Gem executable %q because it doesn't exist."):format(bin))
end
- return Result.pcall(
- ctx.write_shell_exec_wrapper,
- ctx,
- bin,
- path.concat { ctx:get_install_path(), bin_path },
- {
- GEM_PATH = platform.when {
- unix = function()
- return ("%s:$GEM_PATH"):format(ctx:get_install_path())
- end,
- win = function()
- return ("%s;%%GEM_PATH%%"):format(ctx:get_install_path())
- end,
- },
- }
- )
+ return Result.pcall(ctx.write_shell_exec_wrapper, ctx, bin, path.concat { ctx:get_install_path(), bin_path }, {
+ GEM_PATH = platform.when {
+ unix = function()
+ return ("%s:$GEM_PATH"):format(ctx:get_install_path())
+ end,
+ win = function()
+ return ("%s;%%GEM_PATH%%"):format(ctx:get_install_path())
+ end,
+ },
+ })
end
return M