def git_deploy(config): ''' I'm still working on this. ''' try: os.mkdir('.deploy') except: pass deploy_dir = ".deploy/" copy_dir('_sites', '.deploy') deploy_branch = "master" os.chdir(deploy_dir) if not hasattr(config, 'deploy_branch'): setup_github_pages(); os.system("git add .") os.system("git add --all *") message = "Site updated at %s" % datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S") print message print "Github Pages deploy complete" os.system("git commit -m '%s'" % message) os.system("git push origin %s --force" % deploy_branch )
def git_deploy(config): ''' I'm still working on this. ''' try: os.mkdir('.deploy') except: pass deploy_dir = ".deploy/" copy_dir('_sites', '.deploy') deploy_branch = "master" os.chdir(deploy_dir) if not hasattr(config, 'deploy_branch'): setup_github_pages() os.system("git add .") os.system("git add --all *") message = "Site updated at %s" % datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S") print message print "Github Pages deploy complete" os.system("git commit -m '%s'" % message) os.system("git push origin %s --force" % deploy_branch)
def generate_site(config, full): try: shutil.rmtree(os.path.join(dir, '_sites')) except Exception as e: pass start = timeit.default_timer() copy_dir(os.path.join('themes', config.theme, 'static'), '_sites') copy_dir('static', '_sites') copydir_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format('Static Files Copied', copydir_time - start) try: os.mkdir('.private/') except Exception as e: pass copy_dir(os.path.join('themes', config.theme, 'public'), '.private') copy_dir('public/', '.private') view = Views(config, dir, full) view.get_posts() view.get_pages() view.save_db() get_posts_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format('Posts & Pages got', get_posts_time - copydir_time) view.save(view.posts, view.categories) save_other_files_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format( 'Other files saved', save_other_files_time - get_posts_time) view.save_posts(view.posts) view.save_pages(view.pages) save_posts_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format( 'Posts saved', save_posts_time - save_other_files_time) print '-------------------------------------' print '{0:20} in {1:3.3f} seconds'.format('Site Generated', save_posts_time - start) print str(len(view.posts)) + ' posts published.' try: shutil.rmtree(os.path.join(dir, '.private')) except Exception as e: pass
def generate_site(config, full): try: shutil.rmtree(os.path.join(dir, '_sites')) except Exception as e: pass start = timeit.default_timer() copy_dir(os.path.join('themes', config.theme, 'static'), '_sites') copy_dir('static', '_sites') copydir_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format('Static Files Copied', copydir_time - start) try: os.mkdir('.private/') except Exception as e: pass copy_dir(os.path.join('themes', config.theme, 'public'), '.private') copy_dir('public/', '.private') view = Views(config, dir, full) view.get_posts() view.get_pages() view.save_db() get_posts_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format('Posts & Pages got', get_posts_time - copydir_time) view.save(view.posts, view.categories) save_other_files_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format('Other files saved', save_other_files_time - get_posts_time) view.save_posts(view.posts) view.save_pages(view.pages) save_posts_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format('Posts saved', save_posts_time - save_other_files_time) print '-------------------------------------' print '{0:20} in {1:3.3f} seconds'.format('Site Generated', save_posts_time - start) print str(len(view.posts)) + ' posts published.' try: shutil.rmtree(os.path.join(dir, '.private')) except Exception as e: pass
def init_site(site_name): dir = path.dirname(path.abspath(__file__)) + '/init' copy_dir(dir, site_name)
def init_site(site_name): curr = path.dirname(path.abspath(__file__)) dir = path.join(curr, "init") copy_dir(dir, site_name)
import shutil import config from crotal.views import Views from crotal.copy_dir import copy_dir from crotal.config import Config dir = os.getcwd() def generate_site(config): try: shutil.rmtree(dir + '/_sites/') except Exception, e: pass start = timeit.default_timer() copy_dir('themes/' + config.theme + '/static', '_sites') copy_dir('static', '_sites') copydir_time = timeit.default_timer() print '{0:20} in {1:3.3f} seconds'.format('Static Files Copied', copydir_time - start) try: os.mkdir('.private/') except Exception, e: pass copy_dir('themes/' + config.theme + '/public', '.private') copy_dir('public/', '.private') view = Views(config, dir) view.get_posts() view.get_pages() get_posts_time = timeit.default_timer()