* Rework the docs compilation function

This commit is contained in:
Matthew Honnibal 2015-10-25 23:15:51 +11:00
parent f16bd3b853
commit c27327d92b

26
fabfile.py vendored
View File

@ -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"):