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
482 B

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. module RailsLiveReload
  2. # MonkeyPath Watcher
  3. class Watcher
  4. def reload_all
  5. before_reload(files)
  6. data = { event: RailsLiveReload::INTERNAL[:socket_events][:reload], files: }.to_json
  7. @sockets.each { |socket, _| socket.puts data } # rubocop:disable Style/HashEachMethods
  8. end
  9. private
  10. ENV_FILE = Rails.root.join('.env').to_s
  11. def before_reload(files)
  12. HotConstants.reload! if files.find { |change| change[0] == ENV_FILE }
  13. end
  14. end
  15. end