diff options
| author | William Boman <william@redwill.se> | 2023-03-25 16:06:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-25 16:06:59 +0100 |
| commit | 698b2827fe491a21362ecd37705b0506758b6cea (patch) | |
| tree | a9680f938699d7c87c03111a9ce156e2374c70c7 | |
| parent | docs: add :MasonUpdate to plugin manager snippets (#1136) (diff) | |
| download | mason-698b2827fe491a21362ecd37705b0506758b6cea.tar mason-698b2827fe491a21362ecd37705b0506758b6cea.tar.gz mason-698b2827fe491a21362ecd37705b0506758b6cea.tar.bz2 mason-698b2827fe491a21362ecd37705b0506758b6cea.tar.lz mason-698b2827fe491a21362ecd37705b0506758b6cea.tar.xz mason-698b2827fe491a21362ecd37705b0506758b6cea.tar.zst mason-698b2827fe491a21362ecd37705b0506758b6cea.zip | |
refactor: download checksum after unzip (#1135)
* refactor: download checksum after unzip
* fixup
---------
Co-authored-by: williambotman[bot] <william+bot@redwill.se>
| -rw-r--r-- | lua/mason-registry/sources/github.lua | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lua/mason-registry/sources/github.lua b/lua/mason-registry/sources/github.lua index 636e8840..704c78d8 100644 --- a/lua/mason-registry/sources/github.lua +++ b/lua/mason-registry/sources/github.lua @@ -132,13 +132,6 @@ function GitHubRegistrySource:install() out_file = path.concat { self.root_dir, "registry.json.zip" }, }):map_err(_.always "Failed to download registry.json.zip.")) - local checksums = try( - fetch(settings.current.github.download_url_template:format(self.spec.repo, version, "checksums.txt")):map_err( - _.always "Failed to download checksums.txt." - ) - ) - local parsed_checksums = parse_checksums(checksums) - platform.when { unix = function() try(spawn.unzip({ "-o", "registry.json.zip", cwd = self.root_dir }):map_err(function(err) @@ -161,11 +154,17 @@ function GitHubRegistrySource:install() } pcall(fs.async.unlink, path.concat { self.root_dir, "registry.json.zip" }) + local checksums = try( + fetch(settings.current.github.download_url_template:format(self.spec.repo, version, "checksums.txt")):map_err( + _.always "Failed to download checksums.txt." + ) + ) + try(Result.pcall( fs.async.write_file, self.info_file, vim.json.encode { - checksums = parsed_checksums, + checksums = parse_checksums(checksums), version = version, download_timestamp = os.time(), } |
