repocribro.commands

AssignRoleCommand

class repocribro.commands.AssignRoleCommand(func=None)

Bases: flask_script.commands.Command

Assign desired role to desired user

option_list = (<flask_script.commands.Option object>, <flask_script.commands.Option object>)

CLI command options for assign-role

run(login, role_name)

Run the assign-role command with given options in order to assign role to user

Parameters:
  • login (str) – Login name of desired user
  • role_name (str) – Name of desired role
Raises:

SystemExit – If user does not exists or already had the role

DbCreateCommand

class repocribro.commands.DbCreateCommand(func=None)

Bases: flask_script.commands.Command

Perform procedure create all tables

run()

Run the db-create command to create all tables and constraints

RepocheckCommand

class repocribro.commands.RepocheckCommand(func=None)

Bases: flask_script.commands.Command

Perform check procedure of repository events

_do_check(repo)

Perform single repository check for new events

Parameters:repo (repocribro.models.Repository) – Repository to be checked
Raises:SystemExit – if GitHub API request fails

Todo

handle pagination of GitHub events

_process_event(repo, event)

Process potentially new event for repository

Parameters:
  • repo (repocribro.models.Repository) – Repository related to event
  • event (dict) – GitHub event data
Returns:

If the event was new or already registered before

Return type:

bool

event2webhook = {'PushEvent': 'push', 'RepositoryEvent': 'repository', 'ReleaseEvent': 'release'}
option_list = (<flask_script.commands.Option object>,)

CLI command options for repocheck

run(full_name=None)

Run the repocheck command to check repo(s) new events

Obviously this procedure can check events only on public repositories. If name of repository is not specified, then procedure will be called on all registered public repositories in DB.

Parameters:full_name (str) – Name of repository to be checked (if None -> all)
Raises:SystemExit – If repository with given full_name does not exist