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

return unless Rails.application.server? || Rails.application.console?
def grant(patch)
case patch
when 'action_dispatch/middleware/debug_exceptions.rb' then Rails.application.server?
when 'rails_live_reload/watcher.rb' then Rails.application.server? && Rails.env.development?
when /^semantic/ then true
end
end
patches = Dir.glob(Rails.root.join('lib', 'monkey_patches', '**', '*.rb'))
patches.each do |file|
patch = Pathname.new(file).relative_path_from(Rails.root.join('lib', 'monkey_patches')).to_s
next unless grant patch
puts "🐵 patching... #{patch}"
require file
end