def cmd_clear(parser): if not site.home(): sys.exit("Error: cannot locate the site's home directory.") if not os.path.exists(site.out()): sys.exit("Error: cannot locate the site's output directory.") utils.cleardir(site.out())
def cmd_build(parser): if not site.home(): sys.exit("Error: cannot locate the site's home directory.") if parser['out']: site.setconfig('[out]', parser['out']) if parser['src']: site.setconfig('[src]', parser['src']) if parser['lib']: site.setconfig('[lib]', parser['lib']) if parser['inc']: site.setconfig('[inc]', parser['inc']) if parser['theme']: site.setconfig('[theme]', site.find_theme(parser['theme'])) if parser['clear']: utils.cleardir(site.out()) site.setconfig('[flags]', parser.get_args()) @hooks.register('main') def build_callback(): if os.path.isdir(site.src()): build.build_site() else: sys.exit("Error: cannot locate the site's source directory.")