homebrew-core/Formula/hugo.rb
2019-07-26 02:41:09 +08: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.56.0.tar.gz"
sha256 "e8a36f659168784a1cd9541bdaa45191bd1a91b73a1e7fddd85d1d66fdc774f9"
head "https://github.com/gohugoio/hugo.git"
bottle do
cellar :any_skip_relocation
sha256 "c0d175235dbfff70879c8cad34aff1d266b669c553245fe1c29644427a48fa95" => :mojave
sha256 "1212a8ca0fa10ad73a870e245e3a8605a2a0eb925f4ae887f73d98ba02323b29" => :high_sierra
sha256 "d135b8c55d4e29d13e37edf9e9bb69cd9c1c2685df0c152c9cf648284587f464" => :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