X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=_webi%2Ftest.js;h=1ffbb16d10f78fd27f2a08340085632a76d375a4;hb=14f590f5a5ba9f614843441a0f752c2754b47f84;hp=0240d1a2a03722461bc50a59a6255291a11fc29a;hpb=1ddaa43a7dbfd819edb190152f88a02d6b81c110;p=webi-installers%2F.git diff --git a/_webi/test.js b/_webi/test.js index 0240d1a..1ffbb16 100755 --- a/_webi/test.js +++ b/_webi/test.js @@ -46,7 +46,7 @@ nodes.forEach(function (node) { var maxLen = 0; console.info(''); console.info('Has the necessary files?'); -['README.md', 'releases.js', 'install.sh', 'install.bat'] +['README.md', 'releases.js', 'install.sh', 'install.ps1'] .map(function (node) { maxLen = Math.max(maxLen, node.length); return node; @@ -66,7 +66,7 @@ Releases.get(path.join(process.cwd(), pkgdir)).then(function (all) { var pkgname = path.basename(pkgdir.replace(/\/$/, '')); var osrel = os.platform() + '-' + os.release(); var arch = os.arch(); - var formats = ['xz', 'tar', 'zip']; + var formats = ['exe', 'xz', 'tar', 'zip']; var rel = all.releases.filter(function (rel) { return ( @@ -81,6 +81,9 @@ Releases.get(path.join(process.cwd(), pkgdir)).then(function (all) { new RegExp('^' + pkgtag).test(rel.version)) ); })[0]; + rel.oses = all.oses; + rel.arches = all.arches; + rel.formats = all.formats; if (!rel) { console.error('Error: ❌ no release found for current os, arch, and tag'); @@ -103,7 +106,7 @@ Releases.get(path.join(process.cwd(), pkgdir)).then(function (all) { arch, formats: formats }).catch(function () {}), - Releases.renderBatch(pkgdir, rel, { + Releases.renderPowerShell(pkgdir, rel, { baseurl: 'https://webinstall.dev', pkg: pkgname, tag: pkgtag || '', @@ -114,22 +117,26 @@ Releases.get(path.join(process.cwd(), pkgdir)).then(function (all) { }).catch(function () {}) ]).then(function (scripts) { var bashTxt = scripts[0]; - var batTxt = scripts[1]; + var ps1Txt = scripts[1]; var bashFile = 'install-' + pkgname + '.sh'; - var batFile = 'install-' + pkgname + '.bat'; + var ps1File = 'install-' + pkgname + '.ps1'; if (debug) { bashTxt = (bashTxt || 'echo ERROR').replace(/#set -x/g, 'set -x'); - batTxt = (batTxt || 'echo ERROR').replace( + ps1Txt = (ps1Txt || 'echo ERROR').replace( /REM REM todo debug/g, 'REM todo debug' ); } - console.info('Has the necessary files?'); - fs.writeFileSync(bashFile, bashTxt, 'utf-8'); - console.info('\tNEEDS MANUAL TEST: bash %s', bashFile); - fs.writeFileSync(batFile, batTxt, 'utf-8'); - console.info('\tNEEDS MANUAL TEST: cmd.exe %s', batFile); + console.info('Do the scripts actually work?'); + if (bashFile && bashTxt) { + fs.writeFileSync(bashFile, bashTxt, 'utf-8'); + console.info('\tNEEDS MANUAL TEST: bash %s', bashFile); + } + if (ps1File && ps1Txt) { + fs.writeFileSync(ps1File, ps1Txt, 'utf-8'); + console.info('\tNEEDS MANUAL TEST: powershell.exe %s', ps1File); + } console.info(''); }); });