def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.task = MapTask() self.task.job = sum self.Task = MapTask self.task.conf = self.c
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.state['git'] = giza.config.git.GitConfig({}, self.c, os.getcwd()) self.setUpClasses() self.create_data()
def test_configuration_object_validation_acceptance(self): for i in [self.c, Configuration(), RuntimeStateConfig()]: t = self.Task() self.assertIsNone(t.conf) t.conf = i self.assertIs(i, t.conf)
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = {'includes': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data-inheritance')} self.DataCache = DataCache self.create_data()
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 setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = {'includes': get_test_file_path()} self.DataContentBase = DataContentBase self.DataCache = DataCache self.create_data()
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = { 'includes': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data-inheritance') } self.data = DummyCache([], self.c)
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 setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = {'includes': 'data-inheritance', 'projectroot': os.path.abspath(os.path.dirname(__file__))} self.DataContentBase = DataContentBase self.DataCache = DataCache self.InheritableContentBase = InheritableContentBase self.dummy_doc = {'ref': 'dummy-doc', 'pre': 'pre text'} self.create_data()
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = { 'includes': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data-inheritance') } self.content_fn = get_inheritance_data_files()[0] self.data = DummyCache([], self.c) self.data.ingest([self.content_fn]) self.content = self.data.cache[self.content_fn]
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 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
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.app = BuildApp(self.c)
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.app = BuildApp(self.c) self.app.default_pool = random.choice(['serial', 'thread']) self.app.pool_size = 2
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.data = DummyRecord({}, self.c) self.data.replacement = {'state': 'foo'}
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.InheritableContentBase = InheritableContentBase self.create_data()