goat 0.3.14 → 0.3.15
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/yodel +42 -1
- data/goat.gemspec +1 -3
- data/lib/goat.rb +0 -4
- data/lib/goat/html.rb +9 -5
- metadata +4 -6
- data/bin/sync +0 -53
- data/lib/goat/yodel.rb +0 -39
data/bin/yodel
CHANGED
@@ -1,11 +1,52 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'rubygems'
|
4
|
+
require 'eventmachine'
|
4
5
|
require 'optparse'
|
5
6
|
|
7
|
+
$:.unshift(File.join(File.dirname(__FILE__), '../lib'))
|
8
|
+
|
9
|
+
require 'goat/common'
|
10
|
+
require 'goat/net-common'
|
11
|
+
|
6
12
|
$bport = 8000
|
7
13
|
$rport = 8001
|
8
14
|
$host = '127.0.0.1'
|
15
|
+
$verbose = ARGV.include?('-v')
|
16
|
+
|
17
|
+
module Yodel
|
18
|
+
NotifChannel = EM::Channel.new
|
19
|
+
|
20
|
+
class BroadcastServer < EM::Connection
|
21
|
+
def self.start(host='127.0.0.1', port=8000)
|
22
|
+
EM.start_server(host, port, self)
|
23
|
+
end
|
24
|
+
|
25
|
+
def post_init
|
26
|
+
Goat.logw "listener connected"
|
27
|
+
@sub = NotifChannel.subscribe do |msg|
|
28
|
+
send_data(msg + "\n")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def unbind
|
33
|
+
NotifChannel.unsubscribe(@sub)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class RecvServer < EM::Connection
|
38
|
+
include EM::P::LineText2
|
39
|
+
|
40
|
+
def self.start(host='127.0.0.1', port=8001)
|
41
|
+
EM.start_server(host, port, self)
|
42
|
+
end
|
43
|
+
|
44
|
+
def receive_line(line)
|
45
|
+
Goat.logd "got #{line}"
|
46
|
+
NotifChannel << line
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
9
50
|
|
10
51
|
def usage
|
11
52
|
$stderr.puts <<-EOH
|
data/goat.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'goat'
|
3
|
-
s.version = '0.3.
|
3
|
+
s.version = '0.3.15'
|
4
4
|
s.summary = 'Pre-release beta version of Goat'
|
5
5
|
s.author = 'Patrick Collison'
|
6
6
|
s.email = 'patrick@collison.ie'
|
@@ -14,7 +14,6 @@ spec = Gem::Specification.new do |s|
|
|
14
14
|
bin/channel-srv
|
15
15
|
bin/press
|
16
16
|
bin/state-srv
|
17
|
-
bin/sync
|
18
17
|
bin/yodel
|
19
18
|
goat.gemspec
|
20
19
|
examples/jq.js
|
@@ -30,7 +29,6 @@ spec = Gem::Specification.new do |s|
|
|
30
29
|
lib/goat/notifications.rb
|
31
30
|
lib/goat/state-srv.rb
|
32
31
|
lib/goat/static.rb
|
33
|
-
lib/goat/yodel.rb
|
34
32
|
lib/goat.rb
|
35
33
|
lib/views/plain_layout.erb
|
36
34
|
}
|
data/lib/goat.rb
CHANGED
data/lib/goat/html.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rack/utils'
|
2
|
+
|
1
3
|
module Goat
|
2
4
|
module DOMTools
|
3
5
|
class Traverser
|
@@ -154,7 +156,13 @@ module Goat
|
|
154
156
|
|
155
157
|
class ::String
|
156
158
|
def to_html(builder)
|
157
|
-
|
159
|
+
Rack::Utils.escape_html(self)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
class ::Goat::HTMLString < String
|
164
|
+
def to_html(builder)
|
165
|
+
self
|
158
166
|
end
|
159
167
|
end
|
160
168
|
|
@@ -229,10 +237,6 @@ module Goat
|
|
229
237
|
attrs.map {|k, v| "#{k}=\"#{v}\""}.join(' ')
|
230
238
|
end
|
231
239
|
|
232
|
-
def string_to_html(str)
|
233
|
-
str
|
234
|
-
end
|
235
|
-
|
236
240
|
def array_to_html(ar)
|
237
241
|
if ar.first.kind_of?(Symbol)
|
238
242
|
tag = ar[0]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 15
|
10
|
+
version: 0.3.15
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Collison
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-22 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -33,7 +33,6 @@ files:
|
|
33
33
|
- bin/channel-srv
|
34
34
|
- bin/press
|
35
35
|
- bin/state-srv
|
36
|
-
- bin/sync
|
37
36
|
- bin/yodel
|
38
37
|
- goat.gemspec
|
39
38
|
- examples/jq.js
|
@@ -49,7 +48,6 @@ files:
|
|
49
48
|
- lib/goat/notifications.rb
|
50
49
|
- lib/goat/state-srv.rb
|
51
50
|
- lib/goat/static.rb
|
52
|
-
- lib/goat/yodel.rb
|
53
51
|
- lib/goat.rb
|
54
52
|
- lib/views/plain_layout.erb
|
55
53
|
has_rdoc: true
|
data/bin/sync
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
module Goat
|
4
|
-
module Sync
|
5
|
-
NotifChannel = EM::Channel.new
|
6
|
-
|
7
|
-
@viewports = {}
|
8
|
-
|
9
|
-
class Viewport
|
10
|
-
attr_reader :created, :viewport, :components
|
11
|
-
|
12
|
-
def initialize(v, cs)
|
13
|
-
@created = Time.now
|
14
|
-
@viewport = v
|
15
|
-
@components = cs
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class ComponentServer < EM::Connection
|
20
|
-
def self.start(host='127.0.0.1', port=8010)
|
21
|
-
EM.start_server(host, port, self)
|
22
|
-
end
|
23
|
-
|
24
|
-
def viewport_components(v, cs)
|
25
|
-
@viewports[v] = Viewport.new(v, cs)
|
26
|
-
end
|
27
|
-
|
28
|
-
def receive_line(line)
|
29
|
-
msg = JSON.load(line)
|
30
|
-
meth = msg['type']
|
31
|
-
args = msg['data']
|
32
|
-
self.send(meth.to_sym, *args)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
NotificationServer.subscribe() do |notif|
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
class RecvServer < EM::Connection
|
41
|
-
include EM::P::LineText2
|
42
|
-
|
43
|
-
def self.start(host='127.0.0.1', port=8001)
|
44
|
-
EM.start_server(host, port, self)
|
45
|
-
end
|
46
|
-
|
47
|
-
def receive_line(line)
|
48
|
-
$stdout.puts "got #{line}" if $verbose
|
49
|
-
NotifChannel << line
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
data/lib/goat/yodel.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'eventmachine'
|
3
|
-
require File.join(File.dirname(__FILE__), 'net-common')
|
4
|
-
|
5
|
-
$verbose = ARGV.include?('-v')
|
6
|
-
|
7
|
-
module Yodel
|
8
|
-
NotifChannel = EM::Channel.new
|
9
|
-
|
10
|
-
class BroadcastServer < EM::Connection
|
11
|
-
def self.start(host='127.0.0.1', port=8000)
|
12
|
-
EM.start_server(host, port, self)
|
13
|
-
end
|
14
|
-
|
15
|
-
def post_init
|
16
|
-
Goat.logw "listener connected"
|
17
|
-
@sub = NotifChannel.subscribe do |msg|
|
18
|
-
send_data(msg + "\n")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def unbind
|
23
|
-
NotifChannel.unsubscribe(@sub)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class RecvServer < EM::Connection
|
28
|
-
include EM::P::LineText2
|
29
|
-
|
30
|
-
def self.start(host='127.0.0.1', port=8001)
|
31
|
-
EM.start_server(host, port, self)
|
32
|
-
end
|
33
|
-
|
34
|
-
def receive_line(line)
|
35
|
-
Goat.logd "got #{line}"
|
36
|
-
NotifChannel << line
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|