flammarion 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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]}"))
@@ -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.new do
9
+ @launch_thread = Thread.current
10
+ @server_thread = Thread.new do
10
11
  begin
11
12
  start_server_internal
12
- rescue SystemExit
13
- raise
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 Exception => e
57
- Kernel.puts "#{e.message.to_s.red}\n#{e.backtrace.join("\n").light_red}"
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
@@ -1,3 +1,3 @@
1
1
  module Flammarion
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -256,6 +256,7 @@ input:focus::-webkit-input-placeholder {
256
256
  user-select: none;
257
257
  font-family: monospace;
258
258
  min-height: 1.4em;
259
+ display: inline-block;
259
260
  }
260
261
  .inline-checkbox > span {
261
262
  vertical-align: middle;
@@ -112,6 +112,7 @@ input:focus::-webkit-input-placeholder {
112
112
  user-select: none;
113
113
  font-family: monospace;
114
114
  min-height: 1.4em;
115
+ display: inline-block;
115
116
  }
116
117
  .inline-checkbox > span {
117
118
  vertical-align: middle;
data/lib/rubame/rubame.rb CHANGED
@@ -74,7 +74,7 @@ module Rubame
74
74
  end
75
75
 
76
76
  def run(&blk)
77
- readable, writable = IO.select(@reading, @writing, nil)
77
+ readable, writable = IO.select(@reading, @writing, nil, 5)
78
78
 
79
79
  if readable
80
80
  readable.each do |socket|
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.8
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-06-18 00:00:00.000000000 Z
12
+ date: 2016-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubame