Beispiel #1
0
def delete_maven_artifact(repository, pom_dirs):
    for pom_dir in pom_dirs:
        pom_info = get_pom_info(utils.get_pom_path(pom_dir))
        base_uri = utils.get_artifact_base_uri(
            repository,
            pom_info['group_id'],
            pom_info['artifact_id'],
            pom_info['version'],
        )
        yield api.call(base_uri, method='DELETE')
Beispiel #2
0
def get_pom_infos(source_dir):
    pom_infos = []
    for pom_path in pom.get_pom_paths(source_dir):
        try:
            pom_info = pom.get_pom_info(pom_path)
            pom_infos.append(pom_info)
        except Exception as e:  # pragma: no cover
            print(f'Can not add {pom_path}')
            print(e)
    return pom_infos
def get_mmp_args(root_dir):
    return {
        'output_dir':
        f'{root_dir}/{mmp_config["output_dir"]}',
        'group_id':
        getcwd().split('/')[-1],
        'artifact_id':
        'ws',
        'version':
        '1.0.0-SNAPSHOT',
        'pom_infos':
        [get_pom_info(pom_path) for pom_path in get_pom_paths(root_dir)]
    }
Beispiel #4
0
def publish_maven_artifact(repository, pom_dirs, url, username, password):
    for pom_dir in pom_dirs:
        pom_info = get_pom_info(get_pom_path(pom_dir))
        base_uri = get_artifact_base_uri(pom_info['group_id'],
                                         pom_info['artifact_id'],
                                         pom_info['version'])

        publish_data = [get_publish_data(base_uri, pom_info['pom_path'],
                                         get_pom_publish_name(pom_info['pom_path'],
                                                              pom_info['artifact_id'],
                                                              pom_info['version']))] + \
                       [get_publish_data(base_uri, path, basename(path))
                        for path in
                        glob(f'{pom_dir}/**/*.jar', recursive=True) +
                        glob(f'{pom_dir}/**/*.war', recursive=True)]

        yield [
            upload(pd['file_path'], repository, pd['repository_path'], url,
                   username, password) for pd in publish_data
        ]
Beispiel #5
0
def publish_maven_artifact(repository, pom_dirs):
    for pom_dir in pom_dirs:
        pom_info = get_pom_info(get_pom_path(pom_dir))
        base_uri = get_artifact_base_uri(repository, pom_info['group_id'],
                                         pom_info['artifact_id'],
                                         pom_info['version'])

        publish_data = [get_publish_data(base_uri, pom_info['pom_path'],
                                         get_pom_publish_name(pom_info['pom_path'],
                                                              pom_info['artifact_id'],
                                                              pom_info['version']))] + \
                       [get_publish_data(base_uri, path, path.split('/')[-1])
                        for path in
                        glob(f'{pom_dir}/**/*.jar', recursive=True) +
                        glob(f'{pom_dir}/**/*.war', recursive=True)]

        yield [
            api.call(pd['uri'], pd['checksum_headers'], pd['content'], 'PUT')
            for pd in publish_data
        ]
Beispiel #6
0
def test_get_pom_info_no_parent(pom, expected):
    with patch('vang.maven.pom.parse',
               autospec=True,
               return_value=fromstring(pom)):
        assert expected == get_pom_info('pom_path')
Beispiel #7
0
def get_artifact_id(pom_path):
    return get_pom_info(pom_path)['artifact_id']
Beispiel #8
0
def get_maven_infos(maven_repos):
    return [(r.status == Repo.STATUS_UPDATED,
             get_pom_info(f'{r.path}/pom.xml')) for r in maven_repos]