Class: Merb::BootLoader::ReloadClasses

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

Defined Under Namespace

Classes: TimedExecutor

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

.reloadObject

Reloads all files.



683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
# File 'lib/merb-core/bootloader.rb', line 683

def self.reload
  paths = []
  Merb.load_paths.each do |path_name, file_info|
    path, glob = file_info
    next unless glob
    paths << Dir[path / glob]
  end

  paths << Merb.dir_for(:application) if Merb.dir_for(:application) && File.file?(Merb.dir_for(:application))

  paths.flatten.each do |file|
    next if Merb::BootLoader::LoadClasses::MTIMES[file] && Merb::BootLoader::LoadClasses::MTIMES[file] == File.mtime(file)
    Merb::BootLoader::LoadClasses.reload(file)
  end
end

.runObject

Setup the class reloader if it’s been specified in config.



673
674
675
676
677
678
679
680
# File 'lib/merb-core/bootloader.rb', line 673

def self.run
  return unless Merb::Config[:reload_classes]

  TimedExecutor.every(Merb::Config[:reload_time] || 0.5) do
    reload
  end
  
end