homebrew-core/Formula/hugo.rb
2017-10-16 06:48:24 -07: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.30.tar.gz"
sha256 "12ececf96c401ce401d8f9b77923c91bba9d212d1cb6543de61862e7e8482231"
head "https://github.com/gohugoio/hugo.git"
bottle do
cellar :any_skip_relocation
sha256 "ec07730b9eb1432d9babc66da62c7b711d10c304957adc138731e33d056bffd9" => :high_sierra
sha256 "de5dbc135e67ef518423bdc4827fe6ebe8d2906fbd3047e38268bcb2f597f575" => :sierra
sha256 "15ce1ebf57e1881df3fad87e8f43c6d4234011a079de401e61d79fe865a5e8cf" => :el_capitan
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_predicate testpath/"#{site}/config.toml", :exist?
end
end