• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nightconcept / almandine / 14715174283

28 Apr 2025 06:32PM UTC coverage: 37.748%. First build
14715174283

push

github

web-flow
Merge 789647aa5 into 78f97e22e

477 of 566 new or added lines in 14 files covered. (84.28%)

1693 of 4485 relevant lines covered (37.75%)

11.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/modules/update.lua
1
--[[
2
  Update Command Module
3

4
  Provides functionality to update dependencies to the latest allowed version or the absolute latest
5
  version if the `--latest` flag is provided.
6
]]--
7

8
--- Updates all dependencies in project.lua to the latest allowed version, or to the latest available if
9
-- `--latest` is set.
10
-- @param load_manifest function Function to load the manifest.
11
-- @param save_manifest function Function to save the manifest.
12
-- @param ensure_lib_dir function Function to ensure lib dir exists.
13
-- @param utils table Utils module (must provide .downloader).
14
-- @param resolve_latest_version function Function to resolve latest version for a dependency (semver or commit).
15
-- @param _latest boolean|nil Whether to force update to absolute latest version.
16
local function update_dependencies(load_manifest, save_manifest, ensure_lib_dir, utils, resolve_latest_version, _latest)
17
  ensure_lib_dir()
3✔
18
  local manifest, err = load_manifest()
3✔
19
  if not manifest then print(err) return end
3✔
20
  local updated = false
3✔
21
  for name, dep in pairs(manifest.dependencies or {}) do
6✔
22
    local dep_tbl = dep
3✔
23
    if type(dep) == "string" then
3✔
24
      dep_tbl = { url = dep }
2✔
25
    end
26
    local new_version = resolve_latest_version(name)
3✔
27
    if new_version and dep_tbl.version ~= new_version then
3✔
28
      dep_tbl.version = new_version
3✔
29
      updated = true
3✔
30
      local url = dep_tbl.url or dep
3✔
31
      local out_path = dep_tbl.path or ("src/lib/" .. name .. ".lua")
3✔
32
      local ok, err2 = utils.downloader.download(url, out_path)
3✔
33
      if not ok then
3✔
NEW
34
        print(string.format(
×
35
          "Failed to download %s: %s",
36
          name,
NEW
37
          err2 or "unknown error"
×
38
        ))
39
      else
40
        print(string.format(
6✔
41
          "Updating %s from %s to %s",
3✔
42
          name,
3✔
43
          dep_tbl.version or "(unknown)",
3✔
44
          new_version
45
        ))
3✔
46
      end
47
      -- If we upgraded from a string, update the manifest entry to a table
48
      manifest.dependencies[name] = dep_tbl
3✔
49
    end
50
  end
51
  if updated then
3✔
52
    save_manifest(manifest)
3✔
53
  end
54
end
55

56
---
57
-- Prints usage/help information for the `update` command.
58
-- Usage: almd update [--latest]
59
-- Updates dependencies to the latest allowed version, or to the absolute latest if --latest is specified.
60
local function help_info()
NEW
61
  print([[
×
62
Usage: almd update [--latest]
63

64
Updates all dependencies to the latest allowed version, or to the absolute latest if --latest is specified.
65
Example:
66
  almd update
67
  almd update --latest
NEW
68
]])
×
69
end
70

71
return {
1✔
72
  update_dependencies = update_dependencies,
1✔
73
  help_info = help_info
1✔
74
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc