Method: ConsoleExtensions#reload_lib
- Defined in:
- lib/fertilizer/console_extensions.rb
#reload_lib ⇒ Object
Reload lib configuration from console
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fertilizer/console_extensions.rb', line 9 def reload_lib path = File.join( Rails.root, 'lib') failures = [] Dir.glob("#{path}/**/*.rb").each { |file| puts "loading: #{file.inspect} ... " begin if !(file.include? 'reload.rb') load file end rescue => ex failures << file end } # this second pass is here to try to catch anything that # is dependent on something else # could be improved, but is working fine for my needs double_failures = [] for file in failures begin # don't reload yourself if !(file.include? 'reload.rb') load file end rescue => ex1 double_failures << file end end if double_failures.size > 0 puts "these files failed twice" for file in double_failures puts file end end end |