-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.js
41 lines (39 loc) · 1.67 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const path = require('path');
const BinWrapper = require('bin-wrapper');
const pkg = require('../package');
const hugoVersion = pkg.hugoVersion;
const baseUrl = `https://github.com/spf13/hugo/releases/download/v${hugoVersion}/`;
const binNameMap = {
darwin: {
ia32: `hugo_${hugoVersion}_darwin_386`,
x64: `hugo_${hugoVersion}_darwin_amd64`
},
freebsd: {
arm: `hugo_${hugoVersion}_freebsd_arm`,
ia32: `hugo_${hugoVersion}_freebsd_386`,
x64: `hugo_${hugoVersion}_freebsd_amd64`
},
linux: {
arm: `hugo_${hugoVersion}_linux_arm`,
ia32: `hugo_${hugoVersion}_linux_386`,
x64: `hugo_${hugoVersion}_linux_amd64`
},
win32: {
ia32: `hugo_${hugoVersion}_windows_386.exe`,
x64: `hugo_${hugoVersion}_windows_amd64.exe`
}
};
const binName = (binNameMap[process.platform] && binNameMap[process.platform][process.arch]) || '';
module.exports = new BinWrapper()
.src(`${baseUrl}hugo_${hugoVersion}_FreeBSD-32bit.zip`, 'freebsd', 'x86')
.src(`${baseUrl}hugo_${hugoVersion}_FreeBSD-64bit.zip`, 'freebsd', 'x64')
.src(`${baseUrl}hugo_${hugoVersion}_freebsd_arm.zip`, 'freebsd', 'arm')
.src(`${baseUrl}hugo_${hugoVersion}_Linux-32bit.tar.gz`, 'linux', 'x86')
.src(`${baseUrl}hugo_${hugoVersion}_Linux-64bit.tar.gz`, 'linux', 'x64')
.src(`${baseUrl}hugo_${hugoVersion}_linux_arm.tar.gz`, 'linux', 'arm')
.src(`${baseUrl}hugo_${hugoVersion}_MacOS-32bit.zip`, 'darwin', 'x86')
.src(`${baseUrl}hugo_${hugoVersion}_MacOS-64bit.zip`, 'darwin', 'x64')
.src(`${baseUrl}hugo_${hugoVersion}_Windows-32bit.zip`, 'win32', 'x86')
.src(`${baseUrl}hugo_${hugoVersion}_Windows-64bit.zip`, 'win32', 'x64')
.dest(path.join(__dirname, '../vendor'))
.use(binName);