class Hugo < Formula desc "Configurable static site generator" homepage "https://gohugo.io/" url "https://github.com/gohugoio/hugo/archive/v0.57.1.tar.gz" sha256 "def6e233311c6e4593453d2cce43f3c82160553c9163232990eb83c80308ba20" head "https://github.com/gohugoio/hugo.git" bottle do cellar :any_skip_relocation sha256 "45f6a7d06e2e689bedf9f67b09671f0d7e1850d479a43bc066df072f90ab04a9" => :mojave sha256 "5032cec9ba066fee4f771d773ec27017323807feb0ffd1739050f310e73cdc20" => :high_sierra sha256 "03f31645e73a1645bbd67500c01c28c0dd9e962128f896359da52d9ad6880970" => :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