homebrew-core/Formula/hugo.rb
2018-04-10 07:25:42 +10:00

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.38.2.tar.gz"
sha256 "a8197de4e2480dade53cfe6c0213c3576efe468d1e21d7518cecb019edbbb846"
head "https://github.com/gohugoio/hugo.git"
bottle do
cellar :any_skip_relocation
sha256 "3db4a50ddfeee25428fe2ee3b0072553a8400d84d231f5bf4d199c4c09158020" => :high_sierra
sha256 "98dce0d4be82c65719e496cb1bfb1d9aded9248d1a5177f5520d10b15b591ef8" => :sierra
sha256 "369f5dbba9edc5281b3caa79eacd2ef392ff69f504dd4de9dd68efd748b6d800" => :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"
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