Method: Roby::Application#load_base_config

Defined in:
lib/roby/app.rb

#load_base_configObject

Loads the base configuration

This method loads the two most basic configuration files:

* config/app.yml
* config/init.rb

It also calls the plugin’s ‘load’ method



976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
# File 'lib/roby/app.rb', line 976

def load_base_config
    load_config_yaml
    setup_loggers(ignore_missing: true, redirections: false)

    setup_robot_names_from_config_dir

    # Get the application-wide configuration
    if plugins_enabled?
        register_plugins
    end

    update_load_path

    if (initfile = find_file("config", "init.rb", order: :specific_first))
        Application.info "loading init file #{initfile}"
        Kernel.require initfile
    end

    update_load_path

    # Deprecated hook
    call_plugins(:load, self, deprecated: "define 'load_base_config' instead")
    call_plugins(:load_base_config, self)

    update_load_path

    if defined? Roby::Conf
        Roby::Conf.datadirs = find_dirs("data", "ROBOT", all: true, order: :specific_first)
    end

    if has_app?
        require_robot_file
    end

    init_handlers.each(&:call)
    update_load_path

    # Define the app module if there is none, and define a root logger
    # on it
    app_module =
        begin self.app_module
        rescue NameError
            Object.const_set(module_name, Module.new)
        end
    unless app_module.respond_to?(:logger)
        module_name = self.module_name
        app_module.class_eval do
            extend ::Logger::Root(module_name, Logger::INFO)
        end
    end
end