lib/rack/unreloader/reloader.rb
# Check a monitored directory for changes, adding new files and removing
# deleted files.
Check a monitored directory for changes, adding new files and removing
deleted files.
Check a monitored directory for changes adding new files and removing deleted files .
def check_monitor_dir(dir, changed_files=nil)
        subdir_times, files, block, delete_hook = md = @monitor_dirs[dir]
        return if subdir_times && subdir_times.all?{|subdir, time| File.directory?(subdir) && modified_at(subdir) == time}
        md[0] = subdir_times(dir)
        cur_files = Unreloader.ruby_files(dir)
        return if files == cur_files
        removed_files = files - cur_files
        new_files = cur_files - files
        if changed_files
          changed_files.concat(dependency_files(removed_files))
        end
        remove_files(removed_files)
        if delete_hook
          removed_files.each{|f| delete_hook.call(f)}
        end
        require_dependencies(new_files, :delete_hook=>delete_hook, &block)
        new_files.each do |file|
          if deps = @dependencies[dir]
            record_dependency(file, deps)
          end
        end
        if changed_files
          changed_files.concat(dependency_files(new_files))
        end
        files.replace(cur_files)
      end
def check_monitor_dir ( dir , changed_files = nil ) subdir_times , files , block , delete_hook = md = @monitor_dirs [ dir ] return if subdir_times && subdir_times . all? { | subdir , time | File . directory? ( subdir ) && modified_at ( subdir ) == time } md [ 0 ] = subdir_times ( dir ) cur_files = Unreloader . ruby_files ( dir ) return if files == cur_files removed_files = files - cur_files new_files = cur_files - files if changed_files changed_files . concat ( dependency_files ( removed_files ) ) end remove_files ( removed_files ) if delete_hook removed_files . each { | f | delete_hook . call ( f ) } end require_dependencies ( new_files , :delete_hook => delete_hook , & block ) new_files . each do | file | if deps = @dependencies [ dir ] record_dependency ( file , deps ) end end if changed_files changed_files . concat ( dependency_files ( new_files ) ) end files . replace ( cur_files ) end
Check a monitored directory for changes, adding new files and removing
deleted files.
Check a monitored directory for changes adding new files and removing deleted files .
dir
changed_files