Browse Source

monkey_patcher

pagy
pvincent 8 months ago
parent
commit
9116babd08
  1. 15
      config/initializers/monkey_patcher.rb

15
config/initializers/monkey_patcher.rb

@ -1,15 +1,14 @@
return unless defined?(Rails::Server)
logger = SemanticLogger['MonkeyPatcher']
puts '🐵 MonkeyPatcher runs:'
patches = Dir.glob(Rails.root.join('lib', 'monkey_patches', '**', '*.rb'))
patches.each do |file|
logger.info "patching... #{Pathname.new(file).relative_path_from Rails.root}"
puts " patching... #{Pathname.new(file).relative_path_from Rails.root}"
require file
end
case patches.count
when 0 then logger.info '== No patch found =='
when 1 then logger.info '== 1 successful patch applied =='
else logger.info "== #{count} successful patch applied =="
end
puts "📌 "+ case patches.count
when 0 then 'No patch found'
when 1 then '1 successful patch applied'
else "#{count} successful patch applied"
end
Loading…
Cancel
Save