ernie 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/README.md +167 -36
- data/VERSION.yml +3 -3
- data/bin/ernie +6 -12
- data/contrib/ebench.erl +76 -0
- data/elib/asset_pool.erl +18 -19
- data/elib/asset_pool_sup.erl +5 -7
- data/elib/bert.erl +69 -0
- data/elib/ernie.hrl +10 -0
- data/elib/ernie_admin.erl +60 -0
- data/elib/ernie_config.erl +30 -0
- data/elib/ernie_native.erl +22 -0
- data/elib/ernie_server.erl +139 -74
- data/elib/ernie_server_app.erl +1 -2
- data/elib/ernie_server_sup.erl +4 -1
- data/ernie.gemspec +17 -9
- data/examples/example.cfg +12 -0
- data/examples/ext.erl +8 -0
- data/examples/{expose.rb → ext.rb} +14 -2
- data/examples/nat.erl +12 -0
- data/lib/ernie.rb +1 -9
- data/test/ernie_server_test.rb +11 -11
- data/test/ernie_test.rb +0 -44
- data/test/sample/ext.rb +42 -0
- data/test/sample/sample.cfg +4 -0
- metadata +16 -8
- data/examples/dsl.rb +0 -28
- data/test/handler.rb +0 -41
data/test/sample/ext.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
2
|
+
require 'ernie'
|
3
|
+
|
4
|
+
module Ext
|
5
|
+
@@state = 0
|
6
|
+
|
7
|
+
def zeronary
|
8
|
+
:foo
|
9
|
+
end
|
10
|
+
|
11
|
+
def unary(a)
|
12
|
+
a
|
13
|
+
end
|
14
|
+
|
15
|
+
def binary(a, b)
|
16
|
+
a + b
|
17
|
+
end
|
18
|
+
|
19
|
+
def ternary(a, b, c)
|
20
|
+
a + b + c
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_state(x)
|
24
|
+
@@state = x
|
25
|
+
sleep 5
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_state
|
30
|
+
@@state
|
31
|
+
end
|
32
|
+
|
33
|
+
def big(x)
|
34
|
+
'a' * x
|
35
|
+
end
|
36
|
+
|
37
|
+
def cry
|
38
|
+
raise "abandon hope!"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Ernie.expose(:ext, Ext)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ernie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-16 00:00:00 -08:00
|
13
13
|
default_executable: ernie
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,9 +51,15 @@ files:
|
|
51
51
|
- Rakefile
|
52
52
|
- VERSION.yml
|
53
53
|
- bin/ernie
|
54
|
+
- contrib/ebench.erl
|
54
55
|
- ebin/ernie_server_app.app
|
55
56
|
- elib/asset_pool.erl
|
56
57
|
- elib/asset_pool_sup.erl
|
58
|
+
- elib/bert.erl
|
59
|
+
- elib/ernie.hrl
|
60
|
+
- elib/ernie_admin.erl
|
61
|
+
- elib/ernie_config.erl
|
62
|
+
- elib/ernie_native.erl
|
57
63
|
- elib/ernie_server.erl
|
58
64
|
- elib/ernie_server_app.erl
|
59
65
|
- elib/ernie_server_sup.erl
|
@@ -61,16 +67,19 @@ files:
|
|
61
67
|
- elib/logger_sup.erl
|
62
68
|
- elib/port_wrapper.erl
|
63
69
|
- ernie.gemspec
|
64
|
-
- examples/
|
65
|
-
- examples/
|
70
|
+
- examples/example.cfg
|
71
|
+
- examples/ext.erl
|
72
|
+
- examples/ext.rb
|
73
|
+
- examples/nat.erl
|
66
74
|
- ext/Makefile
|
67
75
|
- ext/extconf.rb
|
68
76
|
- lib/ernie.rb
|
69
77
|
- test/ernie_server_test.rb
|
70
78
|
- test/ernie_test.rb
|
71
|
-
- test/handler.rb
|
72
79
|
- test/helper.rb
|
73
80
|
- test/load.rb
|
81
|
+
- test/sample/ext.rb
|
82
|
+
- test/sample/sample.cfg
|
74
83
|
has_rdoc: true
|
75
84
|
homepage: http://github.com/mojombo/ernie
|
76
85
|
licenses: []
|
@@ -102,8 +111,7 @@ summary: Ernie is a BERT-RPC server implementation.
|
|
102
111
|
test_files:
|
103
112
|
- test/ernie_server_test.rb
|
104
113
|
- test/ernie_test.rb
|
105
|
-
- test/handler.rb
|
106
114
|
- test/helper.rb
|
107
115
|
- test/load.rb
|
108
|
-
-
|
109
|
-
- examples/
|
116
|
+
- test/sample/ext.rb
|
117
|
+
- examples/ext.rb
|
data/examples/dsl.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
require 'ernie'
|
3
|
-
|
4
|
-
# logfile('/tmp/ernie.log')
|
5
|
-
# loglevel(Logger::INFO)
|
6
|
-
|
7
|
-
mod(:test) do
|
8
|
-
# Add two numbers together
|
9
|
-
fun(:add) do |a, b|
|
10
|
-
a + b
|
11
|
-
end
|
12
|
-
|
13
|
-
# Return the given number of bytes
|
14
|
-
fun(:bytes) do |bytes|
|
15
|
-
'x' * bytes
|
16
|
-
end
|
17
|
-
|
18
|
-
# Sleep for +sec+ and then return :ok
|
19
|
-
fun(:slow) do |sec|
|
20
|
-
sleep(sec)
|
21
|
-
:ok
|
22
|
-
end
|
23
|
-
|
24
|
-
# Throw an error
|
25
|
-
fun(:error) do |a, b|
|
26
|
-
raise "abandon hope!"
|
27
|
-
end
|
28
|
-
end
|
data/test/handler.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
require 'ernie'
|
3
|
-
|
4
|
-
state = 0
|
5
|
-
|
6
|
-
# Just about the easiest example I could thing of.
|
7
|
-
mod(:test) do
|
8
|
-
fun(:zeronary) do
|
9
|
-
:foo
|
10
|
-
end
|
11
|
-
|
12
|
-
fun(:unary) do |a|
|
13
|
-
a
|
14
|
-
end
|
15
|
-
|
16
|
-
fun(:binary) do |a, b|
|
17
|
-
a + b
|
18
|
-
end
|
19
|
-
|
20
|
-
fun(:ternary) do |a, b, c|
|
21
|
-
a + b + c
|
22
|
-
end
|
23
|
-
|
24
|
-
fun(:set_state) do |x|
|
25
|
-
state = x
|
26
|
-
sleep 5
|
27
|
-
nil
|
28
|
-
end
|
29
|
-
|
30
|
-
fun(:get_state) do
|
31
|
-
state
|
32
|
-
end
|
33
|
-
|
34
|
-
fun(:big) do |x|
|
35
|
-
'a' * x
|
36
|
-
end
|
37
|
-
|
38
|
-
fun(:cry) do
|
39
|
-
raise "abandon hope!"
|
40
|
-
end
|
41
|
-
end
|