File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 1212from pathlib import Path
1313from typing import TYPE_CHECKING
1414
15+ from .service import Service
1516from .syntax import GroovySyntax , PythonSyntax
1617from .util .filepath import find_exe
17- from .service import Service
1818
1919if TYPE_CHECKING :
2020 from .builder import Builder
@@ -84,6 +84,31 @@ def type(self) -> str:
8484 builder = self .builder ()
8585 return builder .env_type () if builder else "unknown"
8686
87+ def rebuild (self ) -> Environment :
88+ """
89+ Rebuilds this environment from scratch.
90+ This deletes the existing environment directory and rebuilds it using the
91+ current builder configuration.
92+
93+ Returns:
94+ The newly rebuilt environment.
95+ Raises:
96+ BuildException: If something goes wrong during rebuild.
97+ """
98+ return self .builder ().rebuild ()
99+
100+ def delete (self ) -> Environment :
101+ """
102+ Deletes the existing environment directory, if any.
103+
104+ Returns:
105+ This environment, for fluid chaining.
106+ Raises:
107+ OSError: If something goes wrong during deletion.
108+ """
109+ self .builder ().delete ()
110+ return self
111+
87112 def python (self ) -> Service :
88113 """
89114 Create a Python script service.
You can’t perform that action at this time.
0 commit comments