wunderbar 1.4.5 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wunderbar/render.rb +16 -2
- data/lib/wunderbar/script.rb +3 -1
- data/lib/wunderbar/version.rb +2 -2
- data/lib/wunderbar/websocket.rb +17 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b41fc0cdf18f4493457caaf8ea0be99429a7ef2b93f3725dc255c0be969c49c
|
4
|
+
data.tar.gz: 6f3c9aba7491dcf8c7a2a3e6f344b063b5a0901b54f17e736c6e96f1f410d83d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab2ffb039d0bbf017f27b280724ac84b13f3887c7e1eb9c903bb9870cd598da31b9df369a20bc6fb7881177ecc75e29fb5c93a4433e2ccfdcd5fea2fdd3bd728
|
7
|
+
data.tar.gz: 4035385caae931b83278a621855d98ceb60be387ecff963fb621712daeec443313f4a6671642388ed72f261b5be8ec420194a57bddb10253154c2a03bb43a3fd
|
data/lib/wunderbar/render.rb
CHANGED
@@ -6,7 +6,12 @@ end
|
|
6
6
|
|
7
7
|
require 'wunderbar/sinatra'
|
8
8
|
require 'wunderbar/script'
|
9
|
-
|
9
|
+
|
10
|
+
if RUBY_VERSION =~ /^1|^2\.[0-4]/
|
11
|
+
require 'nokogumbo'
|
12
|
+
else
|
13
|
+
require 'nokogiri'
|
14
|
+
end
|
10
15
|
|
11
16
|
class Wunderbar::Asset
|
12
17
|
@@cached_scripts = {}
|
@@ -25,7 +30,7 @@ class Wunderbar::ClientScriptNode < Wunderbar::ScriptNode
|
|
25
30
|
end
|
26
31
|
|
27
32
|
class Wunderbar::XmlMarkup
|
28
|
-
def render(container, &block)
|
33
|
+
def render(container, timeout: nil, &block)
|
29
34
|
csspath = Wunderbar::Node.parse_css_selector(container)
|
30
35
|
root = @node.root
|
31
36
|
|
@@ -119,6 +124,15 @@ class Wunderbar::XmlMarkup
|
|
119
124
|
end
|
120
125
|
end
|
121
126
|
|
127
|
+
# add timeout, if requested
|
128
|
+
#
|
129
|
+
# useful if the rendering itself is inherently synchronous, but may make
|
130
|
+
# use of a library routines that set up event handlers that will never fire.
|
131
|
+
#
|
132
|
+
if timeout
|
133
|
+
server += ";\nsetTimeout(() => {process.exit()}, #{timeout})"
|
134
|
+
end
|
135
|
+
|
122
136
|
# concatenate and execute scripts on server
|
123
137
|
if browserify
|
124
138
|
setup += requires.map {|key, value|
|
data/lib/wunderbar/script.rb
CHANGED
@@ -13,7 +13,9 @@ module Wunderbar
|
|
13
13
|
if @block and @children.empty? and not @text
|
14
14
|
width = options[:width]
|
15
15
|
width -= indent.to_s.length if width
|
16
|
-
|
16
|
+
opts = {binding: @binding, width: width}
|
17
|
+
opts = {**@attrs.delete(:options), **opts} if @attrs[:options]
|
18
|
+
@text = Ruby2JS.convert(@block, opts).to_s
|
17
19
|
end
|
18
20
|
super
|
19
21
|
end
|
data/lib/wunderbar/version.rb
CHANGED
data/lib/wunderbar/websocket.rb
CHANGED
@@ -183,25 +183,25 @@ module Wunderbar
|
|
183
183
|
|
184
184
|
proc = Proc.new do
|
185
185
|
begin
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
186
|
+
channel = Wunderbar::Channel.new(port, buffer, opts[:locals])
|
187
|
+
if sock1
|
188
|
+
sock1.send('x',0)
|
189
|
+
sock1.close
|
190
|
+
end
|
191
|
+
channel.instance_eval(&block)
|
192
192
|
rescue Exception => exception
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
193
|
+
channel._ :type=>:stderr, :line=>exception.inspect
|
194
|
+
exception.backtrace.each do |frame|
|
195
|
+
next if Wunderbar::CALLERS_TO_IGNORE.any? {|re| frame =~ re}
|
196
|
+
channel._ :type=>:stderr, :line=>" #{frame}"
|
197
|
+
end
|
198
198
|
ensure
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
199
|
+
if channel
|
200
|
+
channel.complete = true
|
201
|
+
sleep 5
|
202
|
+
sleep 60 unless channel.connected or opts[:sync]
|
203
|
+
channel.close
|
204
|
+
end
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wunderbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
107
|
+
rubygems_version: 3.3.7
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: HTML Generator and CGI application support
|