Bundles are now stored with version number so that new releases do not overwrite previous version bundles

This commit is contained in:
Manish 2020-05-01 16:12:08 +10:00
parent ea5fda4de1
commit 3b7d086a2d
2 changed files with 16 additions and 6 deletions

View File

@ -86,6 +86,9 @@ class extractData:
# FIXME: create separate function for it # FIXME: create separate function for it
# extract and copy icon # extract and copy icon
activityName = infoDict.get("name") activityName = infoDict.get("name")
activityVersion = infoDict.get("activity_version")
if activityVersion is None:
activityVersion = ''
if type(activityName) == str: if type(activityName) == str:
iconRelativePath = infoDict.get("icon") iconRelativePath = infoDict.get("icon")
if type(iconRelativePath) == str: if type(iconRelativePath) == str:
@ -105,7 +108,8 @@ class extractData:
self.iconErrorBundles.append(bundlePath) self.iconErrorBundles.append(bundlePath)
bundle.close() bundle.close()
self.copyBundle(bundlePath, activityName) self.copyBundle(
bundlePath, activityName+'v'+activityVersion)
bundle.close() bundle.close()
def findBundles(self): def findBundles(self):
@ -118,14 +122,15 @@ class extractData:
iconsDir = "../icons/" iconsDir = "../icons/"
bundlesDir = "../bundles/" bundlesDir = "../bundles/"
for appInfo in self.indexDictList: for appInfo in self.indexDictList:
pathName = strToHtmlFmt(appInfo["name"], safe='') appName = strToHtmlFmt(appInfo["name"], safe='')
appVersion = strToHtmlFmt(appInfo["version"], safe='')
html = ( html = (
'<!DOCTYPE html>\n<html>\n<head>\n<title>' + appInfo["name"] + '<!DOCTYPE html>\n<html>\n<head>\n<title>' + appInfo["name"] +
'</title>\n<meta charset="utf-8"/>\n<link rel="stylesheet" ' '</title>\n<meta charset="utf-8"/>\n<link rel="stylesheet" '
'type="text/css" href="../css/main.css"/>\n</head>\n<body>\n' 'type="text/css" href="../css/main.css"/>\n</head>\n<body>\n'
'</body>\n<h1>' + appInfo["name"] + '</h1>\n<p><img src="' + '</body>\n<h1>' + appInfo["name"] + '</h1>\n<p><img src="' +
str(iconsDir + pathName + '.svg') + '"></img></p>\n' str(iconsDir + appName + '.svg') + '"></img></p>\n'
'<div id=summary><h2>Summary</h2>\n<p>' + appInfo["summary"] + '<div id=summary><h2>Summary</h2>\n<p>' + appInfo["summary"] +
'</p>\n</div>\n<div id=description><h2>Description</h2>\n<p>' + '</p>\n</div>\n<div id=description><h2>Description</h2>\n<p>' +
appInfo["description"] + '</p>\n</div>\n<div id=tags><h2>Tags' appInfo["description"] + '</p>\n</div>\n<div id=tags><h2>Tags'
@ -135,7 +140,7 @@ class extractData:
html += '<li>' + tag + '</li>\n' html += '<li>' + tag + '</li>\n'
html += ( html += (
'</ul>\n</div>\n<h2 id="downloadButton"><a href="' + '</ul>\n</div>\n<h2 id="downloadButton"><a href="' +
str(bundlesDir + pathName + '.xo') + str(bundlesDir + appName + appVersion + '.xo') +
'">Download</a></h2>\n<br>\n</body>\n</html>' '">Download</a></h2>\n<br>\n</body>\n</html>'
) )
@ -155,7 +160,8 @@ class extractData:
"name": "", "name": "",
"summary": "", "summary": "",
"description": "", "description": "",
"tags": () "tags": (),
"version": "v"
} }
name = activity.get("name") name = activity.get("name")
@ -185,6 +191,10 @@ class extractData:
tags.append(tag) tags.append(tag)
indexDict["tags"] = tuple(tags) indexDict["tags"] = tuple(tags)
activityVersion = activity.get("activity_version")
if activityVersion is not None:
indexDict["version"] += activityVersion
self.indexDictList.append(indexDict) self.indexDictList.append(indexDict)
self.indexJs = ( self.indexJs = (
"search.assignIndex(" + "search.assignIndex(" +

View File

@ -64,7 +64,7 @@ var search = {
for (var tag of app.tags) for (var tag of app.tags)
html += '<li>'+ tag +'</li>\n'; html += '<li>'+ tag +'</li>\n';
html += '</ul>\n</div>\n<h2 id="downloadButton"><a href="' + html += '</ul>\n</div>\n<h2 id="downloadButton"><a href="' +
'./bundles/' + app.name + '.xo' + './bundles/' + app.name + app.version+ '.xo' +
'">Download</a></h2>\n'; '">Download</a></h2>\n';
return html; return html;
}, },