diff --git a/Project-Explainer b/Project-Explainer new file mode 160000 index 0000000..3af0213 --- /dev/null +++ b/Project-Explainer @@ -0,0 +1 @@ +Subproject commit 3af0213bf6f52afdb8e99a58fac061e87505c143 diff --git a/README.md b/README.md index c2884a7..e3a2044 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ A python module that is capable of providing different levels of summary for the #### Installation ``` -pip install git+https://github.com/c2siorg/Project-Explainer.git@main#subdirectory=project_explainer&egg=gh_explainer +pip install -r project_explainer/requirements.txt ``` #### Example usage diff --git a/project_explainer/requirements.txt b/project_explainer/requirements.txt new file mode 100644 index 0000000..7125520 --- /dev/null +++ b/project_explainer/requirements.txt @@ -0,0 +1,2 @@ +-e git+https://github.com/c2siorg/Project-Explainer.git@main#subdirectory=project_explainer&egg=gh_explainer&egg=gh_explainer +-e git+https://github.com/c2siorg/Project-Explainer.git@main#subdirectory=project_processor&egg=gh_processor \ No newline at end of file diff --git a/project_processor/gh_processor/github_downloader.py b/project_processor/gh_processor/github_downloader.py index 51ea2d7..8e460a4 100644 --- a/project_processor/gh_processor/github_downloader.py +++ b/project_processor/gh_processor/github_downloader.py @@ -25,10 +25,21 @@ def download_github_repo(repo_url: str, branch: str = "main") -> str: Returns: repo_path (str): Absolute path to downloaded repo """ + + + repo_name = repo_url.split("/")[-1].split(".")[0] repo_path = os.path.abspath(repo_name) - Repo.clone_from(repo_url, repo_name, branch=branch) + # Check if the repository directory already exists + if os.path.exists(repo_path): + logger.info(f"Repository '{repo_name}' already exists at '{repo_path}'. Skipping cloning.") + return repo_path + + else: + + Repo.clone_from(repo_url, repo_name, branch=branch) + + logger.info(f"Repository '{repo_name}' downloaded successfully! and repo path {repo_path}") + return repo_path - logger.info(f"Repository '{repo_name}' downloaded successfully!") - return repo_path