1
mirror of https://github.com/jakejarvis/hugo-extended.git synced 2025-04-26 09:05:20 -04:00

further simplify install logic

This commit is contained in:
Jake Jarvis 2020-01-30 20:33:17 -05:00
parent 9d5f8ac522
commit da49c200fb
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
2 changed files with 8 additions and 30 deletions

6
.gitignore vendored
View File

@ -1,3 +1,3 @@
/node_modules/ node_modules/
/vendor/ vendor/
/npm-debug.log npm-debug.log

View File

@ -6,35 +6,11 @@ const { hugoVersion } = require('../package.json');
const baseUrl = `https://github.com/gohugoio/hugo/releases/download/v${hugoVersion}/`; const baseUrl = `https://github.com/gohugoio/hugo/releases/download/v${hugoVersion}/`;
const binNameMap = { // Default to extended Hugo, fall back to vanilla Hugo on unsupported platforms
darwin: {
ia32: 'hugo',
x64: 'hugo'
},
freebsd: {
arm: 'hugo',
ia32: 'hugo',
x64: 'hugo'
},
linux: {
arm: 'hugo',
ia32: 'hugo',
x64: 'hugo'
},
win32: {
ia32: 'hugo.exe',
x64: 'hugo.exe'
}
};
const dest = path.join(__dirname, '../vendor');
const binName = (binNameMap[process.platform] && binNameMap[process.platform][process.arch]) || '';
const extendedBin = new BinWrapper() const extendedBin = new BinWrapper()
.src(`${baseUrl}hugo_extended_${hugoVersion}_Linux-64bit.tar.gz`, 'linux', 'x64') .src(`${baseUrl}hugo_extended_${hugoVersion}_Linux-64bit.tar.gz`, 'linux', 'x64')
.src(`${baseUrl}hugo_extended_${hugoVersion}_macOS-64bit.tar.gz`, 'darwin', 'x64') .src(`${baseUrl}hugo_extended_${hugoVersion}_macOS-64bit.tar.gz`, 'darwin', 'x64')
.src(`${baseUrl}hugo_extended_${hugoVersion}_Windows-64bit.zip`, 'win32', 'x64') .src(`${baseUrl}hugo_extended_${hugoVersion}_Windows-64bit.zip`, 'win32', 'x64')
// Falling back to normal version on non supported platforms
.src(`${baseUrl}hugo_${hugoVersion}_FreeBSD-32bit.tar.gz`, 'freebsd', 'x86') .src(`${baseUrl}hugo_${hugoVersion}_FreeBSD-32bit.tar.gz`, 'freebsd', 'x86')
.src(`${baseUrl}hugo_${hugoVersion}_FreeBSD-64bit.tar.gz`, 'freebsd', 'x64') .src(`${baseUrl}hugo_${hugoVersion}_FreeBSD-64bit.tar.gz`, 'freebsd', 'x64')
.src(`${baseUrl}hugo_${hugoVersion}_FreeBSD-ARM.tar.gz`, 'freebsd', 'arm') .src(`${baseUrl}hugo_${hugoVersion}_FreeBSD-ARM.tar.gz`, 'freebsd', 'arm')
@ -42,8 +18,10 @@ const extendedBin = new BinWrapper()
.src(`${baseUrl}hugo_${hugoVersion}_Linux-ARM.tar.gz`, 'linux', 'arm') .src(`${baseUrl}hugo_${hugoVersion}_Linux-ARM.tar.gz`, 'linux', 'arm')
.src(`${baseUrl}hugo_${hugoVersion}_macOS-32bit.tar.gz`, 'darwin', 'x86') .src(`${baseUrl}hugo_${hugoVersion}_macOS-32bit.tar.gz`, 'darwin', 'x86')
.src(`${baseUrl}hugo_${hugoVersion}_Windows-32bit.zip`, 'win32', 'x86') .src(`${baseUrl}hugo_${hugoVersion}_Windows-32bit.zip`, 'win32', 'x86')
.dest(dest) .dest(path.join(__dirname, '../vendor'))
.use(binName); .use(process.platform === 'win32' ? 'hugo.exe' : 'hugo');
// TODO: download checksums.txt file and validate package integrity
module.exports = function () { module.exports = function () {
return extendedBin; return extendedBin;