homebrew-core/Formula/statik.rb
2017-03-26 23:46:17 -07:00

160 lines
6.9 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.16.1.tar.gz"
sha256 "bb10e1a0718e3715d459e37aa060a4b9a7a4b4fc6a3a0a374b5516dd643c127a"
head "https://github.com/thanethomson/statik.git"
bottle do
cellar :any_skip_relocation
sha256 "7c54192f8b20b33ab2a224efcb08e6ba7c25e046ac74aabc9390917bf9fae608" => :sierra
sha256 "1b76e4221c91d6b77aa5df52189a60929289fa439dc1a5542a5a65833deedccc" => :el_capitan
sha256 "9b660c600692cccf9ab7230b8bad21e1c1b7a272a305b981d3530761f5e16ff8" => :yosemite
end
depends_on :python if MacOS.version <= :snow_leopard
resource "argh" do
url "https://files.pythonhosted.org/packages/e3/75/1183b5d1663a66aebb2c184e0398724b624cecd4f4b679cb6e25de97ed15/argh-0.26.2.tar.gz"
sha256 "e9535b8c84dc9571a48999094fda7f33e63c3f1b74f3e5f3ac0105a58405bb65"
end
resource "backports_abc" do
url "https://files.pythonhosted.org/packages/68/3c/1317a9113c377d1e33711ca8de1e80afbaf4a3c950dd0edfaf61f9bfe6d8/backports_abc-0.5.tar.gz"
sha256 "033be54514a03e255df75c5aee8f9e672f663f93abb723444caec8fe43437bde"
end
resource "certifi" do
url "https://files.pythonhosted.org/packages/b6/fa/ca682d5ace0700008d246664e50db8d095d23750bb212c0086305450c276/certifi-2017.1.23.tar.gz"
sha256 "81877fb7ac126e9215dfb15bfef7115fdc30e798e0013065158eed0707fd99ce"
end
resource "future" do
url "https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.gz"
sha256 "e39ced1ab767b5936646cedba8bcce582398233d6a627067d4c6a454c90cfedb"
end
resource "httpwatcher" do
url "https://files.pythonhosted.org/packages/6b/c1/887863463b5edd61afa31ac39705e083684e98b80e0401ab23daaee46571/httpwatcher-0.5.0.tar.gz"
sha256 "b0f5a125b0e3561be9a950698fdec0ecbff6cca86d5ccaa4897de5ab826fcdcb"
end
resource "Jinja2" do
url "https://files.pythonhosted.org/packages/71/59/d7423bd5e7ddaf3a1ce299ab4490e9044e8dfd195420fc83a24de9e60726/Jinja2-2.9.5.tar.gz"
sha256 "702a24d992f856fa8d5a7a36db6128198d0c21e1da34448ca236c42e92384825"
end
resource "lipsum" do
url "https://files.pythonhosted.org/packages/59/97/00636d64bc77dc173d782995de1b56dde39c70bb97112964452709b4d9aa/lipsum-0.1.2.tar.gz"
sha256 "ba5f46cef19104c07f889b14486a3772845fc25afa1eb5e2eee1f2d9badcb8ab"
end
resource "Markdown" do
url "https://files.pythonhosted.org/packages/1d/25/3f6d2cb31ec42ca5bd3bfbea99b63892b735d76e26f20dd2dcc34ffe4f0d/Markdown-2.6.8.tar.gz"
sha256 "0ac8a81e658167da95d063a9279c9c1b2699f37c7c4153256a458b3a43860e33"
end
resource "MarkupSafe" do
url "https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz"
sha256 "a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
end
resource "mlalchemy" do
url "https://files.pythonhosted.org/packages/90/7c/5f81b6e8f399200c87a5947c3632d527f1df68264e89b2a88b8f15840f4e/mlalchemy-0.2.1.tar.gz"
sha256 "c54afb1cc32ae8da31788f87027311a439b8616233655e473412940a9b664bfd"
end
resource "pathtools" do
url "https://files.pythonhosted.org/packages/e7/7f/470d6fcdf23f9f3518f6b0b76be9df16dcc8630ad409947f8be2eb0ed13a/pathtools-0.1.2.tar.gz"
sha256 "7c35c5421a39bb82e58018febd90e3b6e5db34c5443aaaf742b3f33d4655f1c0"
end
resource "pystache" do
url "https://files.pythonhosted.org/packages/d6/fd/eb8c212053addd941cc90baac307c00ac246ac3fce7166b86434c6eae963/pystache-0.5.4.tar.gz"
sha256 "f7bbc265fb957b4d6c7c042b336563179444ab313fb93a719759111eabd3b85a"
end
resource "python-slugify" do
url "https://files.pythonhosted.org/packages/63/86/ecf7b570089d794a9476c7411a06a329eb8e386f3407576640ccbe7a4698/python-slugify-1.2.1.tar.gz"
sha256 "501182ec738cc8b743ae5c76c183f4427187ef016257f062b3fa594f60916e34"
end
resource "PyYAML" do
url "https://files.pythonhosted.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz"
sha256 "592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab"
end
resource "singledispatch" do
url "https://files.pythonhosted.org/packages/d9/e9/513ad8dc17210db12cb14f2d4d190d618fb87dd38814203ea71c87ba5b68/singledispatch-3.4.0.3.tar.gz"
sha256 "5b06af87df13818d14f08a028e42f566640aef80805c3b50c5056b086e3c2b9c"
end
resource "six" do
url "https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz"
sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"
end
resource "SQLAlchemy" do
url "https://files.pythonhosted.org/packages/24/de/66d96cbad7a91443af1399469e9aa0aec8a41669ba6d0faae8b8411ddb27/SQLAlchemy-1.1.6.tar.gz"
sha256 "815924e3218d878ddd195d2f9f5bf3d2bb39fabaddb1ea27dace6ac27d9865e4"
end
resource "tornado" do
url "https://files.pythonhosted.org/packages/1e/7c/ea047f7bbd1ff22a7f69fe55e7561040e3e54d6f31da6267ef9748321f98/tornado-4.4.2.tar.gz"
sha256 "2898f992f898cd41eeb8d53b6df75495f2f423b6672890aadaf196ea1448edcc"
end
resource "Unidecode" do
url "https://files.pythonhosted.org/packages/ba/64/410af95d27f2a8824112d17ed41ea7ce6d2cbc8a4832c2e548d3408fad0a/Unidecode-0.04.20.tar.gz"
sha256 "ed4418b4b1b190487753f1cca6299e8076079258647284414e6d607d1f8a00e0"
end
resource "watchdog" do
url "https://files.pythonhosted.org/packages/54/7d/c7c0ad1e32b9f132075967fc353a244eb2b375a3d2f5b0ce612fd96e107e/watchdog-0.8.3.tar.gz"
sha256 "7e65882adb7746039b6f3876ee174952f8eaaa34491ba34333ddf1fe35de4162"
end
def install
virtualenv_install_with_resources
end
test do
(testpath/"config.yml").write <<-EOS.undent
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.undent
path:
template: /{{ post.pk }}/
for-each:
post: session.query(Post).all()
template: post
EOS
(testpath/"views/home.yml").write <<-EOS.undent
path: /
template: home
EOS
(testpath/"templates/home.html").write <<-EOS.undent
<html>
<head><title>Home</title></head>
<body>Hello world!</body>
</html>
EOS
(testpath/"templates/post.html").write <<-EOS.undent
<html>
<head><title>Post</title></head>
<body>{{ post.title }}</body>
</html>
EOS
system bin/"statik"
assert(File.exist?(testpath/"public/index.html"), "home view was not correctly generated!")
assert(File.exist?(testpath/"public/test-post1/index.html"), "test-post1 was not correctly generated!")
assert(File.exist?(testpath/"public/test-post2/index.html"), "test-post2 was not correctly generated!")
end
end