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.

17 lines
482 B

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