def install(template): load_base() force_mkdir(get_path(g.path.templates, template)) templates = urllib2.urlopen('https://raw.github.com/shunfan/hazel/master/templates.yml').read() templates = yaml.load(templates) try: git_template = templates[template] os.chdir(g.path.templates) os.system('git clone %s' % git_template) puts(colored.green('Template is installed properly, please change the template name in the general config file manually.')) except: shutil.rmtree(get_path(g.path.templates, template)) puts(colored.red('Template %s is not found or installed properly.' % template))
def reset(): force_mkdir(g.path.site) os.mkdir(g.path.site_post)
def test(): force_mkdir('test_blog') os.chdir('test_blog') os.system('hazel init') os.system('hazel write test_post') os.system('hazel generate')