wunderbar 1.4.5 → 1.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1753c6f65653020143af9ed4f73f15e11c7443e8fec1d26a3ae645be0f785191
4
- data.tar.gz: 3257c0840a2d8d9aaf5f7368623dc8f487e449d6e8d8046632c1a264bb373e18
3
+ metadata.gz: 5b41fc0cdf18f4493457caaf8ea0be99429a7ef2b93f3725dc255c0be969c49c
4
+ data.tar.gz: 6f3c9aba7491dcf8c7a2a3e6f344b063b5a0901b54f17e736c6e96f1f410d83d
5
5
  SHA512:
6
- metadata.gz: 364ab25aeab2b20e7b98d98ac0dbf537b68fb11c82046b6206039661b2d0694521d09229cc4c5832aff48eab5fbb8b4fad34cabe65d9c534921b6f015b2c6fab
7
- data.tar.gz: '0885f9681bd7955e81de1a2920a77c736b1283c152eab4f20425ec7cebbd75c956da6efd348c388541229822c65644ad20f78f8a6911066fdfcf59616e133840'
6
+ metadata.gz: ab2ffb039d0bbf017f27b280724ac84b13f3887c7e1eb9c903bb9870cd598da31b9df369a20bc6fb7881177ecc75e29fb5c93a4433e2ccfdcd5fea2fdd3bd728
7
+ data.tar.gz: 4035385caae931b83278a621855d98ceb60be387ecff963fb621712daeec443313f4a6671642388ed72f261b5be8ec420194a57bddb10253154c2a03bb43a3fd
@@ -6,7 +6,12 @@ end
6
6
 
7
7
  require 'wunderbar/sinatra'
8
8
  require 'wunderbar/script'
9
- require 'nokogumbo'
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|
@@ -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
- @text = Ruby2JS.convert(@block, binding: @binding, width: width).to_s
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
@@ -1,8 +1,8 @@
1
1
  module Wunderbar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
- MINOR = 4
5
- TINY = 5
4
+ MINOR = 6
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -183,25 +183,25 @@ module Wunderbar
183
183
 
184
184
  proc = Proc.new do
185
185
  begin
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)
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
- 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
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
- if channel
200
- channel.complete = true
201
- sleep 5
202
- sleep 60 unless channel.connected or opts[:sync]
203
- channel.close
204
- end
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.5
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.1.2
107
+ rubygems_version: 3.3.7
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: HTML Generator and CGI application support