Class | Ramaze::Reloader
In: | lib/ramaze/reloader.rb lib/ramaze/reloader/watch_inotify.rb lib/ramaze/reloader/watch_stat.rb
Parent: | Object

High performant source reloader

This class acts as Rack middleware.

It does not depend on Ramaze itself, but you might have to adjust the Reloader::Hooks module or include your own module to override the hooks. You also might have to set the Log constant.

Currently, it uses RInotify if available and falls back to using File.stat.

Please note that this will not reload files in the background, it does so only when actively called In case of Ramaze it is performing a check/reload cycle at the start of every request, but also respects a cool down time, during which nothing will be done.

After every reload the OPTIONS hash will be checked for changed options and assigned to the instance, so you may change options during the lifetime of your application.

A number of hooks will be executed during the reload cycle, see Ramaze::ReloaderHooks for more information.

### Methods

call cycle figure_path new options_reload rotation safe_load

### Included Modules

Hooks

### Classes and Modules

Module Ramaze::Reloader::Hooks
Class Ramaze::Reloader::WatchInotify
Class Ramaze::Reloader::WatchStat

### Constants

OPTIONS

=

{ # At most check every n seconds # nil/false will never trigger the reload cycle # 0 will cycle on every call :cooldown => 2, # Compiled files cannot be reloaded during runtime :ignore => /\.so$/, # Run cycle in a Thread.exclusive, by default no threads are used. :thread => false, # If you assign a block here it will be instance_evaled instead of # calling cycle. This allows you to use for example EventMachine for # well performing asynchronous cycling. :control => nil, # lambda{ cycle }, }

Watcher | = | WatchInotify
Watcher | = | WatchStat

### Public Class methods

new(app)

### Public Instance methods

call(env)
cycle()
figure_path(file, paths)
options_reload()
rotation() {|path| ...}
safe_load(file)

A safe Kernel::load, issuing the hooks depending on the results

[Validate]