Пример #1
0
def build_java(model, fast):
    name = snake_case(model['metadata']['name'])
    root = 'java/{name}/src/corgis/{name}/'.format(name=snake_case(name))
    new_folder = 'java/' + name + '/'

    files = {
        new_folder + '/libs/sqlite-jdbc-3.8.11.2.jar':
        copy_file(java_templates + 'libs/sqlite-jdbc-3.8.11.2.jar'),
        new_folder + '/libs/json-simple-1.1.1.jar':
        copy_file(java_templates + 'libs/json-simple-1.1.1.jar')
    }

    icon_file = model['metadata']['icon']

    if os.path.exists(icon_file):
        with open(icon_file, 'rb') as icon_data:
            files[new_folder + name + '.png'] = icon_data.read()
    else:
        model["metadata"]["icon"] = False

    files.update(build_metafiles(model))
    files.update(build_main(model))
    files.update(build_classes(model))

    if not fast:
        new_file, database_file = build_database(model)
        build_locals(model, database_file)

        database_file.close()
        moves = {new_file: new_folder}
        for appendix in model['metadata']['appendix']:
            moves[appendix['file']] = new_folder
    else:
        moves = {}

    return files, moves
Пример #2
0
def build_racket(model):
    files = {'racket/sticky-web.rkt' : copy_file(templates+'sticky-web.rkt')}
    files.update(build_documentation(model))
    files.update(build_main(model))
    return files