X7ROOT File Manager
Current Path:
/opt/alt/ruby18/lib64/ruby/gems/1.8/gems/rack-1.6.1/lib/rack
opt
/
alt
/
ruby18
/
lib64
/
ruby
/
gems
/
1.8
/
gems
/
rack-1.6.1
/
lib
/
rack
/
??
..
??
auth
??
backports
??
body_proxy.rb
(958 B)
??
builder.rb
(4.27 KB)
??
cascade.rb
(1.34 KB)
??
chunked.rb
(1.58 KB)
??
commonlogger.rb
(2.28 KB)
??
conditionalget.rb
(2.5 KB)
??
config.rb
(379 B)
??
content_length.rb
(840 B)
??
content_type.rb
(670 B)
??
deflater.rb
(4.57 KB)
??
directory.rb
(4.2 KB)
??
etag.rb
(2.11 KB)
??
file.rb
(4.09 KB)
??
handler
??
handler.rb
(3.24 KB)
??
head.rb
(484 B)
??
lint.rb
(29.26 KB)
??
lobster.rb
(1.97 KB)
??
lock.rb
(601 B)
??
logger.rb
(357 B)
??
methodoverride.rb
(972 B)
??
mime.rb
(30.89 KB)
??
mock.rb
(5.68 KB)
??
multipart
??
multipart.rb
(1.14 KB)
??
nulllogger.rb
(951 B)
??
recursive.rb
(1.73 KB)
??
reloader.rb
(2.97 KB)
??
request.rb
(12.45 KB)
??
response.rb
(4.33 KB)
??
rewindable_input.rb
(3.19 KB)
??
runtime.rb
(961 B)
??
sendfile.rb
(5.18 KB)
??
server.rb
(10.8 KB)
??
session
??
showexceptions.rb
(11.7 KB)
??
showstatus.rb
(3.46 KB)
??
static.rb
(4.87 KB)
??
tempfile_reaper.rb
(670 B)
??
urlmap.rb
(2.46 KB)
??
utils
??
utils.rb
(20.55 KB)
Editing: reloader.rb
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com # Rack::Reloader is subject to the terms of an MIT-style license. # See COPYING or http://www.opensource.org/licenses/mit-license.php. require 'pathname' module Rack # High performant source reloader # # This class acts as Rack middleware. # # What makes it especially suited for use in a production environment is that # any file will only be checked once and there will only be made one system # call stat(2). # # Please note that this will not reload files in the background, it does so # only when actively called. # # 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. class Reloader def initialize(app, cooldown = 10, backend = Stat) @app = app @cooldown = cooldown @last = (Time.now - cooldown) @cache = {} @mtimes = {} extend backend end def call(env) if @cooldown and Time.now > @last + @cooldown if Thread.list.size > 1 Thread.exclusive{ reload! } else reload! end @last = Time.now end @app.call(env) end def reload!(stderr = $stderr) rotation do |file, mtime| previous_mtime = @mtimes[file] ||= mtime safe_load(file, mtime, stderr) if mtime > previous_mtime end end # A safe Kernel::load, issuing the hooks depending on the results def safe_load(file, mtime, stderr = $stderr) load(file) stderr.puts "#{self.class}: reloaded `#{file}'" file rescue LoadError, SyntaxError => ex stderr.puts ex ensure @mtimes[file] = mtime end module Stat def rotation files = [$0, *$LOADED_FEATURES].uniq paths = ['./', *$LOAD_PATH].uniq files.map{|file| next if file =~ /\.(so|bundle)$/ # cannot reload compiled files found, stat = figure_path(file, paths) next unless found && stat && mtime = stat.mtime @cache[file] = found yield(found, mtime) }.compact end # Takes a relative or absolute +file+ name, a couple possible +paths+ that # the +file+ might reside in. Returns the full path and File::Stat for the # path. def figure_path(file, paths) found = @cache[file] found = file if !found and Pathname.new(file).absolute? found, stat = safe_stat(found) return found, stat if found paths.find do |possible_path| path = ::File.join(possible_path, file) found, stat = safe_stat(path) return ::File.expand_path(found), stat if found end return false, false end def safe_stat(file) return unless file stat = ::File.stat(file) return file, stat if stat.file? rescue Errno::ENOENT, Errno::ENOTDIR, Errno::ESRCH @cache.delete(file) and false end end end end
Upload File
Create Folder