コード例 #1
0
ファイル: helper.py プロジェクト: fviolette/docs-tools
def fetch_config(args):
    c = Configuration()
    c.ingest(args.conf_path)
    c.runstate = args

    register_content_generators(c)

    return c
コード例 #2
0
ファイル: helper.py プロジェクト: isabella232/docs-tools-1
def fetch_config(args):
    c = Configuration()
    c.ingest(args.conf_path)
    c.runstate = args

    register_content_generators(c)

    return c
コード例 #3
0
ファイル: helper.py プロジェクト: rawfalafel/docs-tools
def new_skeleton_config(conf=None):
    if conf is None:
        conf = Configuration()
        args = RuntimeStateConfig()
        conf.runstate = args

        return conf
    else:
        return conf
コード例 #4
0
ファイル: helper.py プロジェクト: Yingminzhou/docs-tools
def new_skeleton_config(conf=None):
    if conf is None:
        conf = Configuration()
        args = RuntimeStateConfig()
        conf.runstate = args

        return conf
    else:
        return conf
コード例 #5
0
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
コード例 #6
0
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()
コード例 #7
0
    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)
コード例 #8
0
 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
コード例 #9
0
 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()
コード例 #10
0
ファイル: helper.py プロジェクト: isabella232/docs-tools-1
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
コード例 #11
0
ファイル: helper.py プロジェクト: fviolette/docs-tools
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
コード例 #12
0
    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()
コード例 #13
0
    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()
コード例 #14
0
    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)
コード例 #15
0
ファイル: clean.py プロジェクト: MarkTseng/docs-tools
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()
コード例 #16
0
    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()
コード例 #17
0
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('---  <<<')
コード例 #18
0
    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]
コード例 #19
0
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('---  <<<')
コード例 #20
0
ファイル: helper.py プロジェクト: rawfalafel/docs-tools
def fetch_config(args):
    c = Configuration()
    c.ingest(args.conf_path)
    c.runstate = args

    return c
コード例 #21
0
ファイル: helper.py プロジェクト: Yingminzhou/docs-tools
def fetch_config(args):
    c = Configuration()
    c.ingest(args.conf_path)
    c.runstate = args

    return c
コード例 #22
0
ファイル: test_app.py プロジェクト: tychoish/libgiza
 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
コード例 #23
0
ファイル: test_app.py プロジェクト: banlyst/docs-tools
 def setUp(self):
     self.c = Configuration()
     self.c.runstate = RuntimeStateConfig()
     self.app = BuildApp(self.c)
コード例 #24
0
    def setUp(self):
        self.c = Configuration()
        self.c.runstate = RuntimeStateConfig()

        self.data = DummyRecord({}, self.c)
        self.data.replacement = {'state': 'foo'}
コード例 #25
0
    def setUp(self):
        self.c = Configuration()
        self.c.runstate = RuntimeStateConfig()
        self.InheritableContentBase = InheritableContentBase

        self.create_data()