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
18 lines
482 B
module RailsLiveReload
|
|
# MonkeyPath Watcher
|
|
class Watcher
|
|
def reload_all
|
|
before_reload(files)
|
|
data = { event: RailsLiveReload::INTERNAL[:socket_events][:reload], files: }.to_json
|
|
@sockets.each { |socket, _| socket.puts data } # rubocop:disable Style/HashEachMethods
|
|
end
|
|
|
|
private
|
|
|
|
ENV_FILE = Rails.root.join('.env').to_s
|
|
|
|
def before_reload(files)
|
|
HotConstants.reload! if files.find { |change| change[0] == ENV_FILE }
|
|
end
|
|
end
|
|
end
|