flammarion 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/flammarion/revelator.rb
CHANGED
@@ -70,6 +70,13 @@ module Flammarion
|
|
70
70
|
Process.detach(spawn(chrome_path, %[--app=#{resource}?path=#{@window_id}&port=#{server.port}&title="#{options[:title] || "Flammarion%20Engraving"}"]))
|
71
71
|
end
|
72
72
|
|
73
|
+
browser :osx do |options|
|
74
|
+
return false unless RbConfig::CONFIG["host_os"] =~ /darwin|mac os/
|
75
|
+
executable = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
76
|
+
@chrome.in, @chrome.out, @chrome.err, @chrome.thread = Open3.popen3("'#{executable}' --app='#{options[:url]}'")
|
77
|
+
return true if @chrome.in
|
78
|
+
end
|
79
|
+
|
73
80
|
browser :electron do |options|
|
74
81
|
if which('electron') then
|
75
82
|
Process.detach(spawn("electron #{File.dirname(File.absolute_path(__FILE__))}/../../electron '#{options[:url]}' #{options[:width]} #{options[:height]}"))
|
data/lib/flammarion/server.rb
CHANGED
@@ -1,30 +1,22 @@
|
|
1
1
|
module Flammarion
|
2
2
|
# @api private
|
3
3
|
class Server
|
4
|
-
attr_reader :port
|
4
|
+
attr_reader :port, :server_thread
|
5
5
|
def initialize
|
6
6
|
@windows = {}
|
7
7
|
@socket_paths = {}
|
8
8
|
@started = false
|
9
|
-
Thread.
|
9
|
+
@launch_thread = Thread.current
|
10
|
+
@server_thread = Thread.new do
|
10
11
|
begin
|
11
12
|
start_server_internal
|
12
|
-
rescue
|
13
|
-
|
14
|
-
rescue Exception => e
|
15
|
-
if binding.respond_to? :pry
|
16
|
-
binding.pry
|
17
|
-
else
|
18
|
-
raise
|
19
|
-
end
|
13
|
+
rescue StandardError
|
14
|
+
handle_exception($!)
|
20
15
|
end
|
21
16
|
end
|
22
17
|
sleep 0.5 while not @started
|
23
|
-
|
24
|
-
# This is a hack. For some reason, you need to wait a bit for everything
|
25
|
-
# to get written.
|
26
|
-
at_exit { sleep 0.1 }
|
27
18
|
end
|
19
|
+
|
28
20
|
def start_server_internal
|
29
21
|
@port = 7870
|
30
22
|
@port = rand(65000 - 1024) + 1024 if Gem.win_platform?
|
@@ -53,13 +45,8 @@ module Flammarion
|
|
53
45
|
Thread.new do
|
54
46
|
begin
|
55
47
|
@windows[@socket_paths[ws]].process_message(msg)
|
56
|
-
rescue
|
57
|
-
|
58
|
-
if binding.respond_to? :pry
|
59
|
-
binding.pry
|
60
|
-
else
|
61
|
-
raise
|
62
|
-
end
|
48
|
+
rescue StandardError => e
|
49
|
+
handle_exception($!)
|
63
50
|
end
|
64
51
|
end
|
65
52
|
}
|
@@ -74,14 +61,6 @@ module Flammarion
|
|
74
61
|
end
|
75
62
|
end
|
76
63
|
@started = true
|
77
|
-
rescue Exception => e
|
78
|
-
unless e.is_a? SystemExit or e.is_a? Interrupt
|
79
|
-
Kernel.puts "Error in server:"
|
80
|
-
binding.pry if binding.respond_to? :pry
|
81
|
-
Kernel.puts e.message
|
82
|
-
Kernel.puts e.backtrace.inspect
|
83
|
-
end
|
84
|
-
raise
|
85
64
|
end
|
86
65
|
|
87
66
|
def stop
|
@@ -91,6 +70,10 @@ module Flammarion
|
|
91
70
|
# Kernel.puts str
|
92
71
|
end
|
93
72
|
|
73
|
+
def handle_exception(e)
|
74
|
+
@launch_thread.raise(e)
|
75
|
+
end
|
76
|
+
|
94
77
|
def register_window(window)
|
95
78
|
@new_path ||= 0
|
96
79
|
@new_path += 1
|
data/lib/flammarion/version.rb
CHANGED
data/lib/rubame/rubame.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flammarion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubame
|