10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/opi/loader.rb', line 10
def funkyload(file)
begin
if cache = loadcache[file]
return if ENV['RACK_ENV'] == 'production'
if (mtime = File.mtime(file)) > cache
puts "[Opi::Loader]".green + " reloading: #{file}"
load file
loadcache[file] = mtime
end
else
puts "[Opi::Loader]".green + " loading: #{file}"
load file
loadcache[file] = File.mtime(file)
end
rescue Exception => e
puts "[Opi::Loader] Exception loading class [#{file}]: #{e.message}"
puts e.backtrace.join("\n")
raise e
end
end
|