43 lines
1.4 KiB
Ruby
43 lines
1.4 KiB
Ruby
class Hugo < Formula
|
|
desc "Configurable static site generator"
|
|
homepage "https://gohugo.io/"
|
|
url "https://github.com/spf13/hugo/archive/v0.21.tar.gz"
|
|
sha256 "0de62da92e9457523463676536b57d4cae72b434edf9dcb650264cd122dfaa52"
|
|
head "https://github.com/spf13/hugo.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "553ba7475ea882b440621e796c290ec95aba61ff8506765fbc9bf0a3ef6547f8" => :sierra
|
|
sha256 "e546311b1ab76836ae84c255ff366b39ad17df7e8e7bc5c3eb8004d04e82f45a" => :el_capitan
|
|
sha256 "e960d576b2e167fdee0aae360acabd3c07235712c9496752b655a7c791a244e0" => :yosemite
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "govendor" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
(buildpath/"src/github.com/spf13/hugo").install buildpath.children
|
|
cd "src/github.com/spf13/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
|