wunderbar 0.18.0 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/wunderbar/builder.rb +1 -1
- data/lib/wunderbar/version.rb +1 -1
- data/lib/wunderbar/websocket.rb +45 -50
- data/lib/wunderbar.rb +0 -1
- data/wunderbar.gemspec +4 -4
- metadata +5 -9
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZGU4NjkyOTQzNDNhNzc3NTk1Y2ViY2EzYWExYmU1ZTZkMTI5MmYyMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZGY0OTkxNTcxMWEzYWVmY2U5YjZmMjYzMmFiNDZkYWRhZDMzMmYyNw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGIwODZiNDMxOWFhNjE1NDI4ZjI0MmFjOGUwN2IxZDQ4YTE5MWIzODI0ZjVl
|
10
|
+
N2Q1ZjA0N2U5YTgwYWZkMDU5MzBiOGJhNjllMWNkMTk3ODAxNmRjMjcwYTMw
|
11
|
+
MjY2M2M1Njg0Yzg0OWNkN2Y0ZDY5OTQ5MTIyZGY1ZDY1YzU0NjQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZGYzNjI0MWUyNTdkNjBmMjRjYWY0YjdlZWEwMzYzMjY4Y2I0ZTE0NGI4OWJj
|
14
|
+
NjNkMTFkOGU5MTJmYjJhN2M5YWM3Njk0MmRlNmY4ZjUxZmQ4YWU5MmYzM2U5
|
15
|
+
M2FlZTU1YzM1YTkwODBjZjUzZDMyNThhNjBhZTgyZThmZjNkMjA=
|
data/lib/wunderbar/builder.rb
CHANGED
@@ -19,7 +19,7 @@ module Wunderbar
|
|
19
19
|
def websocket(*args, &block)
|
20
20
|
if Hash === args.last
|
21
21
|
args.last[:locals] = Hash[instance_variables.
|
22
|
-
map { |name| [name.sub('@',''), instance_variable_get(name)] } ]
|
22
|
+
map { |name| [name.to_s.sub('@',''), instance_variable_get(name)] } ]
|
23
23
|
end
|
24
24
|
Wunderbar.websocket(*args, &block)
|
25
25
|
end
|
data/lib/wunderbar/version.rb
CHANGED
data/lib/wunderbar/websocket.rb
CHANGED
@@ -3,10 +3,7 @@ require 'rubygems'
|
|
3
3
|
require 'open3'
|
4
4
|
require 'socket'
|
5
5
|
|
6
|
-
|
7
|
-
require 'em-websocket'
|
8
|
-
rescue LoadError
|
9
|
-
end
|
6
|
+
require 'em-websocket'
|
10
7
|
|
11
8
|
module Wunderbar
|
12
9
|
class Channel < BuilderBase
|
@@ -171,54 +168,52 @@ module Wunderbar
|
|
171
168
|
end
|
172
169
|
end
|
173
170
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
if opts[:sync]
|
213
|
-
instance_eval &proc
|
214
|
-
else
|
215
|
-
sock1, sock2 = UNIXSocket.pair
|
216
|
-
submit &proc
|
217
|
-
sleep 0.3 while sock2.recv(1) != 'x'
|
218
|
-
sock2.close
|
171
|
+
def self.websocket(opts={}, &block)
|
172
|
+
opts = {:port => opts} if Fixnum === opts
|
173
|
+
port = opts[:port]
|
174
|
+
buffer = opts.fetch(:buffer,1)
|
175
|
+
|
176
|
+
if not port
|
177
|
+
socket = TCPServer.new(0)
|
178
|
+
port = Socket.unpack_sockaddr_in(socket.getsockname).first
|
179
|
+
socket.close
|
180
|
+
end
|
181
|
+
|
182
|
+
sock1 = nil
|
183
|
+
|
184
|
+
proc = Proc.new do
|
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
|
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
|
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
|
219
205
|
end
|
206
|
+
end
|
220
207
|
|
221
|
-
|
208
|
+
if opts[:sync]
|
209
|
+
instance_eval &proc
|
210
|
+
else
|
211
|
+
sock1, sock2 = UNIXSocket.pair
|
212
|
+
submit &proc
|
213
|
+
sleep 0.3 while sock2.recv(1) != 'x'
|
214
|
+
sock2.close
|
222
215
|
end
|
216
|
+
|
217
|
+
port
|
223
218
|
end
|
224
219
|
end
|
data/lib/wunderbar.rb
CHANGED
data/wunderbar.gemspec
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "wunderbar"
|
5
|
-
s.version = "0.18.
|
5
|
+
s.version = "0.18.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sam Ruby"]
|
9
|
-
s.date = "2013-10-
|
9
|
+
s.date = "2013-10-21"
|
10
10
|
s.description = " Wunderbar makes it easy to produce valid HTML5, wellformed XHTML, Unicode\n (utf-8), consistently indented, readable applications. This includes\n output that conforms to the Polyglot specification and the emerging\n results from the XML Error Recovery Community Group.\n"
|
11
11
|
s.email = "rubys@intertwingly.net"
|
12
12
|
s.files = ["wunderbar.gemspec", "README.md", "COPYING", "lib/wunderbar.rb", "lib/wunderbar", "lib/wunderbar/logger.rb", "lib/wunderbar/polymer-v0.0.20131003.min.js", "lib/wunderbar/rails.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/jquery-1.10.2.min.js", "lib/wunderbar/environment.rb", "lib/wunderbar/server.rb", "lib/wunderbar/polymer.rb", "lib/wunderbar/version.rb", "lib/wunderbar/node.rb", "lib/wunderbar/asset.rb", "lib/wunderbar/websocket.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/opal-jquery.rb", "lib/wunderbar/jquery.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/sinatra.rb", "lib/wunderbar/rack.rb", "lib/wunderbar/opal.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/opal-browser.rb"]
|
13
13
|
s.homepage = "http://github.com/rubys/wunderbar"
|
14
14
|
s.require_paths = ["lib"]
|
15
|
-
s.rubygems_version = "
|
15
|
+
s.rubygems_version = "2.0.7"
|
16
16
|
s.summary = "HTML Generator and CGI application support"
|
17
17
|
|
18
18
|
if s.respond_to? :specification_version then
|
19
|
-
s.specification_version =
|
19
|
+
s.specification_version = 4
|
20
20
|
|
21
21
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
22
22
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wunderbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
5
|
-
prerelease:
|
4
|
+
version: 0.18.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sam Ruby
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: json
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -65,26 +62,25 @@ files:
|
|
65
62
|
- lib/wunderbar/opal-browser.rb
|
66
63
|
homepage: http://github.com/rubys/wunderbar
|
67
64
|
licenses: []
|
65
|
+
metadata: {}
|
68
66
|
post_install_message:
|
69
67
|
rdoc_options: []
|
70
68
|
require_paths:
|
71
69
|
- lib
|
72
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
71
|
requirements:
|
75
72
|
- - ! '>='
|
76
73
|
- !ruby/object:Gem::Version
|
77
74
|
version: '0'
|
78
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
76
|
requirements:
|
81
77
|
- - ! '>='
|
82
78
|
- !ruby/object:Gem::Version
|
83
79
|
version: '0'
|
84
80
|
requirements: []
|
85
81
|
rubyforge_project:
|
86
|
-
rubygems_version:
|
82
|
+
rubygems_version: 2.0.7
|
87
83
|
signing_key:
|
88
|
-
specification_version:
|
84
|
+
specification_version: 4
|
89
85
|
summary: HTML Generator and CGI application support
|
90
86
|
test_files: []
|