Browse Source

Cleanup for the rest of SPM

* Install method needs to be cleaned up significantly, far too much mutation in that method
environments/production/deployments/15
Drew Short 6 years ago
parent
commit
752b779085
  1. 20
      src/spm/spm.lua

20
src/spm/spm.lua

@ -493,8 +493,8 @@ local function uninstallPackage(requestedPackage)
end
term.write("Removing package files...")
for i, j in pairs(locallyInstalledFiles[requestedPackage]) do
fs.remove(j)
for installedFilePath, fileLocalInstallPath in pairs(locallyInstalledFiles[requestedPackage]) do
fs.remove(fileLocalInstallPath)
end
term.write("Done\nRemoving references...")
@ -504,19 +504,19 @@ local function uninstallPackage(requestedPackage)
print("Successfully uninstalled package " .. requestedPackage)
end
local function updatePackage(pack)
if pack == "all" then
local function updatePackage(requestedPackage)
if requestedPackage == "all" then
print("Updating everything...")
local tFiles = readFromLocalInstallFile()
if not tFiles then
local locallyInstalledPackages = readFromLocalInstallFile()
if not locallyInstalledPackages then
io.stderr:write("Error while trying to read package names")
return
elseif tFiles[1] == -1 then
table.remove(tFiles, 1)
elseif locallyInstalledPackages[1] == -1 then
table.remove(locallyInstalledPackages, 1)
end
local done = false
for i in pairs(tFiles) do
installPackage(i, nil, true)
for localPackage in pairs(locallyInstalledPackages) do
installPackage(localPackage, nil, true)
done = true
end
if not done then

Loading…
Cancel
Save