Beispiel #1
0
def generate_project_configs(name, directory, **kwargs):
    context = build_context(inflection.underscore(name), directory, **kwargs)

    yield from generate_license(name, directory, **kwargs)
    yield from generate_readme(name, directory, **kwargs)

    yield model.File(
        path=os.path.join(directory, '.gitignore'),
        content='dist\n__pycache__\n*.egg-info\n*.pyc\n.tox\n.pyclirc',
    )

    yield model.File(path=os.path.join(directory, 'setup.py'),
                     template='setup.py.j2',
                     context=context)

    yield model.File(path=os.path.join(directory, 'setup.cfg'),
                     template='setup.cfg.j2',
                     context=context)

    yield model.File(path=os.path.join(directory, 'requirements.txt'),
                     content='.')

    yield model.File(
        path=os.path.join(directory, 'MANIFEST.in'),
        content='include *.rst *.txt *.md',
    )
Beispiel #2
0
def generate_pycli_config(name, directory, **kwargs):
    config = model.ProjectConfig(**kwargs)

    yield model.File(
        path=os.path.join(directory, '.pyclirc'),
        content=json.dumps(dict(config)),
    )
Beispiel #3
0
def generate_class(name, directory, **kwargs):
    path = os.path.join(directory, '{}.py'.format(inflection.underscore(name)))
    context = build_context(inflection.camelize(name), directory, **kwargs)

    yield model.File(
        path=path,
        template='class.py.j2',
        context=context,
    )
Beispiel #4
0
def generate_module(name, directory, version=None, **kwargs):
    path = os.path.join(directory, inflection.underscore(name))

    yield model.Directory(path=path)

    yield model.File(
        path=os.path.join(path, '__init__.py'),
        content="__version__ = '%s'" % version if version is not None else '',
    )
Beispiel #5
0
def generate_project_tests(name, directory, **kwargs):
    context = build_context(inflection.underscore(name), directory, **kwargs)

    test_dir = os.path.join(directory, 'tests')

    yield model.File(
        path=os.path.join(directory, 'tox.ini'),
        template='tox.ini.j2',
        context=context,
    )
    yield model.File(
        path=os.path.join(directory, 'coverage.cfg'),
        template='coverage.cfg.j2',
        context=context,
    )

    yield model.Directory(path=test_dir)

    yield model.File(path=os.path.join(test_dir, '__init__.py'), )
Beispiel #6
0
def generate_readme(name, directory, **kwargs):
    context = build_context(inflection.titleize(name),
                            directory,
                            module_name=inflection.underscore(name),
                            **kwargs)

    yield model.File(
        path=os.path.join(directory, 'README.rst'),
        template='README.rst.j2',
        context=context,
    )
Beispiel #7
0
def generate_project_makefile(name, directory, **kwargs):
    context = build_context(inflection.titleize(name),
                            directory,
                            module_name=inflection.underscore(name),
                            **kwargs)

    yield model.File(
        path=os.path.join(directory, 'Makefile'),
        template='Makefile.j2',
        context=context,
    )
Beispiel #8
0
def generate_license(name, directory, **kwargs):
    yield model.File(path=os.path.join(directory, 'LICENSE.txt'))