Module: Climatic::Initializer

Includes:
Utils::ScriptHelper
Included in:
Climatic
Defined in:
lib/climatic/initializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::ScriptHelper

#display_exit_error

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/climatic/initializer.rb', line 7

def config
  @config
end

Instance Method Details

#bootstrap(cmd_line_args: ARGV.dup, command_manager: Climatic::ConfigLayers::CommandLineLayer.default_command_line_manager) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/climatic/initializer.rb', line 9

def bootstrap(cmd_line_args: ARGV.dup,
              command_manager: Climatic::ConfigLayers::CommandLineLayer.default_command_line_manager)
  raise Climatic::Error, 'You cannot bootstrap Climatic framework twice !' if climatic_bootstrapped?
  @climatic_status = :bootstrapping
  setup_initial_logger
  Climatic.logger.debug 'Starting Climatic framework setup...'
  # Get the config first to correctly setup the definitive logger
  setup_config_manager cmd_line_args, command_manager
  # Now we can setup the definitive logger
  setup_logger
  Climatic.logger.debug 'Climatic framework setup complete.'
  @climatic_status = :bootstrapped
rescue Slop::UnknownOption
  Climatic.logger.debug 'Climatic initialization failed (wrong command line options) !'
end

#climatic_bootstrapped?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/climatic/initializer.rb', line 29

def climatic_bootstrapped?
  @climatic_status == :bootstrapped
end

#climatic_bootstrapping?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/climatic/initializer.rb', line 25

def climatic_bootstrapping?
  @climatic_status == :bootstrapping
end