Module: Flammarion::Revelator Private

Included in:
Engraving
Defined in:
lib/flammarion/revelator.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

TODO:

This all needs a lot of clean up

Constant Summary collapse

CHROME_PATH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

ENV["FLAMMARION_REVELATOR_PATH"] || 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'

Instance Method Summary collapse

Instance Method Details

#open_a_window(options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/flammarion/revelator.rb', line 22

def open_a_window(options = {})
  development_mode = Flammarion.development_mode?
  host_path = File.absolute_path(File.join(File.dirname(File.absolute_path(__FILE__)), "/../html/build/index.html"))
  host_path = `cygpath -w '#{host_path}'`.strip if RbConfig::CONFIG["host_os"] == "cygwin"
  host = "file://#{host_path}"
  host = "http://localhost:4567/" if development_mode

  @expect_title = options[:title] || "Flammarion"
  url = "#{host}?path=#{@window_id}&port=#{server.port}&title=#{@expect_title}"
  @browser_options = options.merge({url: url, development_mode: development_mode})
  @requested_browser = ENV["FLAMMARION_BROWSER"] || options[:browser]

  @browser = @@browsers.find do |browser|
    next if @requested_browser and browser.name.to_s != @requested_browser
    begin
      __send__(browser.name, @browser_options)
    rescue Exception
      next
    end
  end

  raise SetupError.new("You must have either electron or google-chrome installed and accesible via your path.") unless @browser
end

#wait_for_a_connectionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



47
48
49
50
51
# File 'lib/flammarion/revelator.rb', line 47

def wait_for_a_connection
   Timeout.timeout(20) { sleep 0.01 while @sockets.empty? }
 rescue Timeout::Error
   raise SetupError.new("Timed out while waiting for a connecting using #{@browser.name}.")
end