| Total Complexity | 7 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 86.36% |
| Changes | 0 | ||
| 1 | 1 | from cleo.helpers import argument |
|
| 2 | |||
| 3 | from pystratum_cli.command.BaseCommand import BaseCommand |
||
| 4 | 1 | ||
| 5 | |||
| 6 | class StratumCommand(BaseCommand): |
||
| 7 | """ |
||
| 8 | The stratum command: combination of constants, loader, and wrapper commands. |
||
| 9 | """ |
||
| 10 | name = 'stratum' |
||
| 11 | description = 'Generates constants based on database IDs.' |
||
| 12 | arguments = [argument(name='config_file', description='The stratum configuration file.')] |
||
| 13 | 1 | ||
| 14 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 15 | def handle(self) -> int: |
||
| 16 | """ |
||
| 17 | 1 | Executes constants command when StratumCommand is activated. |
|
| 18 | """ |
||
| 19 | 1 | self._read_config_file() |
|
| 20 | |||
| 21 | 1 | factory = self._create_backend_factory() |
|
| 22 | 1 | ||
| 23 | 1 | worker = factory.create_constant_worker(self._config, self._io) |
|
| 24 | if worker: |
||
| 25 | 1 | ret = worker.execute() |
|
| 26 | |||
| 27 | if ret != 0: |
||
| 28 | 1 | return ret |
|
| 29 | 1 | ||
| 30 | 1 | worker = factory.create_routine_loader_worker(self._config, self._io) |
|
| 31 | if worker: |
||
| 32 | 1 | ret = worker.execute() |
|
| 33 | |||
| 34 | if ret != 0: |
||
| 35 | 1 | return ret |
|
| 36 | 1 | ||
| 37 | 1 | worker = factory.create_routine_wrapper_generator_worker(self._config, self._io) |
|
| 38 | if worker: |
||
| 39 | 1 | ret = worker.execute() |
|
| 40 | |||
| 41 | if ret != 0: |
||
| 42 | 1 | return ret |
|
| 43 | |||
| 44 | 1 | self._io.write('') |
|
| 45 | |||
| 46 | return 0 |
||
| 47 | |||
| 49 |