From 536b29149fbe3d2f1aa76c05bfe22e922a33732b Mon Sep 17 00:00:00 2001 From: steveoh Date: Tue, 12 Sep 2017 17:06:47 -0600 Subject: [PATCH] use windows on windows --- gulpfile.babel.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 19ff22d..f999059 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -15,7 +15,8 @@ import kebabCase from "lodash.kebabcase"; import tomlify from "tomlify-j0.4"; const browserSync = BrowserSync.create(); -const hugoBin = `./bin/hugo_0.26_${process.platform}_amd64${process.platform === "windows" ? ".exe" : ""}`; +const platform = getPlatform(process.platform); +const hugoBin = `./bin/hugo_0.26_${platform}_amd64${platform === "windows" ? ".exe" : ""}`; const defaultArgs = ["-s", "site", "-v"]; const buildArgs = ["-d", "../dist"]; @@ -130,13 +131,12 @@ gulp.task("new-incident", (cb) => { } let cmd = "xdg-open"; - switch (process.platform) { + switch (platform) { case "darwin": { cmd = "open"; break; } - case "win32": - case "win64": { + case "windows": { cmd = "start"; break; } @@ -159,6 +159,18 @@ gulp.task("new-incident", (cb) => { }); }); +function getPlatform(platform) { + switch (platform) { + case "win32": + case "win64": { + return "windows"; + } + default: { + return platform + } + } +} + function generateFrontMatter(frontMatter, answers) { return `+++ ${tomlify(frontMatter, null, 2)}