Beispiel #1
0
def db_create():
    "Will create the database."
    with application.app_context():
        freshermeat.models.db_create(
            db,
            application.config["DB_CONFIG_DICT"],
            application.config["DATABASE_NAME"],
        )
Beispiel #2
0
def import_languages(json_file):
    "Import languages from a JSON file"
    print(f"Importing languages from {json_file} ...")
    with application.app_context():
        freshermeat.scripts.import_languages(json_file)
Beispiel #3
0
def create_admin(login, password):
    "Initializes an admin user"
    print(f"Creation of the admin user {login} ...")
    with application.app_context():
        freshermeat.scripts.create_user(login, password, True)
Beispiel #4
0
def db_init():
    "Will create the database from conf parameters."
    with application.app_context():
        freshermeat.models.db_init(db)
Beispiel #5
0
def uml_graph():
    "UML graph from the models."
    with application.app_context():
        freshermeat.models.uml_graph(db)
Beispiel #6
0
def db_empty():
    "Will drop every datas stocked in db."
    with application.app_context():
        freshermeat.models.db_empty(db)
Beispiel #7
0
def import_osi_approved_licenses():
    "Import OSI approved licenses."
    print("Importing OSI approved licenses...")
    with application.app_context():
        freshermeat.scripts.import_osi_approved_licenses()
Beispiel #8
0
def import_project_from_gitlab(repository, submitter_id):
    "Import a project from GitLab."
    with application.app_context():
        stdout = freshermeat.scripts.import_project_from_gitlab(
            repository, submitter_id)
        print(stdout)
Beispiel #9
0
def import_project_from_github(owner, repo, submitter_id):
    "Import a project from GitHub."
    with application.app_context():
        stdout = freshermeat.scripts.import_project_from_github(
            owner, repo, submitter_id)
        print(stdout)
Beispiel #10
0
def import_starred_projects_from_github(user):
    "Import GitHub starred projects of a user."
    print(f"Importing GitHub starred projects of {user} ...")
    with application.app_context():
        freshermeat.scripts.import_starred_projects_from_github(user)
Beispiel #11
0
    app.cli.add_command(commands.db_empty)
    app.cli.add_command(commands.db_create)
    app.cli.add_command(commands.db_init)
    app.cli.add_command(commands.create_user)
    app.cli.add_command(commands.create_admin)
    app.cli.add_command(commands.import_languages)
    app.cli.add_command(commands.import_starred_projects_from_github)
    app.cli.add_command(commands.import_project_from_github)
    app.cli.add_command(commands.import_project_from_gitlab)
    app.cli.add_command(commands.import_osi_approved_licenses)
    app.cli.add_command(commands.fetch_cves)
    app.cli.add_command(commands.fetch_releases)
    app.cli.add_command(commands.fetch_news)


with application.app_context():

    from freshermeat.web import views

    application.register_blueprint(views.admin_bp)
    application.register_blueprint(views.user_bp)
    application.register_blueprint(views.project_bp)
    application.register_blueprint(views.projects_bp)
    application.register_blueprint(views.organization_bp)
    application.register_blueprint(views.organizations_bp)
    application.register_blueprint(views.stats_bp)
    application.register_blueprint(views.submissions_bp)
    application.register_blueprint(views.submission_bp)

    # API v2
    application.register_blueprint(views.api.v2.api_blueprint)