mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-03-02 17:30:18 +00:00
bugfix: allow whitespace before template vars
This commit is contained in:
@@ -48,13 +48,19 @@ Releases.renderBash = function (
|
||||
.then(function (tplTxt) {
|
||||
return (
|
||||
tplTxt
|
||||
.replace(/^#?WEBI_PKG=.*/m, "WEBI_PKG='" + pkg + '@' + ver + "'")
|
||||
.replace(/^#?WEBI_HOST=.*/m, "WEBI_HOST='" + baseurl + "'")
|
||||
.replace(/^#?WEBI_OS=.*/m, "WEBI_OS='" + (os || '') + "'")
|
||||
.replace(/^#?WEBI_ARCH=.*/m, "WEBI_ARCH='" + (arch || '') + "'")
|
||||
.replace(/^#?WEBI_TAG=.*/m, "WEBI_TAG='" + tag + "'")
|
||||
.replace(
|
||||
/^#?WEBI_RELEASES=.*/m,
|
||||
/^\s*#?WEBI_PKG=.*/m,
|
||||
"WEBI_PKG='" + pkg + '@' + ver + "'"
|
||||
)
|
||||
.replace(/^\s*#?WEBI_HOST=.*/m, "WEBI_HOST='" + baseurl + "'")
|
||||
.replace(/^\s*#?WEBI_OS=.*/m, "WEBI_OS='" + (os || '') + "'")
|
||||
.replace(
|
||||
/^\s*#?WEBI_ARCH=.*/m,
|
||||
"WEBI_ARCH='" + (arch || '') + "'"
|
||||
)
|
||||
.replace(/^\s*#?WEBI_TAG=.*/m, "WEBI_TAG='" + tag + "'")
|
||||
.replace(
|
||||
/^\s*#?WEBI_RELEASES=.*/m,
|
||||
"WEBI_RELEASES='" +
|
||||
baseurl +
|
||||
'/api/releases/' +
|
||||
@@ -71,7 +77,7 @@ Releases.renderBash = function (
|
||||
"'"
|
||||
)
|
||||
.replace(
|
||||
/^#?WEBI_CSV=.*/m,
|
||||
/^\s*#?WEBI_CSV=.*/m,
|
||||
"WEBI_CSV='" +
|
||||
[
|
||||
rel.version,
|
||||
@@ -91,43 +97,43 @@ Releases.renderBash = function (
|
||||
"'"
|
||||
)
|
||||
.replace(
|
||||
/^#?WEBI_VERSION=.*/m,
|
||||
/^\s*#?WEBI_VERSION=.*/m,
|
||||
'WEBI_VERSION=' + JSON.stringify(rel.version)
|
||||
)
|
||||
.replace(/^#?WEBI_MAJOR=.*/m, 'WEBI_MAJOR=' + v.major)
|
||||
.replace(/^#?WEBI_MINOR=.*/m, 'WEBI_MINOR=' + v.minor)
|
||||
.replace(/^#?WEBI_PATCH=.*/m, 'WEBI_PATCH=' + v.patch)
|
||||
.replace(/^#?WEBI_BUILD=.*/m, 'WEBI_BUILD=' + v.build)
|
||||
.replace(/^#?WEBI_LTS=.*/m, 'WEBI_LTS=' + rel.lts)
|
||||
.replace(/^#?WEBI_CHANNEL=.*/m, 'WEBI_CHANNEL=' + rel.channel)
|
||||
.replace(/^\s*#?WEBI_MAJOR=.*/m, 'WEBI_MAJOR=' + v.major)
|
||||
.replace(/^\s*#?WEBI_MINOR=.*/m, 'WEBI_MINOR=' + v.minor)
|
||||
.replace(/^\s*#?WEBI_PATCH=.*/m, 'WEBI_PATCH=' + v.patch)
|
||||
.replace(/^\s*#?WEBI_BUILD=.*/m, 'WEBI_BUILD=' + v.build)
|
||||
.replace(/^\s*#?WEBI_LTS=.*/m, 'WEBI_LTS=' + rel.lts)
|
||||
.replace(/^\s*#?WEBI_CHANNEL=.*/m, 'WEBI_CHANNEL=' + rel.channel)
|
||||
.replace(
|
||||
/^#?WEBI_EXT=.*/m,
|
||||
/^\s*#?WEBI_EXT=.*/m,
|
||||
'WEBI_EXT=' + rel.ext.replace(/tar.*/, 'tar')
|
||||
)
|
||||
.replace(
|
||||
/^#?WEBI_FORMATS=.*/m,
|
||||
/^\s*#?WEBI_FORMATS=.*/m,
|
||||
"WEBI_FORMATS='" + formats.join(',') + "'"
|
||||
)
|
||||
.replace(
|
||||
/^#?WEBI_PKG_URL=.*/m,
|
||||
/^\s*#?WEBI_PKG_URL=.*/m,
|
||||
"WEBI_PKG_URL='" + rel.download + "'"
|
||||
)
|
||||
.replace(
|
||||
/^#?WEBI_PKG_FILE=.*/m,
|
||||
/^\s*#?WEBI_PKG_FILE=.*/m,
|
||||
"WEBI_PKG_FILE='" + pkgFile + "'"
|
||||
)
|
||||
// PKG details
|
||||
.replace(/^#?PKG_NAME=.*/m, "PKG_NAME='" + pkg + "'")
|
||||
.replace(/^\s*#?PKG_NAME=.*/m, "PKG_NAME='" + pkg + "'")
|
||||
.replace(
|
||||
/^#?PKG_OSES=.*/m,
|
||||
/^\s*#?PKG_OSES=.*/m,
|
||||
"PKG_OSES='" + ((rel && rel.oses) || []).join(',') + "'"
|
||||
)
|
||||
.replace(
|
||||
/^#?PKG_ARCHES=.*/m,
|
||||
/^\s*#?PKG_ARCHES=.*/m,
|
||||
"PKG_ARCHES='" + ((rel && rel.arches) || []).join(',') + "'"
|
||||
)
|
||||
.replace(
|
||||
/^#?PKG_FORMATS=.*/m,
|
||||
/^\s*#?PKG_FORMATS=.*/m,
|
||||
"PKG_FORMATS='" + ((rel && rel.formats) || []).join(',') + "'"
|
||||
)
|
||||
.replace(/{{ installer }}/, installTxt)
|
||||
|
||||
Reference in New Issue
Block a user