Class: TRMNLP::Commands::Serve

Inherits:
Base
  • Object
show all
Defined in:
lib/trmnlp/commands/serve.rb

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Methods inherited from Base

#initialize, options_from, run

Constructor Details

This class inherits a constructor from TRMNLP::Commands::Base

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/trmnlp/commands/serve.rb', line 13

def call
  context.validate!
  report_form_field_warnings

  # Must come AFTER parsing options
  require_relative '../app'

  # Now we can configure things
  App.set(:context, context)
  App.set(:browser_pool, BrowserPool.new(driver_factory: FirefoxDriver.method(:build)))
  App.set(:bind, options.bind)
  App.set(:port, options.port)
  # Each live-reload SSE connection holds a Puma thread for the tab's
  # lifetime; the default 0:5 pool runs out fast with multiple tabs open.
  App.set(:server_settings, Threads: '1:16')
  permit_all_hosts if codespaces?

  # Finally, start the app!
  App.run!
end