Esempio n. 1
0
def _bot_helper(action, config, server, project, bot):
    server_, entity_bucket = build_entity_bucket(config, server)
    repos_factory = build_repository_factory(server_)
    project_ = entity_bucket.get_project(project=project)
    getattr(command, action)(
        bot_repository=repos_factory.create_bot_repository(project=project_),
        bot=entity_bucket.get_bot(project=project, bot=bot))
Esempio n. 2
0
def bot_list(config, server, project):
    """ボット一覧を表示する"""
    server_, entity_bucket = build_entity_bucket(config, server)
    repos_factory = build_repository_factory(server_)
    project = entity_bucket.get_project(project=project)
    command.bot_list(bot_repository=repos_factory.create_bot_repository(
        project=project))
Esempio n. 3
0
def bot_test(config, server, project, bot):
    """ボットをテストする"""
    server_, entity_bucket = build_entity_bucket(config, server)
    # テスト時は Project オブジェクトに project_id を設定する必要がないため、
    # Management API の認証は行わない
    repos_factory = build_repository_factory(server_, auth=False)
    test_result = _bot_test(entity_bucket, repos_factory, project, bot)
    _judge_test([test_result])
Esempio n. 4
0
def project_test(config, server, project):
    """プロジェクトの全てのボットをテストする"""
    server_, entity_bucket = build_entity_bucket(config, server)
    repos_factory = build_repository_factory(server_, auth=False)
    results = []
    for bot_name, _ in entity_bucket.iter_bots(project=project):
        res = _bot_test(entity_bucket, repos_factory, project, bot_name)
        results.append(res)
    _judge_test(results)
Esempio n. 5
0
def project_reset(config, server, project):
    """ボットを全て削除してプロジェクトを新規の状態にする"""
    server_, entity_bucket = build_entity_bucket(config, server)
    repos_factory = build_repository_factory(server_)
    project_ = entity_bucket.get_project(project=project)
    bot_repository = repos_factory.create_bot_repository(project=project_)

    for bot in bot_repository.get_all():
        command.bot_remove(bot_repository=bot_repository, bot=bot)
Esempio n. 6
0
def _bot_entity_helper(action_set, config, server, project, bot):
    server_, entity_bucket = build_entity_bucket(config, server)
    repos_factory = build_repository_factory(server_)
    project_ = entity_bucket.get_project(project=project)
    bot_ = entity_bucket.get_bot(project=project, bot=bot)

    repos = getattr(repos_factory, action_set[0])(project=project_, bot=bot_)
    items = getattr(entity_bucket, action_set[1])(project=project, bot=bot)
    getattr(command, action_set[2])(repos, items)
Esempio n. 7
0
def project_setup(config, server, project):
    """プロジェクトのボット作成・設定を行う"""
    server_, entity_bucket = build_entity_bucket(config, server)
    repos_factory = build_repository_factory(server_)
    for bot_name, _ in entity_bucket.iter_bots(project=project):
        _bot_setup(entity_bucket, repos_factory, project, bot_name)
Esempio n. 8
0
def project_list(config, server):
    """プロジェクト一覧を表示する"""
    server_, entity_bucket = build_entity_bucket(config, server)
    repos_factory = build_repository_factory(server_)
    command.project_list(
        project_repository=repos_factory.create_project_repository())
Esempio n. 9
0
def bot_setup(config, server, project, bot):
    """ボットを追加・設定する"""
    server_, entity_bucket = build_entity_bucket(config, server)
    repos_factory = build_repository_factory(server_)
    _bot_setup(entity_bucket, repos_factory, project, bot)