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
17 lines
482 B
module RailsLiveReload
|
|
# MonkeyPath Watcher
|
|
class Watcher
|
|
ENV_FILE = Rails.root.join('.env').to_s
|
|
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
|
|
|
|
def before_reload(files)
|
|
LiveConstants.reload! if files.find { |change| change[0] == ENV_FILE }
|
|
end
|
|
end
|
|
end
|