aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/mason-core/platform.lua12
-rw-r--r--lua/mason-core/terminator.lua2
-rw-r--r--tests/mason-core/installer/context_spec.lua1
-rw-r--r--tests/mason-core/installer/linker_spec.lua1
-rw-r--r--tests/mason-core/platform_spec.lua3
5 files changed, 13 insertions, 6 deletions
diff --git a/lua/mason-core/platform.lua b/lua/mason-core/platform.lua
index 31a1522e..0a7a3e33 100644
--- a/lua/mason-core/platform.lua
+++ b/lua/mason-core/platform.lua
@@ -9,6 +9,7 @@ local uname = vim.loop.os_uname()
---| '"unix"'
---| '"linux"'
---| '"mac"'
+---| '"darwin"'
local arch_aliases = {
["x86_64"] = "x64",
@@ -59,6 +60,7 @@ local cached_features = {
["win32"] = vim.fn.has "win32",
["win64"] = vim.fn.has "win64",
["mac"] = vim.fn.has "mac",
+ ["darwin"] = vim.fn.has "mac",
["unix"] = vim.fn.has "unix",
["linux"] = vim.fn.has "linux",
}
@@ -83,7 +85,7 @@ local check_env = _.memoize(_.cond {
---Table that allows for checking whether the provided targets apply to the current system.
---Each key is a target tuple consisting of at most 3 targets, in the following order:
---- 1) OS (e.g. linux, unix, mac, win) - Mandatory
+--- 1) OS (e.g. linux, unix, darwin, win) - Mandatory
--- 2) Architecture (e.g. arm64, x64) - Optional
--- 3) Environment (e.g. gnu, musl, openbsd) - Optional
---Each target is separated by a "_" character, like so: "linux_x64_musl".
@@ -108,8 +110,8 @@ M.is = setmetatable({}, {
---@param platform_table table<Platform, T>
---@return T
local function get_by_platform(platform_table)
- if M.is.mac then
- return platform_table.mac or platform_table.unix
+ if M.is.darwin then
+ return platform_table.darwin or platform_table.mac or platform_table.unix
elseif M.is.linux then
return platform_table.linux or platform_table.unix
elseif M.is.unix then
@@ -180,7 +182,7 @@ M.os_distribution = _.lazy(function()
end)
:get_or_throw()
end,
- mac = function()
+ darwin = function()
return { id = "macOS", version = {} }
end,
win = function()
@@ -191,7 +193,7 @@ end)
---@type async fun(): Result<string>
M.get_homebrew_prefix = _.lazy(function()
- assert(M.is.mac, "Can only locate Homebrew installation on Mac systems.")
+ assert(M.is.darwin, "Can only locate Homebrew installation on Mac systems.")
local spawn = require "mason-core.spawn"
return spawn
.brew({ "--prefix" })
diff --git a/lua/mason-core/terminator.lua b/lua/mason-core/terminator.lua
index b7acefe8..f855834a 100644
--- a/lua/mason-core/terminator.lua
+++ b/lua/mason-core/terminator.lua
@@ -55,7 +55,7 @@ end
local active_handles = {}
----@parma handle InstallHandle
+---@param handle InstallHandle
function M.register(handle)
if handle:is_closed() then
return
diff --git a/tests/mason-core/installer/context_spec.lua b/tests/mason-core/installer/context_spec.lua
index 516aa7d2..0a5b7410 100644
--- a/tests/mason-core/installer/context_spec.lua
+++ b/tests/mason-core/installer/context_spec.lua
@@ -36,6 +36,7 @@ exec bash -c 'echo $GREETING' "$@"]]
end)
it("should write shell exec wrapper on Windows", function()
+ platform.is.darwin = false
platform.is.mac = false
platform.is.unix = false
platform.is.linux = false
diff --git a/tests/mason-core/installer/linker_spec.lua b/tests/mason-core/installer/linker_spec.lua
index cc14294b..5d3abd29 100644
--- a/tests/mason-core/installer/linker_spec.lua
+++ b/tests/mason-core/installer/linker_spec.lua
@@ -64,6 +64,7 @@ describe("installer", function()
it(
"should write executable wrapper on Windows",
async_test(function()
+ platform.is.darwin = false
platform.is.mac = false
platform.is.linux = false
platform.is.unix = false
diff --git a/tests/mason-core/platform_spec.lua b/tests/mason-core/platform_spec.lua
index dce29dab..fc1f43ed 100644
--- a/tests/mason-core/platform_spec.lua
+++ b/tests/mason-core/platform_spec.lua
@@ -74,6 +74,7 @@ describe("platform", function()
it("should be able to detect macos", function()
stub_mac()
assert.is_true(platform().is.mac)
+ assert.is_true(platform().is.darwin)
assert.is_true(platform().is.unix)
assert.is_false(platform().is.linux)
assert.is_false(platform().is.win)
@@ -82,6 +83,7 @@ describe("platform", function()
it("should be able to detect linux", function()
stub_linux()
assert.is_false(platform().is.mac)
+ assert.is_false(platform().is.darwin)
assert.is_true(platform().is.unix)
assert.is_true(platform().is.linux)
assert.is_false(platform().is.win)
@@ -90,6 +92,7 @@ describe("platform", function()
it("should be able to detect windows", function()
stub_windows()
assert.is_false(platform().is.mac)
+ assert.is_false(platform().is.darwin)
assert.is_false(platform().is.unix)
assert.is_false(platform().is.linux)
assert.is_true(platform().is.win)