Skip to content

Instantly share code, notes, and snippets.

@Paxa
Created August 10, 2010 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Paxa/517249 to your computer and use it in GitHub Desktop.
Save Paxa/517249 to your computer and use it in GitHub Desktop.
...
# including fix manualy, becouse loading lib/**/*.rb happends in Padrino.load!
require "lib/reloader_fix"
Padrino::Reloader::Stat.skip_folders = %W{photos utilites vertex-lib importers}
Padrino.load!
module Padrino
module Reloader
module Stat
class << self
# this fix skips [public log tmp] folders and allow to skip folders what you pass in
# Padrino::Reloader::Stat.skip_folders = [folders]
# this line
attr_accessor :skip_folders
def rotation
paths = Dir[Padrino.root("*")].unshift(Padrino.root).reject { |path| !File.directory?(path) }
# and this 2 lines
@skip_folders = Array(@skip_folders) | %W{public log tmp}
paths -= @skip_folders.map {|folder| Padrino.root(folder) }
files = paths.map { |path| Dir["#{path}/**/*.rb"] }.flatten
files.map{ |file|
next if Padrino::Reloader.exclude.any? { |base| file =~ /^#{base}/ }
found, stat = figure_path(file, paths)
next unless found && stat && mtime = stat.mtime
CACHE[file] = found
yield(found, mtime)
}.compact
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment