• 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

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

43
---
44
-- Prints usage/help information for the `remove` command.
45
-- Usage: almd remove <dep_name>
46
-- Removes a dependency from the project and deletes its file from the lib directory.
47
local function help_info()
NEW
48
  print([[\nUsage: almd remove <dep_name>
×
49

50
Removes a dependency from your project and deletes the corresponding file.
51
Example:
52
  almd remove lunajson
NEW
53
]])
×
54
end
55

56
return {
1✔
57
  remove_dependency = remove_dependency,
1✔
58
  help_info = help_info
1✔
59
}
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