diff options
| author | William Boman <william@redwill.se> | 2023-03-14 00:59:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-14 00:59:56 +0100 |
| commit | 63988d84311defc54a36d8befcb8df3646ac1cbc (patch) | |
| tree | 49cabad159798e91eeeb08a8dad872cf9569cc92 /lua/mason-registry/sources/github.lua | |
| parent | chore: autogenerate (#1093) (diff) | |
| download | mason-63988d84311defc54a36d8befcb8df3646ac1cbc.tar mason-63988d84311defc54a36d8befcb8df3646ac1cbc.tar.gz mason-63988d84311defc54a36d8befcb8df3646ac1cbc.tar.bz2 mason-63988d84311defc54a36d8befcb8df3646ac1cbc.tar.lz mason-63988d84311defc54a36d8befcb8df3646ac1cbc.tar.xz mason-63988d84311defc54a36d8befcb8df3646ac1cbc.tar.zst mason-63988d84311defc54a36d8befcb8df3646ac1cbc.zip | |
fix(sources): also set .desc property when updating spec (#1095)
Diffstat (limited to 'lua/mason-registry/sources/github.lua')
| -rw-r--r-- | lua/mason-registry/sources/github.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lua/mason-registry/sources/github.lua b/lua/mason-registry/sources/github.lua index 63ddba29..636e8840 100644 --- a/lua/mason-registry/sources/github.lua +++ b/lua/mason-registry/sources/github.lua @@ -36,6 +36,7 @@ GitHubRegistrySource.__index = GitHubRegistrySource function GitHubRegistrySource.new(spec) local root_dir = path.concat { path.registry_prefix(), "github", spec.namespace, spec.name } return setmetatable({ + id = spec.id, spec = spec, root_dir = root_dir, data_file = path.concat { root_dir, "registry.json" }, @@ -70,6 +71,9 @@ function GitHubRegistrySource:reload() local _ = Pkg.Lang[lang] end, spec.languages) + -- XXX: this is for compatibilty with the PackageSpec structure + spec.desc = spec.description + local pkg = self.buffer and self.buffer[spec.name] if pkg then -- Apply spec to the existing Package instance. This is important as to not have lingering package @@ -105,13 +109,18 @@ end ---@async function GitHubRegistrySource:install() return Result.try(function(try) + local version = self.spec.version + if self:is_installed() and version ~= nil then + -- Fixed version - nothing to update + return + end + if not fs.async.dir_exists(self.root_dir) then log.debug("Creating registry directory", self) try(Result.pcall(fs.async.mkdirp, self.root_dir)) end - local version = self.spec.version - if version == nil or version == "latest" then + if version == nil then log.trace("Resolving latest version for registry", self) ---@type GitHubRelease local release = try(providers.github.get_latest_release(self.spec.repo)) |
