43 lines
1.4 KiB
Ruby
43 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.42.1.tar.gz"
|
|
sha256 "4450c9434269dac75f4a6cb702d8704a49c73e17f974dc2fa15e699c03b9774b"
|
|
head "https://github.com/gohugoio/hugo.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "516cb303d7e75e383f4ce59d7753ed2c3c303543681c896871096483cca9e5a7" => :high_sierra
|
|
sha256 "771926ec338f0edc53e50d59ef73f97d6ac84d92a5d419317f50f292565197a3" => :sierra
|
|
sha256 "3935b45d83c43649cbc23d4e98ab89c6387b745528cc885bd048acf1508b836f" => :el_capitan
|
|
end
|
|
|
|
depends_on "dep" => :build
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
(buildpath/"src/github.com/gohugoio/hugo").install buildpath.children
|
|
cd "src/github.com/gohugoio/hugo" do
|
|
system "dep", "ensure", "-vendor-only"
|
|
system "go", "build", "-o", bin/"hugo", "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
|