Class: Djin::Interpreter
- Inherits:
-
Object
- Object
- Djin::Interpreter
- Defined in:
- lib/djin/interpreter.rb,
lib/djin/interpreter/base_command_builder.rb,
lib/djin/interpreter/local_command_builder.rb,
lib/djin/interpreter/docker_command_builder.rb,
lib/djin/interpreter/docker_compose_command_builder.rb
Overview
TODO: Refactor to TaskConfigLoader and make COnfigLoader to use this class
Defined Under Namespace
Classes: BaseCommandBuilder, DockerCommandBuilder, DockerComposeCommandBuilder, LocalCommandBuilder
Class Method Summary collapse
-
.load!(file_config) ⇒ Object
rubocop:disable Metrics/AbcSize.
Class Method Details
.load!(file_config) ⇒ Object
rubocop:disable Metrics/AbcSize
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/djin/interpreter.rb', line 10 def load!(file_config) # TODO: Move task validation to ConfigLoader and add variables/include validations task_contract = TaskContract.new file_config.tasks.map do |task_name, | result = task_contract.call() raise InvalidSyntaxError, { task_name.to_sym => result.errors.to_h } if result.failure? command, build_command = build_commands(, task_name: task_name) # FIXME(1): Handle dynamic named tasks, eg: {{namespace}}unit and remove condition if file_config.raw_tasks[task_name] raw_command, = build_commands(file_config.raw_tasks[task_name], task_name: task_name) end task_params = { name: task_name, build_command: build_command, # TODO: Remove `|| command` after FIXME(1) description: ['description'] || "Runs: #{raw_command || command}", command: command, raw_command: raw_command, aliases: ['aliases'], depends_on: ['depends_on'] }.compact Djin::Task.new(**task_params) end end |