From c27327d92b81cb72550215fe681545e30d5e6998 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 25 Oct 2015 23:15:51 +1100 Subject: [PATCH] * Rework the docs compilation function --- fabfile.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/fabfile.py b/fabfile.py index 61a2dcdc3..f4fa28169 100644 --- a/fabfile.py +++ b/fabfile.py @@ -1,9 +1,12 @@ +from __future__ import print_function + from fabric.api import local, lcd, env, settings, prefix from os.path import exists as file_exists from fabtools.python import virtualenv from os import path import os import shutil +from pathlib import Path PWD = path.dirname(__file__) @@ -56,10 +59,25 @@ def prebuild(build_dir='/tmp/build_spacy'): local('fab test') local('python setup.py sdist') + def docs(): - with virtualenv(VENV_DIR): - with lcd(path.join(path.dirname(__file__), 'docs')): - local('make html') + def jade(source_name, out_dir): + pwd = path.join(path.dirname(__file__), 'website') + jade_loc = path.join(pwd, 'src', 'jade', source_name) + out_loc = path.join(pwd, 'site', out_dir) + local('jade -P %s --out %s' % (jade_loc, out_loc)) + + jade('home/index.jade', '') + jade('docs/index.jade', 'docs/') + jade('blog/index.jade', 'blog/') + jade('tutorials/index.jade', 'tutorials/') + + for post_dir in (Path(__file__).parent / 'website' / 'src' / 'jade' / 'blog').iterdir(): + if post_dir.is_dir() \ + and (post_dir / 'index.jade').exists() \ + and (post_dir / 'meta.jade').exists(): + jade(str(post_dir / 'index.jade'), path.join('blogs', post_dir.parts[-1])) + def publish(version): with virtualenv(VENV_DIR): @@ -68,7 +86,7 @@ def publish(version): local('git push origin %s' % version) local('python setup.py sdist') local('python setup.py register') - local('twine upload dist/%s.tar.gz' % version) + local('twine upload dist/spacy-%s.tar.gz' % version) def env(lang="python2.7"):