From 5063ba98dc220a754caf68e510fb192755b1bdf0 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sun, 16 Feb 2025 17:07:22 +0100 Subject: refactor: turn StdioSink into a proper class --- lua/mason-core/installer/managers/gem.lua | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'lua/mason-core/installer/managers/gem.lua') 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 -- cgit v1.2.3-70-g09d2