class

Inquirer::Daemon

Inherits Reference < Object

Constants

IGNORES = "node_modules"

Which directories should not be searched in.

MAX_WATCHES = (File.read("/proc/sys/fs/inotify/max_user_watches")).to_i

Maximum amount of watches that this system allows.

Constructors

new(root : String)

Makes a Daemon and prepares it for starting.

Daemon will listen for Ven-specific changes in origin, as well as all of its subdirectories, subdirectories of that etc. Depth (amount of nesting) is arbitrary (but see watchables).

Source

Instance methods

handle(event : Inotify::Event)

Handles a change in any of the watchables.

Returns nothing.

Source
start(port = 3000, detach = false)

Starts this daemon.

Detaches (daemonizes) if detach is true.

port is the port on which the API server (Inquirer::Server will run).

All control except intercepting the changes in watchables is transferred to Kemal.

Returns nothing.

Source
stop(wait : Time::Span = nil)

Gracefully (in theory) stops this daemon.

Should unregister all inotify watchers and stop the server.

Curiously, this suicides the Server, so it won't say 'farewell!'. It can delay the death using wait, though.

Source
watchables

Returns a list of watchable directories.

Directories that are not watchable:

  • Those whose name is prefixed with an underscore;
  • Those that are symlinks;
  • Those that are hidden;
  • Those that are in IGNORES.

Depth (amount of nesting) is arbitrary. Searches through everything, so may take a long time.

Source