def fetch_config(args): c = Configuration() c.ingest(args.conf_path) c.runstate = args register_content_generators(c) return c
def new_skeleton_config(conf=None): if conf is None: conf = Configuration() args = RuntimeStateConfig() conf.runstate = args return conf else: return conf
def new_skeleton_config(conf=None): if conf is None: conf = Configuration() args = RuntimeStateConfig() conf.runstate = args try: register_content_generators(conf) except KeyError: logger.warning("cannot register content generators") return conf else: return conf
def main(args): c = Configuration() c.ingest(args.conf_path) c.runstate = args app = BuildApp(c) to_remove = [] if c.runstate.builder_to_delete is not None: builder = c.runstate.builder_to_delete to_remove.append( os.path.join(c.paths.branch_output, 'doctrees-' + builder)) to_remove.append(os.path.join(c.paths.branch_output, builder)) m = 'remove artifacts associated with the {0} builder in {1}' logger.debug(m.format(builder, c.git.branches.current)) if c.runstate.days_to_save is not None: published_branches = [ 'docs-tools', 'archive', 'public', 'primer', c.git.branches.current ] published_branches.extend(c.git.branches.published) for build in os.listdir( os.path.join(c.paths.projectroot, c.paths.output)): build = os.path.join(c.paths.projectroot, c.paths.output, build) branch = os.path.split(build)[1] if branch in published_branches: continue elif not os.path.isdir(build): continue elif os.stat(build).st_mtime > c.runstate.days_to_save: to_remove.append(build) to_remove.append( os.path.join(c.paths.projectroot, c.paths.output, 'public', branch)) logger.debug( 'removed stale artifacts: "{0}" and "build/public/{0}"'. format(branch)) for fn in to_remove: t = app.add() t.job = rm_rf t.args = fn m = 'removing artifact: {0}'.format(fn) t.description = m logger.critical(m) app.run()
def new_skeleton_config(conf=None): if conf is None: conf = Configuration() args = RuntimeStateConfig() conf.runstate = args try: register_content_generators(conf) except KeyError: logger.warning("trouble registering content generators") return conf elif isinstance(conf, RuntimeStateConfig): return fetch_config(conf) else: return conf
def clean(args): c = Configuration() c.ingest(args.conf_path) c.runstate = args app = BuildApp(c) to_remove = [] if c.runstate.builder_to_delete is not None: builder = c.runstate.builder_to_delete to_remove.append( os.path.join(c.paths.branch_output, 'doctrees-' + builder)) to_remove.append( os.path.join(c.paths.branch_output, builder)) m = 'remove artifacts associated with the {0} builder in {1}' logger.debug(m.format(builder, c.git.branches.current)) if c.runstate.days_to_save is not None: published_branches = [ 'docs-tools', 'archive', 'public', 'primer', c.git.branches.current ] published_branches.extend(c.git.branches.published) for build in os.listdir(os.path.join(c.paths.projectroot, c.paths.output)): build = os.path.join(c.paths.projectroot, c.paths.output, build) branch = os.path.split(build)[1] if branch in published_branches: continue elif not os.path.isdir(build): continue elif os.stat(build).st_mtime > c.runstate.days_to_save: to_remove.append(build) to_remove.append(os.path.join(c.paths.projectroot, c.paths.output, 'public', branch)) logger.debug('removed stale artifacts: "{0}" and "build/public/{0}"'.format(branch)) for fn in to_remove: t = app.add() t.job = rm_rf t.args = fn m = 'removing artifact: {0}'.format(fn) t.description = m logger.critical(m) app.run()
def render_config(args): c = Configuration() c.ingest(args.conf_path) c.runstate = args # the following values are rendered lazily. we list them here so that the # final object will be useful to inspect. dynamics = [ c.git.commit, c.paths.public, c.git.branches.current, c.git.branches.manual, c.git.branches.published, c.paths.branch_output, c.paths.buildarchive, c.paths.branch_source, c.paths.branch_staging, c.version.published, c.version.stable, c.version.upcoming, c.project.edition, c.deploy, c.paths.global_config, c.project.branched, c.system.dependency_cache, c.paths.public_site_output, c.project.basepath, c.runstate.runner, c.runstate.force, c.system.files, c.system.files.paths, c.system.files.data ] print('--- ' + "str of config object >>>") print(json.dumps(c.dict(), indent=3)) print('--- <<<')
def render_config(args): c = Configuration() c.ingest(args.conf_path) c.runstate = args # the following values are rendered lazily. we list them here so that the # final object will be useful to inspect. dynamics = [ c.git.commit, c.paths.public, c.git.branches.current, c.git.branches.manual, c.git.branches.published, c.paths.branch_output, c.paths.buildarchive, c.paths.branch_source, c.paths.branch_staging, c.version.published, c.version.stable, c.version.upcoming, c.project.edition, c.deploy, c.paths.global_config, c.project.branched, c.system.dependency_cache, c.paths.public_site_output, c.project.basepath, c.runstate.runner, c.runstate.force, c.system.files, c.system.files.paths, c.system.files.data, c.paths.htaccess ] print('--- ' + "str of config object >>>") print(json.dumps(c.dict(), indent=3)) print('--- <<<')
def fetch_config(args): c = Configuration() c.ingest(args.conf_path) c.runstate = args return c