diff options
| author | William Boman <william@redwill.se> | 2023-10-13 01:27:58 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2025-02-19 09:23:19 +0100 |
| commit | c338fb2698ae276bc3b6edccdd3afaef92fc77bd (patch) | |
| tree | ab9ec90f23e5ba1c48585fd41ef987cff8c3a693 /lua/mason-test | |
| parent | refactor: add InstallLocation.global() (diff) | |
| download | mason-c338fb2698ae276bc3b6edccdd3afaef92fc77bd.tar mason-c338fb2698ae276bc3b6edccdd3afaef92fc77bd.tar.gz mason-c338fb2698ae276bc3b6edccdd3afaef92fc77bd.tar.bz2 mason-c338fb2698ae276bc3b6edccdd3afaef92fc77bd.tar.lz mason-c338fb2698ae276bc3b6edccdd3afaef92fc77bd.tar.xz mason-c338fb2698ae276bc3b6edccdd3afaef92fc77bd.tar.zst mason-c338fb2698ae276bc3b6edccdd3afaef92fc77bd.zip | |
refactor(installer): move initializations to InstallContext constructor
Diffstat (limited to 'lua/mason-test')
| -rw-r--r-- | lua/mason-test/helpers.lua | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lua/mason-test/helpers.lua b/lua/mason-test/helpers.lua index 57b486ea..149589bf 100644 --- a/lua/mason-test/helpers.lua +++ b/lua/mason-test/helpers.lua @@ -1,7 +1,4 @@ local InstallContext = require "mason-core.installer.context" -local InstallContextCwd = require "mason-core.installer.context.cwd" -local InstallContextFs = require "mason-core.installer.context.fs" -local InstallContextSpawn = require "mason-core.installer.context.spawn" local InstallHandle = require "mason-core.installer.handle" local InstallLocation = require "mason-core.installer.location" local Result = require "mason-core.result" @@ -14,11 +11,8 @@ local M = {} function M.create_context(opts) local pkg = registry.get_package(opts and opts.package or "dummy") local handle = InstallHandle.new(pkg) - local location = InstallLocation.new "/tmp/install-dir" - local context_cwd = InstallContextCwd.new(location):set(location.dir) - local context_spawn = InstallContextSpawn.new(context_cwd, handle, false) - local context_fs = InstallContextFs.new(context_cwd) - local context = InstallContext.new(handle, context_cwd, context_spawn, context_fs, opts and opts.install_opts or {}) + local location = InstallLocation.global() + local context = InstallContext.new(handle, location, opts and opts.install_opts or {}) context.spawn = setmetatable({}, { __index = function(s, cmd) s[cmd] = spy.new(function() @@ -27,6 +21,7 @@ function M.create_context(opts) return s[cmd] end, }) + context.cwd:initialize():get_or_throw() return context end |
