|
6 | 6 | import logging |
7 | 7 | import os |
8 | 8 | import re |
| 9 | +import shutil |
9 | 10 | import sys |
10 | 11 | import traceback |
11 | 12 | import requests |
@@ -270,6 +271,7 @@ def __call__(self, args: argparse.Namespace) -> None: |
270 | 271 |
|
271 | 272 | # Nice message on Ctrl+C |
272 | 273 | except KeyboardInterrupt: |
| 274 | + sc.echo("") |
273 | 275 | sc.echo("HERMES init was aborted.", sc.Formats.WARNING) |
274 | 276 | self.clean_up_files(True) |
275 | 277 | sys.exit() |
@@ -416,10 +418,13 @@ def create_ci_template(self) -> None: |
416 | 418 | template_url = self.get_template_url("TEMPLATE_hermes_github_to_zenodo.yml") |
417 | 419 | ci_file_folder = Path(".github/workflows") |
418 | 420 | ci_file_name = "hermes_github.yml" |
| 421 | + ci_file_path = ci_file_folder / ci_file_name |
| 422 | + # Adding paths to our list |
| 423 | + self.mark_as_new_path(Path(".github")) |
419 | 424 | self.mark_as_new_path(ci_file_folder) |
420 | | - ci_file_folder.mkdir(parents=True, exist_ok=True) |
421 | | - ci_file_path = Path(ci_file_folder) / ci_file_name |
422 | 425 | self.mark_as_new_path(ci_file_path) |
| 426 | + # Creating folder & ci file |
| 427 | + ci_file_folder.mkdir(parents=True, exist_ok=True) |
423 | 428 | download_file_from_url(template_url, ci_file_path) |
424 | 429 | self.configure_ci_template(ci_file_path) |
425 | 430 | sc.echo(f"GitHub CI: File was created at {ci_file_path}", formatting=sc.Formats.OKGREEN) |
@@ -723,7 +728,11 @@ def choose_push_branch(self) -> None: |
723 | 728 | ] |
724 | 729 | ) |
725 | 730 | if push_choice == 0: |
726 | | - self.ci_parameters["push_branch"] = sc.answer("Enter target branch: ") |
| 731 | + branch = sc.answer("Enter target branch: ") |
| 732 | + self.ci_parameters["push_branch"] = branch |
| 733 | + sc.echo(f"The HERMES pipeline will be activated when you push on {sc.Formats.BOLD.wrap_around(branch)}", |
| 734 | + formatting=sc.Formats.OKGREEN) |
| 735 | + sc.echo() |
727 | 736 | elif push_choice == 1: |
728 | 737 | sc.echo("Setting up triggering by tags is currently not implemented.", formatting=sc.Formats.WARNING) |
729 | 738 | sc.echo(f"You can visit {TUTORIAL_URL} to set it up manually later-on.", formatting=sc.Formats.WARNING) |
@@ -793,7 +802,10 @@ def clean_up_files(self, aborted: bool) -> None: |
793 | 802 | This gets called when init is finished (successfully or aborted). |
794 | 803 | It cleans up unwanted files (like .hermes folder) and everything new when aborted. |
795 | 804 | """ |
796 | | - os.remove(Path(".hermes")) |
| 805 | + sc.echo("Cleaning unused files...") |
| 806 | + hidden_hermes_path = Path(".hermes") |
| 807 | + if hidden_hermes_path.exists() and hidden_hermes_path.is_dir(): |
| 808 | + shutil.rmtree(hidden_hermes_path) |
797 | 809 | if aborted: |
798 | 810 | if not self.hermes_was_already_installed: |
799 | 811 | for path in reversed(self.new_created_paths): |
|
0 commit comments