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

3 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. data = {
  7. event: RailsLiveReload::INTERNAL[:socket_events][:reload],
  8. files:
  9. }.to_json
  10. LiveConstants.reload! if files.find { |change| change[0] == ENV_FILE }
  11. @sockets.each do |socket, _|
  12. socket.puts data
  13. end
  14. end
  15. end
  16. end