Class: SnapshotUI::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/snapshot_ui/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/snapshot_ui/cli.rb', line 25

def self.exit_on_failure?
  true
end

Instance Method Details

#live(initializer_file) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/snapshot_ui/cli.rb', line 9

def live(initializer_file)
  unless File.exist?(initializer_file)
    puts "The provided initializer file `#{initializer_file}` doesn't exist. Please double check the path."
    exit 1
  end

  load initializer_file

  websocket_host_uri = URI.parse(SnapshotUI.configuration.live_websocket_url)
  websocket_host_uri.path = ""

  config_path = Pathname.new(__dir__).join("cli", "watcher.ru").cleanpath.to_s

  exec "SNAPSHOT_UI_INITIALIZER_FILE=#{initializer_file} bundle exec falcon serve --bind #{websocket_host_uri} --count 1 --config #{config_path}"
end