66 lines
2.3 KiB
Ruby
66 lines
2.3 KiB
Ruby
class Statik < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Python-based, generic static web site generator aimed at developers"
|
|
homepage "https://getstatik.com"
|
|
url "https://github.com/thanethomson/statik/archive/v0.19.1.tar.gz"
|
|
sha256 "d50eecd36a2380394c01c17d63579ada684d4b549f3191cbe7b7481ba829f870"
|
|
head "https://github.com/thanethomson/statik.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "3f5c851bad6784866e2f7e6b7a1c3f1fc517f24e963b3a9d625365e8b7590626" => :high_sierra
|
|
sha256 "0a1806db8ef48d966e4cde9c954cbf5b0a133b3add06e3b622727eca79513432" => :sierra
|
|
sha256 "f3f1dea8b29df049b296862562ef8df1a3007ab7eae0d68dd40c1e111fc73b9e" => :el_capitan
|
|
end
|
|
|
|
depends_on "python" if MacOS.version <= :snow_leopard
|
|
|
|
conflicts_with "go-statik", :because => "both install `statik` binaries"
|
|
|
|
def install
|
|
venv = virtualenv_create(libexec)
|
|
system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:",
|
|
"--ignore-installed", buildpath
|
|
system libexec/"bin/pip", "uninstall", "-y", "statik"
|
|
venv.pip_install_and_link buildpath
|
|
end
|
|
|
|
test do
|
|
(testpath/"config.yml").write <<~EOS
|
|
project-name: Homebrew Test
|
|
base-path: /
|
|
EOS
|
|
(testpath/"models/Post.yml").write("title: String")
|
|
(testpath/"data/Post/test-post1.yml").write("title: Test post 1")
|
|
(testpath/"data/Post/test-post2.yml").write("title: Test post 2")
|
|
(testpath/"views/posts.yml").write <<~EOS
|
|
path:
|
|
template: /{{ post.pk }}/
|
|
for-each:
|
|
post: session.query(Post).all()
|
|
template: post
|
|
EOS
|
|
(testpath/"views/home.yml").write <<~EOS
|
|
path: /
|
|
template: home
|
|
EOS
|
|
(testpath/"templates/home.html").write <<~EOS
|
|
<html>
|
|
<head><title>Home</title></head>
|
|
<body>Hello world!</body>
|
|
</html>
|
|
EOS
|
|
(testpath/"templates/post.html").write <<~EOS
|
|
<html>
|
|
<head><title>Post</title></head>
|
|
<body>{{ post.title }}</body>
|
|
</html>
|
|
EOS
|
|
system bin/"statik"
|
|
|
|
assert_predicate testpath/"public/index.html", :exist?, "home view was not correctly generated!"
|
|
assert_predicate testpath/"public/test-post1/index.html", :exist?, "test-post1 was not correctly generated!"
|
|
assert_predicate testpath/"public/test-post2/index.html", :exist?, "test-post2 was not correctly generated!"
|
|
end
|
|
end
|