Module: Ruflet::HotReload

Defined in:
lib/ruflet/hot_reload.rb

Overview

Development-time hot reload for ruflet run.

This module deliberately lives in the ruflet CLI gem: the ruby_runtime prebuilt VM compiles every file under ruflet_core/lib and ruflet_server/lib into self-contained production apps, so dev-only machinery must stay out of those gems. The framework already exposes the two hooks hot reload needs: Ruflet.with_run_interceptor to capture the app entrypoint block, and Ruflet::Server#reload_app! to repaint live sessions over their open WebSocket connections.

Defined Under Namespace

Classes: Runner

Constant Summary collapse

Error =
Class.new(StandardError)
DEFAULT_POLL_INTERVAL =
0.25
EXCLUDED_DIRECTORIES =
%w[
  .git
  .bundle
  .dart_tool
  .idea
  .ruby-lsp
  .vscode
  build
  coverage
  log
  node_modules
  pkg
  ruflet_client
  tmp
  vendor
].freeze

Class Method Summary collapse

Class Method Details

.run(script:, watch_root: nil, poll_interval: DEFAULT_POLL_INTERVAL) ⇒ Object



36
37
38
# File 'lib/ruflet/hot_reload.rb', line 36

def self.run(script:, watch_root: nil, poll_interval: DEFAULT_POLL_INTERVAL)
  Runner.new(script: script, watch_root: watch_root, poll_interval: poll_interval).run
end