Esempio n. 1
0
def setup():
    '''
    Sets up a new blog in the current directory.
    '''
    # it is a new blog if conf.py doesn't already exist
    new_blog = writer.setup_blog()

    filename.info("conf.py")
    if new_blog:
        write.info("Your new blog is almost ready!")
        write.info("You just need to edit a couple of lines in %s" % (os.path.relpath(paths.conf_file), ))
    else:
        write.info("Done")
Esempio n. 2
0
def setup():
    '''
    Sets up a new blog in the current directory.
    '''
    # it is a new blog if conf.py doesn't already exist
    new_blog = writer.setup_blog()

    filename.info("conf.py")
    if new_blog:
        write.info("Your new blog is almost ready!")
        write.info("You just need to edit a couple of lines in %s" %
                   (os.path.relpath(paths.conf_file), ))
    else:
        write.info("Done")
Esempio n. 3
0
def create_page(title):
    '''
    Creates a new page with the given title or makes an existing file a page.
    '''
    move = os.path.exists(title)

    if move:
        new_page = page.move(title)
    else:
        new_page = page.create(title)

    filename.info(new_page.path)
    if move:
        write.info("Draft moved to page '%s'" % new_page.path)
    else:
        write.info("New page created as '%s'" % new_page.path)
Esempio n. 4
0
def create_post(title, date=None):
    '''
    Creates a new post with the given title or makes an existing file a post.
    '''
    move = os.path.exists(title)

    if move:
        new_post = post.move(title, date)
    else:
        new_post = post.create(title, date)

    filename.info(new_post.path)
    if move:
        write.info("Draft moved to post '%s'" % new_post.path)
    else:
        write.info("New post created as '%s'" % new_post.path)
Esempio n. 5
0
def create_draft(title):
    '''
    Creates a new draft with the given title or makes an existing file a draft.
    '''
    move = os.path.exists(title)

    if move:
        new_draft = draft.move(title)
    else:
        new_draft = draft.create(title)

    filename.info(new_draft)
    if move:
        write.info("File moved to draft '%s'" % new_draft)
    else:
        write.info("New draft created as '%s'" % new_draft)
Esempio n. 6
0
def create_page(title):
    '''
    Creates a new page with the given title or makes an existing file a page.
    '''
    move = os.path.exists(title)

    if move:
        new_page = page.move(title)
    else:
        new_page = page.create(title)

    filename.info(new_page.path)
    if move:
        write.info("Draft moved to page '%s'" % new_page.path)
    else:
        write.info("New page created as '%s'" % new_page.path)
Esempio n. 7
0
def create_post(title, date=None):
    '''
    Creates a new post with the given title or makes an existing file a post.
    '''
    move = os.path.exists(title)

    if move:
        new_post = post.move(title, date)
    else:
        new_post = post.create(title, date)

    filename.info(new_post.path)
    if move:
        write.info("Draft moved to post '%s'" % new_post.path)
    else:
        write.info("New post created as '%s'" % new_post.path)
Esempio n. 8
0
def create_draft(title):
    '''
    Creates a new draft with the given title or makes an existing file a draft.
    '''
    move = os.path.exists(title)

    if move:
        new_draft = draft.move(title)
    else:
        new_draft = draft.create(title)

    filename.info(new_draft)
    if move:
        write.info("File moved to draft '%s'" % new_draft)
    else:
        write.info("New draft created as '%s'" % new_draft)
Esempio n. 9
0
def build():
    '''
    Runs a clean Sphinx build of the blog.
    '''
    # clean build directory
    if os.path.exists(paths.blog):
        shutil.rmtree(paths.blog)

    flags = ["sphinx-build"]
    # silence Sphinx if in quiet mode
    if output.quiet:
        flags.append("-q")
    flags += ["-d", paths.doctree, "-b", "html", paths.root, paths.html]

    # build always prints "index.html"
    filename.info("index.html")

    # copy some extra files to the output directory
    if os.path.exists("_copy"):
        shutil.copytree("_copy/", paths.html)

    return sphinx.main(flags)
Esempio n. 10
0
def build():
    '''
    Runs a clean Sphinx build of the blog.
    '''
    # clean build directory
    if os.path.exists(paths.blog):
        shutil.rmtree(paths.blog)

    flags = ["sphinx-build"]
    # silence Sphinx if in quiet mode
    if output.quiet:
        flags.append("-q")
    flags += ["-d", paths.doctree, "-b", "html", paths.root, paths.html]

    # build always prints "index.html"
    filename.info("index.html")

    # copy some extra files to the output directory
    if os.path.exists("_copy"):
        shutil.copytree("_copy/", paths.html)

    return sphinx.main(flags)