aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/mason-core/fs.lua2
-rw-r--r--lua/mason-core/installer/context.lua8
-rw-r--r--lua/mason-core/installer/init.lua2
-rw-r--r--lua/mason-core/package/init.lua9
-rw-r--r--scripts/lua/mason-scripts/utils.lua2
-rw-r--r--tests/helpers/lua/test_helpers.lua2
-rw-r--r--tests/mason-core/managers/cargo_spec.lua6
-rw-r--r--tests/mason-core/managers/composer_spec.lua4
-rw-r--r--tests/mason-core/managers/dotnet_spec.lua4
-rw-r--r--tests/mason-core/managers/gem_spec.lua4
-rw-r--r--tests/mason-core/managers/git_spec.lua2
-rw-r--r--tests/mason-core/managers/go_spec.lua4
-rw-r--r--tests/mason-core/managers/luarocks_spec.lua2
-rw-r--r--tests/mason-core/managers/npm_spec.lua6
-rw-r--r--tests/mason-core/managers/opam_spec.lua4
-rw-r--r--tests/mason-core/managers/pip3_spec.lua4
16 files changed, 30 insertions, 35 deletions
diff --git a/lua/mason-core/fs.lua b/lua/mason-core/fs.lua
index 1621d06c..b60749e2 100644
--- a/lua/mason-core/fs.lua
+++ b/lua/mason-core/fs.lua
@@ -89,7 +89,7 @@ local function make_module(uv)
---@param contents string
---@param flags string? Defaults to "w".
function M.write_file(path, contents, flags)
- log.debug("fs: write_file", path)
+ log.trace("fs: write_file", path)
local fd = uv.fs_open(path, flags or "w", 438)
uv.fs_write(fd, contents, -1)
uv.fs_close(fd)
diff --git a/lua/mason-core/installer/context.lua b/lua/mason-core/installer/context.lua
index 132cc064..0b07b528 100644
--- a/lua/mason-core/installer/context.lua
+++ b/lua/mason-core/installer/context.lua
@@ -151,12 +151,8 @@ end
local InstallContext = {}
InstallContext.__index = InstallContext
----@class InstallContextOpts
----@field requested_version string?
----@field debug boolean?
-
---@param handle InstallHandle
----@param opts InstallContextOpts
+---@param opts PackageInstallOpts
function InstallContext.new(handle, opts)
local cwd_manager = CwdManager.new(path.install_prefix())
return setmetatable({
@@ -166,7 +162,7 @@ function InstallContext.new(handle, opts)
package = handle.package, -- for convenience
fs = ContextualFs.new(cwd_manager),
receipt = receipt.InstallReceiptBuilder.new(),
- requested_version = Optional.of_nilable(opts.requested_version),
+ requested_version = Optional.of_nilable(opts.version),
stdio_sink = handle.stdio.sink,
bin_links = {},
}, InstallContext)
diff --git a/lua/mason-core/installer/init.lua b/lua/mason-core/installer/init.lua
index 0d6c8dc9..4250508c 100644
--- a/lua/mason-core/installer/init.lua
+++ b/lua/mason-core/installer/init.lua
@@ -88,7 +88,7 @@ end
---@async
---@param handle InstallHandle
----@param opts InstallContextOpts
+---@param opts PackageInstallOpts
function M.execute(handle, opts)
if handle:is_active() or handle:is_closed() then
log.fmt_debug("Received active or closed handle %s", handle)
diff --git a/lua/mason-core/package/init.lua b/lua/mason-core/package/init.lua
index faf25764..9fb82d42 100644
--- a/lua/mason-core/package/init.lua
+++ b/lua/mason-core/package/init.lua
@@ -92,7 +92,9 @@ function Package:new_handle()
return handle
end
----@param opts? { version: string?, debug: boolean? }
+---@alias PackageInstallOpts { version: string?, debug: boolean?, target: string? }
+
+---@param opts? PackageInstallOpts
---@return InstallHandle
function Package:install(opts)
opts = opts or {}
@@ -131,10 +133,7 @@ function Package:install(opts)
end)
end,
handle,
- {
- requested_version = opts.version,
- debug = opts.debug,
- }
+ opts
)
return handle
end)
diff --git a/scripts/lua/mason-scripts/utils.lua b/scripts/lua/mason-scripts/utils.lua
index e29a9364..65ad75aa 100644
--- a/scripts/lua/mason-scripts/utils.lua
+++ b/scripts/lua/mason-scripts/utils.lua
@@ -7,7 +7,7 @@ local M = {}
---@async
---@param path string
---@param contents string
----@param flags string
+---@param flags string?
function M.write_file(path, contents, flags)
local header = _.cond {
{ _.matches "%.md$", _.always { "<!--- THIS FILE IS GENERATED. DO NOT EDIT MANUALLY. -->" } },
diff --git a/tests/helpers/lua/test_helpers.lua b/tests/helpers/lua/test_helpers.lua
index fcb6a608..17ec5ae5 100644
--- a/tests/helpers/lua/test_helpers.lua
+++ b/tests/helpers/lua/test_helpers.lua
@@ -40,7 +40,7 @@ end
-- selene: allow(unused_variable)
---@param handle InstallHandle
----@param opts InstallContextOpts?
+---@param opts PackageInstallOpts?
function InstallContextGenerator(handle, opts)
local context = InstallContext.new(handle, opts or {})
context.spawn = setmetatable({}, {
diff --git a/tests/mason-core/managers/cargo_spec.lua b/tests/mason-core/managers/cargo_spec.lua
index d52c6ffc..b5b07cf1 100644
--- a/tests/mason-core/managers/cargo_spec.lua
+++ b/tests/mason-core/managers/cargo_spec.lua
@@ -17,7 +17,7 @@ describe("cargo manager", function()
"should call cargo install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, cargo.crate "my-crate")
assert.spy(ctx.spawn.cargo).was_called(1)
assert.spy(ctx.spawn.cargo).was_called_with {
@@ -77,7 +77,7 @@ describe("cargo manager", function()
"should respect options",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, cargo.crate("my-crate", { features = "lsp" }))
assert.spy(ctx.spawn.cargo).was_called(1)
assert.spy(ctx.spawn.cargo).was_called_with {
@@ -99,7 +99,7 @@ describe("cargo manager", function()
local handle = InstallHandleGenerator "dummy"
stub(github, "tag")
github.tag.returns { tag = "v2.1.1", with_receipt = mockx.just_runs }
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
cargo.crate("my-crate", {
diff --git a/tests/mason-core/managers/composer_spec.lua b/tests/mason-core/managers/composer_spec.lua
index 0c741493..44841061 100644
--- a/tests/mason-core/managers/composer_spec.lua
+++ b/tests/mason-core/managers/composer_spec.lua
@@ -12,7 +12,7 @@ describe("composer manager", function()
"should call composer require",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
ctx.fs.file_exists = spy.new(mockx.returns(false))
installer.exec_in_context(
ctx,
@@ -39,7 +39,7 @@ describe("composer manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
composer.packages { "main-package", "supporting-package", "supporting-package2" }
diff --git a/tests/mason-core/managers/dotnet_spec.lua b/tests/mason-core/managers/dotnet_spec.lua
index ffcbd339..17f7cd3b 100644
--- a/tests/mason-core/managers/dotnet_spec.lua
+++ b/tests/mason-core/managers/dotnet_spec.lua
@@ -6,7 +6,7 @@ describe("dotnet manager", function()
"should call dotnet tool update",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, dotnet.package "main-package")
assert.spy(ctx.spawn.dotnet).was_called(1)
assert.spy(ctx.spawn.dotnet).was_called_with {
@@ -24,7 +24,7 @@ describe("dotnet manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, dotnet.package "main-package")
assert.same({
type = "dotnet",
diff --git a/tests/mason-core/managers/gem_spec.lua b/tests/mason-core/managers/gem_spec.lua
index a74425e5..93973b3e 100644
--- a/tests/mason-core/managers/gem_spec.lua
+++ b/tests/mason-core/managers/gem_spec.lua
@@ -14,7 +14,7 @@ describe("gem manager", function()
"should call gem install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, gem.packages { "main-package", "supporting-package", "supporting-package2" })
assert.spy(ctx.spawn.gem).was_called(1)
assert.spy(ctx.spawn.gem).was_called_with(match.tbl_containing {
@@ -37,7 +37,7 @@ describe("gem manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, gem.packages { "main-package", "supporting-package", "supporting-package2" })
assert.same({
type = "gem",
diff --git a/tests/mason-core/managers/git_spec.lua b/tests/mason-core/managers/git_spec.lua
index 684d0e54..ec157ecc 100644
--- a/tests/mason-core/managers/git_spec.lua
+++ b/tests/mason-core/managers/git_spec.lua
@@ -47,7 +47,7 @@ describe("git manager", function()
"should fetch and checkout revision if requested",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "1337" })
+ local ctx = InstallContextGenerator(handle, { version = "1337" })
installer.exec_in_context(ctx, function()
git.clone { "https://github.com/williamboman/mason.nvim.git" }
end)
diff --git a/tests/mason-core/managers/go_spec.lua b/tests/mason-core/managers/go_spec.lua
index 21547204..6a7f0a9c 100644
--- a/tests/mason-core/managers/go_spec.lua
+++ b/tests/mason-core/managers/go_spec.lua
@@ -12,7 +12,7 @@ describe("go manager", function()
"should call go install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, go.packages { "main-package", "supporting-package", "supporting-package2" })
assert.spy(ctx.spawn.go).was_called(3)
assert.spy(ctx.spawn.go).was_called_with {
@@ -40,7 +40,7 @@ describe("go manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, go.packages { "main-package", "supporting-package", "supporting-package2" })
assert.same({
type = "go",
diff --git a/tests/mason-core/managers/luarocks_spec.lua b/tests/mason-core/managers/luarocks_spec.lua
index 9065ca69..98376adc 100644
--- a/tests/mason-core/managers/luarocks_spec.lua
+++ b/tests/mason-core/managers/luarocks_spec.lua
@@ -26,7 +26,7 @@ describe("luarocks manager", function()
"should install provided version",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "1.2.3" })
+ local ctx = InstallContextGenerator(handle, { version = "1.2.3" })
installer.exec_in_context(ctx, luarocks.package "lua-cjson")
assert.spy(ctx.spawn.luarocks).was_called(1)
assert.spy(ctx.spawn.luarocks).was_called_with {
diff --git a/tests/mason-core/managers/npm_spec.lua b/tests/mason-core/managers/npm_spec.lua
index 971e255f..6bfa518d 100644
--- a/tests/mason-core/managers/npm_spec.lua
+++ b/tests/mason-core/managers/npm_spec.lua
@@ -14,7 +14,7 @@ describe("npm manager", function()
"should call npm install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, npm.packages { "main-package", "supporting-package", "supporting-package2" })
assert.spy(ctx.spawn.npm).was_called_with(match.tbl_containing {
"install",
@@ -49,7 +49,7 @@ describe("npm manager", function()
"should append .npmrc file",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
ctx.fs.append_file = spy.new(mockx.just_runs())
installer.exec_in_context(ctx, npm.packages { "main-package", "supporting-package", "supporting-package2" })
assert.spy(ctx.fs.append_file).was_called(1)
@@ -61,7 +61,7 @@ describe("npm manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, npm.packages { "main-package", "supporting-package", "supporting-package2" })
assert.same({
type = "npm",
diff --git a/tests/mason-core/managers/opam_spec.lua b/tests/mason-core/managers/opam_spec.lua
index 1aa9bb93..22d0a55b 100644
--- a/tests/mason-core/managers/opam_spec.lua
+++ b/tests/mason-core/managers/opam_spec.lua
@@ -7,7 +7,7 @@ describe("opam manager", function()
"should call opam install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
opam.packages { "main-package", "supporting-package", "supporting-package2" }
@@ -31,7 +31,7 @@ describe("opam manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
opam.packages { "main-package", "supporting-package", "supporting-package2" }
diff --git a/tests/mason-core/managers/pip3_spec.lua b/tests/mason-core/managers/pip3_spec.lua
index de0de5c7..7422084f 100644
--- a/tests/mason-core/managers/pip3_spec.lua
+++ b/tests/mason-core/managers/pip3_spec.lua
@@ -28,7 +28,7 @@ describe("pip3 manager", function()
"should create venv and call pip3 install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
pip3.packages { "main-package", "supporting-package", "supporting-package2" }
@@ -177,7 +177,7 @@ describe("pip3 manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
pip3.packages { "main-package", "supporting-package", "supporting-package2" }