Ejemplo n.º 1
0
Archivo: main.py Proyecto: fj/blogofile
def do_build(args):
    #load config
    config_file = os.path.join(args.src_dir,"_config.py")
    try:
        config.init(config_file)
    except config.ConfigNotFoundException:
        print >>sys.stderr, ("No configuration found: %s" % config_file)
        parser.exit(1, "Want to make a new site? Try `blogofile init`\n")

    logger.info("Running user's pre_build() function..")
    writer = Writer(output_dir="_site")
    if config.blog_enabled == True:
        config.pre_build()
        posts = post.parse_posts("_posts")
        if args.include_drafts:
            drafts = post.parse_posts("_drafts", config)
            for p in drafts:
                p.draft = True
        else:
            drafts = None
        writer.write_blog(posts, drafts)
    else:
        #Build the site without a blog
        writer.write_site()
    logger.info("Running user's post_build() function..")
    config.post_build()
Ejemplo n.º 2
0
def do_build(args, load_config=True):
    if load_config:
        config_init(args)
    writer = Writer(output_dir=util.path_join("_site",util.fs_site_path_helper()))
    logger.debug("Running user's pre_build() function..")
    config.pre_build()
    writer.write_site()
    logger.debug("Running user's post_build() function..")
    config.post_build()
Ejemplo n.º 3
0
def do_build(args, load_config=True):
    if load_config:
        config_init(args)
    output_dir = util.path_join("_site", util.fs_site_path_helper())
    writer = Writer(output_dir=output_dir)
    logger.debug("Running user's pre_build() function...")
    config.pre_build()
    try:
        writer.write_site()
        logger.debug("Running user's post_build() function...")
        config.post_build()
    finally:
        logger.debug("Running user's build_finally() function...")
        config.build_finally()
Ejemplo n.º 4
0
def do_build(args):
    #load config
    try:
        # Always load the _config.py from the current directory.
        # We already changed to the directory specified with --src-dir
        config.init("_config.py")
    except config.ConfigNotFoundException:
        print >>sys.stderr, ("No configuration found in source dir: %s" % args.src_dir)
        parser.exit(1, "Want to make a new site? Try `blogofile init`\n")

    writer = Writer(output_dir="_site")
    logger.debug("Running user's pre_build() function..")
    config.pre_build()
    writer.write_site()
    logger.debug("Running user's post_build() function..")
    config.post_build()