Class: Exekutor::Internal::CLI::Manager::DefaultConfigFileValue

Inherits:
DefaultOptionValue show all
Defined in:
lib/exekutor/internal/cli/manager.rb

Overview

The default value for the config file

Instance Method Summary collapse

Methods inherited from DefaultOptionValue

#to_s, #value

Constructor Details

#initializeDefaultConfigFileValue

Returns a new instance of DefaultConfigFileValue.



323
324
325
326
327
# File 'lib/exekutor/internal/cli/manager.rb', line 323

def initialize
  super(<<~DESC)
    "config/exekutor.yml", overridden by "config/exekutor.%{identifier}.yml" if an identifier is specified
  DESC
end

Instance Method Details

#to_a(identifier = nil) ⇒ Array<String>

Returns the paths to the configfiles to load.

Parameters:

  • identifier (nil, String) (defaults to: nil)

    the worker identifier

Returns:

  • (Array<String>)

    the paths to the configfiles to load



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/exekutor/internal/cli/manager.rb', line 331

def to_a(identifier = nil)
  files = []
  %w[config/exekutor.yml config/exekutor.yaml].each do |path|
    path = Rails.root.join(path)
    if File.exist? path
      files.append path
      break
    end
  end
  if identifier.present?
    %W[config/exekutor.#{identifier}.yml config/exekutor.#{identifier}.yaml].each do |path|
      path = Rails.root.join(path)
      if File.exist? path
        files.append path
        break
      end
    end
  end
  files
end