def _checkout_package(package, commit):
        repo_folder = Session.matador_repository_folder
        package_folder = Path(
            Session.matador_packages_folder, package)

        shutil.rmtree(str(package_folder), ignore_errors=True)

        Session.update_repository()

        git.checkout(Session.matador_repo, commit)

        src = Path(repo_folder, 'deploy', 'packages', package)
        shutil.copytree(str(src), str(package_folder))
Exemple #2
0
def _fetch_report(repo, report_path, commit_ref, target_folder):
    report = Path(repo.path, report_path)
    target_report = Path(target_folder, report.name)
    version, commit_timestamp, author = git.keyword_values(repo, commit_ref)

    git.checkout(repo, commit_ref)

    target_report.touch()
    zippey.decode(report.open("rb"), target_report.open("wb"))

    workbook = load_workbook(str(target_report))
    workbook.properties.creator = author
    workbook.properties.version = version
    workbook.save(str(target_report))

    return target_report
def _fetch_script(repo, script_path, commit_ref, target_folder):
    script = Path(repo.path, script_path)
    target_script = Path(target_folder, script.name)

    git.checkout(repo, commit_ref)

    with script.open('r') as f:
        original_text = f.read()
        f.close()

    new_text = git.substitute_keywords(original_text, repo, commit_ref)

    with target_script.open('w') as f:
        f.write(new_text)
        f.close()

    return target_script
Exemple #4
0
def _checkout_ticket(ticket, repo, ticket_folder, commit):
    git.checkout(repo, commit)
    src = Path(repo.path, 'deploy', 'tickets', ticket)
    shutil.rmtree(str(ticket_folder), ignore_errors=True)
    shutil.copytree(str(src), str(ticket_folder))
Exemple #5
0
def test_checkout(project_repo):
    creds_file = Path(project_repo.path, 'config', 'credentials.yml')
    creds_file.unlink()
    git.checkout(project_repo)
    assert creds_file.exists()