Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit ec4dbe3

Browse files
fix(runner): watch current working directory for changes
1 parent 745f8d3 commit ec4dbe3

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from src.exercises import current_working_exercises
77
from src.exercises.seeker import ExerciseSeeker
88
from src.utils.version_manager import VersionManager
9-
from src.config import root_directory, dev_mode
9+
from src.config import root_directory, current_working_directory, dev_mode
1010
from src.solutions.repository import get_solution
1111

1212
version_manager = VersionManager()
@@ -29,15 +29,15 @@ def capture_solution_request(solution_path: str):
2929

3030

3131
def capture_single_exercise_check(exercise_path: Path):
32-
exercise_relative_path = exercise_path.relative_to(root_directory)
32+
exercise_relative_path = exercise_path.relative_to(current_working_directory)
3333
with sentry_sdk.push_scope() as scope:
3434
scope.set_tag("exercise_to_check", str(exercise_relative_path))
3535
sentry_sdk.capture_message("Single exercise check", level="info")
3636

3737

3838
async def cli(args):
3939
exercise_seeker = ExerciseSeeker(current_working_exercises)
40-
runner = Runner(root_directory, exercise_seeker)
40+
runner = Runner(exercise_seeker)
4141

4242
if args.version:
4343
version_manager.print_current_version()

src/runner.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from src.file_watcher.watcher import FileWatcher
1212
from src import prompt
1313
from src.exercises.seeker import ExerciseSeeker
14+
from src.config import current_working_directory
1415

1516
check_exercise_lock = Lock()
1617

@@ -37,8 +38,8 @@ def capture_exercise_solved(exercise_path: str):
3738

3839

3940
class Runner:
40-
def __init__(self, root_path: Path, exercise_seeker: ExerciseSeeker):
41-
self._file_watcher = FileWatcher(root_path)
41+
def __init__(self, exercise_seeker: ExerciseSeeker):
42+
self._file_watcher = FileWatcher(current_working_directory)
4243
self._exercise_seeker = exercise_seeker
4344

4445
def on_file_changed(self, _):

starklings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
from pathlib import Path
55
from rich.traceback import install
66
from src import cli
7-
from src.config import root_directory
7+
from src.config import current_working_directory
88

99
install(show_locals=True)
1010

1111

1212
def is_valid_file(parser, arg):
1313
file_path = Path(arg).resolve()
1414
if not file_path.exists():
15-
file_path = root_directory / arg
15+
file_path = current_working_directory / arg
1616
if not file_path.exists():
1717
return parser.error(f"The file {arg} does not exist!")
1818
return file_path

0 commit comments

Comments
 (0)