Skip to content

Instantly share code, notes, and snippets.

@myobie
Last active November 13, 2019 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myobie/df46db4681856a9ea27c3cb4cdcf9521 to your computer and use it in GitHub Desktop.
Save myobie/df46db4681856a9ea27c3cb4cdcf9521 to your computer and use it in GitHub Desktop.
Zeit Now + Hugo current best setup
#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then
exec hugo
else
vendor="$(cd "$(dirname $0)/.." && pwd)/vendor"
commit_ref="${NOW_GITHUB_COMMIT_REF:-master}"
if [[ "$commit_ref" == "master" ]]; then
exec $vendor/hugo
else
exec $vendor/hugo -b "https://examplecom-git-${commit_ref}.example.now.sh"
fi
fi
#!/bin/bash
version="0.59.1"
url="https://github.com/gohugoio/hugo/releases/download/v${version}/hugo_extended_${version}_Linux-64bit.tar.gz"
cd vendor &&
curl -s -L -O "$url" &&
tar -xzf "hugo_extended_${version}_Linux-64bit.tar.gz"
#!/usr/bin/env ruby
MINIMUM_HUGO_VERSION = Gem::Version.new("0.59.1")
$force = ARGV.include?("-f")
version =
`brew ls --versions hugo`.
chomp.
split(" ").
tap { |arr| arr.delete("hugo") }.
map { |s| Gem::Version.new(s) }.
max
if version.nil?
system "brew install hugo"
elsif version < MINIMUM_HUGO_VERSION
system "brew upgrade hugo"
elsif $force
system "brew upgrade hugo"
end
`which forward`
system "gem install forward" if $force or not $?.success?
{
"name": "example.com",
"version": "1.0.0",
"description": "",
"scripts": {
"install": "bin/download",
"build": "bin/build",
"dev": "hugo serve",
"forward": "forward 0.0.0.0:1313 example",
"clear": "rm -rf public/*",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/example/example.com.git"
},
"author": "Nathan Herald <me@nathanherald.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/example/example.com/issues"
},
"homepage": "https://github.com/example/example.com#readme"
}
@atdrendel
Copy link

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment