Exemplo n.º 1
0
def run(opts):
    validate_opts(opts)

    bindings = {
        'module': opts.get('<module>'),
        'singular': inflection.underscore(opts.get('<module>')),
        'model': inflection.camelize(opts.get('--model')) if opts.get('--model') else '',
        'fields': parse_fields(opts.get('<fields>')),
    }
    bindings.update(get_proj_info())
    bindings.update(collect_meta(bindings.get('fields')))

    location = get_location(bindings) or TPL_PATH
    copy(f'{location}/gen', '.', data=bindings, exclude=['*/models/*', '*/views/*', 'tests/*'])
Exemplo n.º 2
0
def run(opts):
    validate_opts(opts)

    bindings = {
        'module': opts.get('<module>'),
        'singular': inflection.underscore(opts.get('<module>')),
        'table': opts.get('<table>'),
        'fields': parse_fields(opts.get('<fields>'))
    }
    bindings.update(get_proj_info())

    location = get_location(bindings) or TPL_PATH
    copy(f'{location}/gen',
         '.',
         data=bindings,
         exclude=['*/schemas/*', '*/views/*', 'test/*'])
Exemplo n.º 3
0
def run(opts):
    model.run(opts)
    sch_opts = opt_pipe(opts)
    schema.run(sch_opts)

    bindings = {
        'module': opts.get('<module>'),
        'singular': inflection.underscore(opts.get('<module>')),
        'plural': opts.get('<table>'),
        'table': opts.get('<table>'),
        'fields': opts.get('<fields>')
    }
    bindings.update(get_proj_info())

    location = get_location(bindings) or TPL_PATH
    copy(f'{location}/gen',
         '.',
         data=bindings,
         exclude=['*/models/*', '*/schemas/*', 'test/*'])