class Hugo < Formula desc "Configurable static site generator" homepage "https://gohugo.io/" url "https://github.com/gohugoio/hugo/archive/v0.23.tar.gz" sha256 "580a6ae2873215419615fc1146a39122b80799e674b0a033446785fd72a29626" head "https://github.com/gohugoio/hugo.git" bottle do cellar :any_skip_relocation sha256 "e9cb3081070a3946bcc072ba5ad868fe5acba33c8932b046bbe9bbfa5de3998b" => :sierra sha256 "9459d8c824756bfae330a3082d3bb84087a7045dfe8172edc3bc59fb1585f41e" => :el_capitan sha256 "13b8d77383a02e687ee3e2187adc3885c16c43e5a6b530d6c98707f414e14c71" => :yosemite end depends_on "go" => :build depends_on "govendor" => :build def install ENV["GOPATH"] = buildpath (buildpath/"src/github.com/gohugoio/hugo").install buildpath.children cd "src/github.com/gohugoio/hugo" do system "govendor", "sync" 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 File.exist?("#{site}/config.toml") end end