homebrew-core/Formula/hugo.rb
2019-04-20 21:49:44 +02:00

42 lines
1.4 KiB
Ruby

class Hugo < Formula
desc "Configurable static site generator"
homepage "https://gohugo.io/"
url "https://github.com/gohugoio/hugo/archive/v0.55.3.tar.gz"
sha256 "a9342ab84cd86c50aec2f38358efb16c6a9e38ff2893b559b616f34231daa634"
head "https://github.com/gohugoio/hugo.git"
bottle do
cellar :any_skip_relocation
sha256 "67039e14d6434da563f149484be318e238cba5a2e8de5bc667540e0ae0f45ae6" => :mojave
sha256 "785577a4d4201a6d67b47a1c342e07ad56ce68f41011f77bae2abdfefd5105e3" => :high_sierra
sha256 "fb9779aab2be8c543d8bdff094dece5c5a654f6d9897fd599887653a231c0409" => :sierra
end
depends_on "go" => :build
def install
ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache"
(buildpath/"src/github.com/gohugoio/hugo").install buildpath.children
cd "src/github.com/gohugoio/hugo" do
system "go", "build", "-o", bin/"hugo", "-tags", "extended", "main.go"
# Build bash completion
system bin/"hugo", "gen", "autocomplete", "--completionfile=hugo.sh"
bash_completion.install "hugo.sh"
# Build man pages; target dir man/ is hardcoded :(
(Pathname.pwd/"man").mkpath
system bin/"hugo", "gen", "man"
man1.install Dir["man/*.1"]
prefix.install_metafiles
end
end
test do
site = testpath/"hops-yeast-malt-water"
system "#{bin}/hugo", "new", "site", site
assert_predicate testpath/"#{site}/config.toml", :exist?
end
end