Class: Toiler::Utils::EnvironmentLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/toiler/utils/environment_loader.rb

Overview

Takes care of loading componentes to get toiler ready to run

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ EnvironmentLoader

Returns a new instance of EnvironmentLoader.



20
21
22
# File 'lib/toiler/utils/environment_loader.rb', line 20

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/toiler/utils/environment_loader.rb', line 10

def options
  @options
end

Class Method Details

.load(options) ⇒ Object



12
13
14
# File 'lib/toiler/utils/environment_loader.rb', line 12

def self.load(options)
  new(options).load
end

.load_for_rails_consoleObject



16
17
18
# File 'lib/toiler/utils/environment_loader.rb', line 16

def self.load_for_rails_console
  load(config_file: "#{Rails.root}configtoiler.yml")
end

Instance Method Details

#loadObject



24
25
26
27
28
29
30
31
32
# File 'lib/toiler/utils/environment_loader.rb', line 24

def load
  initialize_logger
  load_rails if options[:rails]
  require_workers if options[:require]
  Toiler.options.merge!(config_file_options)
  Toiler.options.merge!(options)
  initialize_aws
  initialize_gcp
end