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

nightconcept / almandine / 14716629923

28 Apr 2025 07:54PM UTC coverage: 95.996%. First build
14716629923

push

github

web-flow
feat: Initial features (#1)

863 of 899 new or added lines in 16 files covered. (96.0%)

863 of 899 relevant lines covered (96.0%)

1.99 hits per line

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

82.76
/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

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

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

59
Updates all dependencies to the latest allowed version, or to the absolute latest if --latest is specified.
60
Example:
61
  almd update
62
  almd update --latest
NEW
63
]])
×
64
end
65

66
return {
1✔
67
  update_dependencies = update_dependencies,
1✔
68
  help_info = help_info,
1✔
69
}
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