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



283
284
285
286
287
288
289
# File 'lib/merb-core/bootloader.rb', line 283

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

.load_dependenciesObject



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

def self.load_dependencies
  dependencies.each { |dependency| Kernel.load_dependency(dependency) }
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.



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

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

.set_encodingObject



296
297
298
# File 'lib/merb-core/bootloader.rb', line 296

def self.set_encoding
  $KCODE = 'UTF8' if $KCODE == 'NONE' || $KCODE.blank?
end

.update_loggerObject



291
292
293
294
# File 'lib/merb-core/bootloader.rb', line 291

def self.update_logger
  # Clear out the logger so that any changes in init.rb will be picked up
  Merb.logger = nil
end