|
|
@ -3,16 +3,15 @@ module RailsLiveReload |
|
|
|
class Watcher |
|
|
|
ENV_FILE = Rails.root.join('.env').to_s |
|
|
|
def reload_all |
|
|
|
data = { |
|
|
|
event: RailsLiveReload::INTERNAL[:socket_events][:reload], |
|
|
|
files: |
|
|
|
}.to_json |
|
|
|
before_reload(files) |
|
|
|
data = { event: RailsLiveReload::INTERNAL[:socket_events][:reload], files: }.to_json |
|
|
|
@sockets.each { |socket, _| socket.puts data } # rubocop:disable Style/HashEachMethods |
|
|
|
end |
|
|
|
|
|
|
|
LiveConstants.reload! if files.find { |change| change[0] == ENV_FILE } |
|
|
|
private |
|
|
|
|
|
|
|
@sockets.each do |socket, _| |
|
|
|
socket.puts data |
|
|
|
end |
|
|
|
def before_reload(files) |
|
|
|
LiveConstants.reload! if files.find { |change| change[0] == ENV_FILE } |
|
|
|
end |
|
|
|
end |
|
|
|
end |