class Hugo < Formula desc "Configurable static site generator" homepage "https://gohugo.io/" url "https://github.com/gohugoio/hugo/archive/v0.41.tar.gz" sha256 "a5a435d352ad8df3f0dd77968e6ac21925ee006e5538a37f775d9f53b30799fc" head "https://github.com/gohugoio/hugo.git" bottle do cellar :any_skip_relocation sha256 "2002f022b2a5f80200704339d43d28c0389633afc38313b46d72a3323a4a3945" => :high_sierra sha256 "c94cd015f28be2f14ad97658f86eba14a4e88f10ec744e2041c9b4fb8e772b98" => :sierra sha256 "de917bffb27190dd7295cf78a8d5f19821376fa9d0825676ee3ef6e3934d67ea" => :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