Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
hubboss / boss / git_utils.py
Size: Mime:
import os
import shutil

from git import Repo

from config import get_build_dir


def clone_repo(git_url):
    print("Cloning repo: {}".format(git_url))
    # git@github.com:docker/docker-index.git
    repo_dir = git_url.replace(".git", "").split("/")[1]
    build_dir = get_build_dir()
    repo_dir = os.path.join(build_dir, repo_dir)
    if os.path.isdir(repo_dir):
        shutil.rmtree(repo_dir)
        os.makedirs(repo_dir)
    return Repo.clone_from(git_url, repo_dir)


def get_tag(repo, tag):
    tag = "refs/tags/v{}".format(tag)
    print("Checking out tag: {}".format(tag))
    return repo.tag(tag)