homebrew-core/Formula/hugo.rb
2017-08-07 11:21:00 +02: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.26.tar.gz"
sha256 "1e76b6f5f0281d845c2189f7f3ae065a3ec38e32c560f4b573188878998f9c68"
head "https://github.com/gohugoio/hugo.git"
bottle do
cellar :any_skip_relocation
sha256 "350b844e036d9edab0e172eb031f96400a5e59df48e4a522c8748c5665a8e6cc" => :sierra
sha256 "3f197a9b11ed9989a08d08c4b819344824d5b765adaf0b96e7086f08e4f9e59e" => :el_capitan
sha256 "cd8253571c5339369fef4649fc9d98beb7781db68703b13cf2a0621e119d0f6e" => :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