Ver código fonte

Remove ZWS-specific things; update README.

pull/24/head
Ben Kurtovic 11 anos atrás
pai
commit
2315be6cef
2 arquivos alterados com 3 adições e 24 exclusões
  1. +2
    -0
      README.md
  2. +1
    -24
      build.py

+ 2
- 0
README.md Ver arquivo

@@ -8,6 +8,8 @@ Dependencies
============ ============


* [earwigbot](https://github.com/earwig/earwigbot) >= 0.1 * [earwigbot](https://github.com/earwig/earwigbot) >= 0.1
* [mwparserfromhell](https://github.com/earwig/mwparserfromhell) >= 0.3
* [flup](http://trac.saddi.com/flup) >= 1.0.3
* [mako](http://www.makotemplates.org/) >= 0.7.2 * [mako](http://www.makotemplates.org/) >= 0.7.2
* [oursql](http://packages.python.org/oursql/) >= 0.9.3.1 * [oursql](http://packages.python.org/oursql/) >= 0.9.3.1
* [uglifyjs](https://github.com/mishoo/UglifyJS/) >= 1.3.3 * [uglifyjs](https://github.com/mishoo/UglifyJS/) >= 1.3.3


+ 1
- 24
build.py Ver arquivo

@@ -6,7 +6,7 @@ import os
import shutil import shutil
import subprocess import subprocess


page_src = """#! /usr/bin/env python
page_src = """#! /data/project/copyvios/env/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import sys import sys
@@ -36,13 +36,6 @@ if __name__ == "__main__":
WSGIServer(main).run() WSGIServer(main).run()
""" """


rewrite_script_src = """match URL into $ with ^/~earwig/{0}(\?.*?)?$
if matched then
set URL = /~earwig/www/{1}.fcgi$1
goto END
endif
"""

class Builder(object): class Builder(object):
def __init__(self): def __init__(self):
self.build_dir = "www" self.build_dir = "www"
@@ -50,7 +43,6 @@ class Builder(object):
self.pages_dir = "pages" self.pages_dir = "pages"
self.support_dir = "pages/support" self.support_dir = "pages/support"
self.temp_dir = "temp" self.temp_dir = "temp"
self.rs_file = "rewrite.script"


self.root = logging.getLogger("builder") self.root = logging.getLogger("builder")
self.root.addHandler(logging.NullHandler()) self.root.addHandler(logging.NullHandler())
@@ -123,27 +115,12 @@ class Builder(object):
continue continue
self._gen_page(page, logger) self._gen_page(page, logger)


def gen_zws(self):
logger = self.root.getChild("zws")
target = self.rs_file

if os.path.exists(target):
logger.debug("rm {0}".format(target))
os.remove(target)

logger.debug("build rewrite.script")
with open(target, "w") as fp:
fp.write(rewrite_script_src.format("", "index"))
for page in self._pages:
fp.write(rewrite_script_src.format(page, page))

def build(self): def build(self):
self._enable_logging() self._enable_logging()
self.root.info("Building project...") self.root.info("Building project...")
self.clean() self.clean()
self.gen_static() self.gen_static()
self.gen_pages() self.gen_pages()
self.gen_zws()
self.root.info("Done!") self.root.info("Done!")






Carregando…
Cancelar
Salvar