Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (60 sloc) 2.38 KB
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.21.2.tar.gz"
sha256 "71c2c0352efb83df68d7f7e239c80f1e3c42989e478503ea1921f66206128452"
head "https://github.com/thanethomson/statik.git"
bottle do
cellar :any_skip_relocation
sha256 "2ed6a6bb627324266fea054896a52ec9e2486a4300f5f81c1a27bb73bf63cece" => :mojave
sha256 "1e06fe468903f6e079711016b117c9710acc5b8515d31281516180359056885c" => :high_sierra
sha256 "17f94e0fe1ff71273675d4140e34230970387b3733ba4d7e96de7d8d4a8d955d" => :sierra
sha256 "9854b3a59217e9f747890fdad3cba25245bb264dcd72350a8b805701e8b46870" => :el_capitan
end
depends_on "python@2"
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