Class: Merb::BootLoader::Dependencies

Inherits:
Merb::BootLoader show all
Defined in:
lib/merb-core/bootloader.rb

Class Method Summary collapse

Methods inherited from Merb::BootLoader

after, after_app_loads, before, before_app_loads, default_framework, finished?, inherited, move_klass

Class Method Details

.enable_json_gemObject



271
272
273
274
275
# File 'lib/merb-core/bootloader.rb', line 271

def self.enable_json_gem
  require "json/ext"
rescue LoadError
  require "json/pure"
end

.load_dependenciesObject



267
268
269
# File 'lib/merb-core/bootloader.rb', line 267

def self.load_dependencies
  dependencies.each { |name, ver| Kernel.load_dependency(name, *ver) }
end

.runObject

Load the init_file specified in Merb::Config or if not specified, the init.rb file from the Merb configuration directory, and any environment files, which register the list of necessary dependencies and any after_app_loads hooks.

Dependencies can hook into the bootloader process itself by using before or after insertion methods. Since these are loaded from this bootloader (Dependencies), they can only adapt the bootloaders that haven’t been loaded up until this point.



259
260
261
262
263
264
265
# File 'lib/merb-core/bootloader.rb', line 259

def self.run
  load_initfile
  load_env_config
  enable_json_gem unless Merb::disabled?(:json)
  load_dependencies
  update_logger
end

.update_loggerObject



277
278
279
280
# File 'lib/merb-core/bootloader.rb', line 277

def self.update_logger
  updated_logger_options = [ Merb.log_file, Merb::Config[:log_level], Merb::Config[:log_delimiter], Merb::Config[:log_auto_flush] ]
  Merb::BootLoader::Logger.run if updated_logger_options != Merb.logger.init_args
end