示例#1
0
文件: build.py 项目: shunfan/hazel
def new_post(filename):
    try:
        load_config()
        load_base()
        load_path()
        initial_content = 'title: Your post title\ndate: %s\n\nStart writing here...' % datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        write(g.path.posts, filename + '.md', initial_content)
        puts(colored.green('New post is written successfully.'))
    except:
        puts(colored.red('Post cannot be written.'))
示例#2
0
文件: deploy.py 项目: shunfan/hazel
def rsync():
    try:
        load_config()
        cmd = "rsync -avz site {user}@{host}:{dest}".format(
            user=g.config.user,
            host=g.config.host,
            dest=g.config.dest,
        )
        os.system(cmd)
        puts(colored.green('Deploy is complete.'))
    except:
        puts(colored.red('rsync failed.'))
示例#3
0
文件: build.py 项目: shunfan/hazel
def generate():
    try:
        load_config()
        load_base()
        load_path()
        load_template_config()
        load_jinja()
        reset()
        handle_posts()
        handle_pages()
        copy_assets()
        puts(colored.green('Complete.'))
    except:
        puts(colored.red('Generated fail, please check if all files are in the directory.'))