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

nightconcept / almandine / 14740114043

29 Apr 2025 07:54PM UTC coverage: 82.069% (-0.7%) from 82.759%
14740114043

push

github

web-flow
fix: Lock file generation and Mac/Linux installs (#9)

84 of 96 new or added lines in 5 files covered. (87.5%)

4 existing lines in 2 files now uncovered.

1579 of 1924 relevant lines covered (82.07%)

2.38 hits per line

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

97.22
/src/modules/remove.lua
1
--[[
2
  Remove Command Module
3

4
  Provides functionality to remove a dependency from the project manifest and delete the corresponding
5
  file from the lib directory.
6
]]
7
--
8

9
--- Removes a dependency from project.lua and deletes its file.
10
-- @param dep_name string Dependency name to remove.
11
-- @param load_manifest function Function to load the manifest.
12
-- @param save_manifest function Function to save the manifest.
13
local function remove_dependency(dep_name, load_manifest, save_manifest)
14
  local manifest, err = load_manifest()
7✔
15
  if not manifest then
7✔
16
    print(err)
1✔
17
    return
1✔
18
  end
19
  manifest.dependencies = manifest.dependencies or {}
6✔
20
  if not manifest.dependencies[dep_name] then
6✔
21
    print(string.format("Dependency '%s' not found in project.lua.", dep_name))
1✔
22
    return
1✔
23
  end
24
  local dep = manifest.dependencies[dep_name]
5✔
25
  local dep_path
26
  if type(dep) == "table" and dep.path then
5✔
27
    dep_path = dep.path
1✔
28
  elseif _G.dependency_add_test_paths and _G.dependency_add_test_paths[dep_name] then
4✔
29
    dep_path = _G.dependency_add_test_paths[dep_name]
1✔
30
  else
31
    local filesystem_utils = require("utils.filesystem")
3✔
32
    dep_path = filesystem_utils.join_path("src", "lib", dep_name .. ".lua")
3✔
33
  end
34
  manifest.dependencies[dep_name] = nil
5✔
35
  local ok, err2 = save_manifest(manifest)
5✔
36
  if not ok then
5✔
37
    print(err2)
1✔
38
    return
1✔
39
  end
40
  print(string.format("Removed dependency '%s' from project.lua.", dep_name))
4✔
41
  local removed = os.remove(dep_path)
4✔
42
  if removed then
4✔
43
    print(string.format("Deleted file %s", dep_path))
3✔
44
  else
45
    print(string.format("Warning: Could not delete file %s (may not exist)", dep_path))
1✔
46
  end
47

48
  -- Remove entry from lockfile (almd-lock.lua)
49
  local lockfile_mod = require("utils.lockfile")
4✔
50
  local ok_lock, err_lock = lockfile_mod.remove_dep_from_lockfile(dep_name)
4✔
51
  if ok_lock then
4✔
NEW
52
    print(string.format("Updated lockfile: almd-lock.lua (removed entry for '%s')", dep_name))
×
53
  else
54
    print("Failed to update lockfile: " .. tostring(err_lock))
4✔
55
  end
56
end
57

58
---
59
-- Prints usage/help information for the `remove` command.
60
-- Usage: almd remove <dep_name>
61
-- Removes a dependency from the project and deletes its file from the lib directory.
62
local function help_info()
63
  print([[\nUsage: almd remove <dep_name>
2✔
64

65
Removes a dependency from your project and deletes the corresponding file.
66
Example:
67
  almd remove lunajson
68
]])
1✔
69
end
70

71
return {
1✔
72
  remove_dependency = remove_dependency,
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