mirror of
https://github.com/karma-riuk/crab-webapp.git
synced 2025-07-05 06:08:13 +02:00
delegated the injection of the changes to the
build handler (so that the WaitBuildHandler can just no do anything)
This commit is contained in:
@ -156,6 +156,17 @@ class BuildHandler(ABC):
|
|||||||
def clean_repo(self) -> None:
|
def clean_repo(self) -> None:
|
||||||
self.container.exec_run(self.clean_cmd())
|
self.container.exec_run(self.clean_cmd())
|
||||||
|
|
||||||
|
def inject_changes(self, changes: dict[str, str]):
|
||||||
|
for file_path, change in changes.items():
|
||||||
|
full_path = os.path.join(self.path, file_path)
|
||||||
|
print(f"[INFO] Writing change to {full_path}")
|
||||||
|
dirname = os.path.dirname(full_path)
|
||||||
|
if not os.path.exists(dirname):
|
||||||
|
print(f"[INFO] Creating directory {dirname}")
|
||||||
|
os.makedirs(dirname)
|
||||||
|
with open(full_path, "w") as f:
|
||||||
|
f.write(change)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_type(self) -> str:
|
def get_type(self) -> str:
|
||||||
pass
|
pass
|
||||||
|
@ -63,15 +63,7 @@ def evaluate_refinement(answers: dict[str, dict[str, str]], percent_cb):
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for file_path, change in changes.items():
|
build_handler.inject_changes(changes)
|
||||||
full_path = os.path.join(build_handler.path, file_path)
|
|
||||||
print("[INFO] Writing change to file:", full_path)
|
|
||||||
dirname = os.path.dirname(full_path)
|
|
||||||
if not os.path.exists(dirname):
|
|
||||||
print("[INFO] Creating directory:", dirname)
|
|
||||||
os.makedirs(dirname)
|
|
||||||
with open(full_path, "w") as f:
|
|
||||||
f.write(change)
|
|
||||||
current_progress += 1
|
current_progress += 1
|
||||||
percent_cb(current_progress / total_number_of_steps * 100)
|
percent_cb(current_progress / total_number_of_steps * 100)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user