Browse Source

update scripts

ruki 1 year ago
parent
commit
d01ae0ca85
1 changed files with 5 additions and 5 deletions
  1. 5 5
      scripts/autoupdate.lua

+ 5 - 5
scripts/autoupdate.lua

@@ -80,8 +80,8 @@ function _update_version(instance, version, shasum)
                 return string.format('add_versions("%s", "%s")\n    add_versions("%s", "%s")', version, shasum, v, h)
                 return string.format('add_versions("%s", "%s")\n    add_versions("%s", "%s")', version, shasum, v, h)
             end
             end
         end)
         end)
-    else
-        -- TODO
+    end
+    if not inserted then
         local versionfiles = instance:get("versionfiles")
         local versionfiles = instance:get("versionfiles")
         if versionfiles then
         if versionfiles then
             for _, versionfile in ipairs(table.wrap(versionfiles)) do
             for _, versionfile in ipairs(table.wrap(versionfiles)) do
@@ -89,7 +89,8 @@ function _update_version(instance, version, shasum)
                     versionfile = path.join(instance:scriptdir(), versionfile)
                     versionfile = path.join(instance:scriptdir(), versionfile)
                 end
                 end
                 if os.isfile(versionfile) then
                 if os.isfile(versionfile) then
-                    print("versionfile", versionfile)
+                    io.insert(versionfile, 1, string.format("%s %s", version, shasum))
+                    inserted = true
                 end
                 end
             end
             end
         end
         end
@@ -131,8 +132,7 @@ function main(pattern)
         end
         end
         if updated then
         if updated then
             count = count + 1
             count = count + 1
-        else
-            table.remove(instances, idx)
         end
         end
+        table.remove(instances, idx)
     end
     end
 end
 end