Class: Ocak::Commands::Run

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/ocak/commands/run.rb

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ocak/commands/run.rb', line 23

def call(**options)
  config = Config.load

  # CLI options override config
  config.override(:max_parallel, options[:max_parallel]) if options[:max_parallel]
  config.override(:poll_interval, options[:poll_interval]) if options[:poll_interval]

  runner = PipelineRunner.new(
    config: config,
    options: {
      watch: options[:watch],
      single: options[:single],
      dry_run: options[:dry_run],
      once: options[:once]
    }
  )

  setup_signal_handlers(runner)
  runner.run
rescue Config::ConfigNotFound => e
  warn "Error: #{e.message}"
  exit 1
end