Class: Lilac::CLI::Subcommand::Dev

Inherits:
Base
  • Object
show all
Defined in:
lib/lilac/cli/subcommand/dev.rb

Instance Method Summary collapse

Methods inherited from Base

help_text, #initialize

Constructor Details

This class inherits a constructor from Lilac::CLI::Subcommand::Base

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/lilac/cli/subcommand/dev.rb', line 11

def run
  opts = parse_opts

  # `--target` for `lilac dev` controls the watch-rebuild path.
  # Defaults to `c.dev_target` (Config DEFAULT is `:full`) — the
  # `:compiled` path will fire `mrbc` on every change once the
  # DevServer wiring lands (Phase 2 of the proposals.md entry).
  config = Config.load(
    root: opts[:root],
    components_dir: opts[:components],
    pages_dir: opts[:pages],
    output_dir: opts[:output],
    public_dir: opts[:public],
    dev_host: opts[:host],
    dev_port: opts[:port],
    dev_target: opts[:target],
    mrbc_path: opts[:mrbc_path],
    lilac_compiled_path: opts[:lilac_compiled_path],
    lilac_full_path: opts[:lilac_full_path],
    mruby_wasm_js_path: opts[:mruby_wasm_js_path],
  )

  DevServer.new(
    config,
    host: config.dev_host,
    port: config.dev_port,
    out: @out,
    err: @err,
  ).start
  0
end