fix website build

This commit is contained in:
Henning Peters 2015-11-19 13:22:56 +01:00
parent 7b8a921a80
commit b1e8905ef4
3 changed files with 13 additions and 10 deletions

10
fabfile.py vendored
View File

@ -60,7 +60,7 @@ def prebuild(build_dir='/tmp/build_spacy'):
local('py.test --models spacy/tests/') local('py.test --models spacy/tests/')
def docs(): def web():
def jade(source_name, out_dir): def jade(source_name, out_dir):
pwd = path.join(path.dirname(__file__), 'website') pwd = path.join(path.dirname(__file__), 'website')
jade_loc = path.join(pwd, 'src', 'jade', source_name) jade_loc = path.join(pwd, 'src', 'jade', source_name)
@ -68,7 +68,7 @@ def docs():
local('jade -P %s --out %s' % (jade_loc, out_loc)) local('jade -P %s --out %s' % (jade_loc, out_loc))
with virtualenv(VENV_DIR): with virtualenv(VENV_DIR):
local('./website/create_code_samples tests/website/ website/src/code/') local('./website/create_code_samples spacy/tests/website/ website/src/code/')
jade('home/index.jade', '') jade('home/index.jade', '')
jade('docs/index.jade', 'docs/') jade('docs/index.jade', 'docs/')
@ -79,7 +79,11 @@ def docs():
if post_dir.is_dir() \ if post_dir.is_dir() \
and (post_dir / 'index.jade').exists() \ and (post_dir / 'index.jade').exists() \
and (post_dir / 'meta.jade').exists(): and (post_dir / 'meta.jade').exists():
jade(str(post_dir / 'index.jade'), path.join('blogs', post_dir.parts[-1])) jade(str(post_dir / 'index.jade'), path.join('blog', post_dir.parts[-1]))
def web_publish():
local('aws s3 sync --delete website/site/ s3://spacy.io')
def publish(version): def publish(version):

View File

@ -15,7 +15,7 @@ The Stack
-------- --------
The site is built with the [Jade](http://jade-lang.com/) template language. The site is built with the [Jade](http://jade-lang.com/) template language.
See [the Makefile](Makefile) for more See [fabfile.py](/fabfile.py) under ```web()``` for more
Developing Developing
@ -23,8 +23,7 @@ Developing
To make and test changes To make and test changes
``` ```
npm install jade --global npm install jade --global
cd website fab web
make python -m SimpleHTTPServer 8000 website/site
python -m SimpleHTTPServer 8000
``` ```
Then visit [localhost:8000/src/...](http://localhost:8000/src/) Then visit [localhost:8000](http://localhost:8000)

View File

@ -26,7 +26,7 @@ def main(src_dirname, dst_dirname):
continue continue
# Remove test_ prefix and .py suffix # Remove test_ prefix and .py suffix
name = filename[6:-3] name = filename[5:-3]
with io.open(os.path.join(src_dirname, filename), 'r', encoding='utf8') as file_: with io.open(os.path.join(src_dirname, filename), 'r', encoding='utf8') as file_:
source = file_.readlines() source = file_.readlines()
tree = ast.parse("".join(source)) tree = ast.parse("".join(source))