You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
597 B

  1. return unless Rails.application.server? || Rails.application.console?
  2. def grant(patch)
  3. case patch
  4. when 'action_dispatch/middleware/debug_exceptions.rb' then Rails.application.server?
  5. when 'rails_live_reload/watcher.rb' then Rails.application.server? && Rails.env.development?
  6. when /^semantic/ then true
  7. end
  8. end
  9. patches = Dir.glob(Rails.root.join('lib', 'monkey_patches', '**', '*.rb'))
  10. patches.each do |file|
  11. patch = Pathname.new(file).relative_path_from(Rails.root.join('lib', 'monkey_patches')).to_s
  12. next unless grant patch
  13. puts "🐵 patching... #{patch}"
  14. require file
  15. end