lib/rack/unreloader/reloader.rb
# Require the given dependencies, monitoring them for changes.
# Paths should be a file glob or an array of file globs.
Require the given dependencies, monitoring them for changes.
Paths should be a file glob or an array of file globs.
Require the given dependencies monitoring them for changes . Paths should be a file glob or an array of file globs .
def require_dependencies(paths, opts={}, &block)
        options = {:cyclic => true}
        delete_hook = opts[:delete_hook]
        error = nil 
        Unreloader.expand_paths(paths).each do |file|
          if File.directory?(file)
            @monitor_dirs[file] = [nil, [], block, delete_hook]
            check_monitor_dir(file)
            next
          else
            @constants_defined[file] = block
            @monitor_files[file] = [nil, delete_hook]
          end
          begin
            safe_load(file, options)
          rescue NameError, LoadError => error
            log "Cyclic dependency reload for #{error}"
          rescue Exception => error
            break
          end
        end
        if error
          log error
          raise error
        end
      end
def require_dependencies ( paths , opts = { } , & block ) options = { :cyclic => true } delete_hook = opts [ :delete_hook ] error = nil Unreloader . expand_paths ( paths ) . each do | file | if File . directory? ( file ) @monitor_dirs [ file ] = [ nil , [ ] , block , delete_hook ] check_monitor_dir ( file ) next else @constants_defined [ file ] = block @monitor_files [ file ] = [ nil , delete_hook ] end begin safe_load ( file , options ) rescue NameError , LoadError => error log "Cyclic dependency reload for #{error}" rescue Exception => error break end end if error log error raise error end end
Require the given dependencies, monitoring them for changes.
Require the given dependencies monitoring them for changes .
paths
opts
block