ernie 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Rakefile +3 -2
- data/VERSION.yml +2 -2
- data/ernie.gemspec +15 -8
- data/lib/ernie.rb +3 -29
- metadata +15 -4
data/History.txt
ADDED
data/Rakefile
CHANGED
@@ -11,8 +11,9 @@ begin
|
|
11
11
|
gem.authors = ["Tom Preston-Werner"]
|
12
12
|
gem.files.include(["ext"])
|
13
13
|
gem.extensions << 'ext/extconf.rb'
|
14
|
-
gem.add_dependency('erlectricity', '>= 1.0
|
15
|
-
gem.add_dependency('
|
14
|
+
gem.add_dependency('erlectricity', '>= 1.1.0')
|
15
|
+
gem.add_dependency('bert', '>= 0.1.0')
|
16
|
+
gem.add_dependency('bertrpc', '>= 0.4.0')
|
16
17
|
|
17
18
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
19
|
end
|
data/VERSION.yml
CHANGED
data/ernie.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{ernie}
|
5
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Tom Preston-Werner"]
|
9
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-10-08}
|
10
13
|
s.default_executable = %q{ernie}
|
11
14
|
s.email = %q{tom@mojombo.com}
|
12
15
|
s.executables = ["ernie"]
|
@@ -18,6 +21,7 @@ Gem::Specification.new do |s|
|
|
18
21
|
s.files = [
|
19
22
|
".document",
|
20
23
|
".gitignore",
|
24
|
+
"History.txt",
|
21
25
|
"LICENSE",
|
22
26
|
"README.md",
|
23
27
|
"Rakefile",
|
@@ -62,14 +66,17 @@ Gem::Specification.new do |s|
|
|
62
66
|
s.specification_version = 3
|
63
67
|
|
64
68
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
65
|
-
s.add_runtime_dependency(%q<erlectricity>, [">= 1.0
|
66
|
-
s.add_runtime_dependency(%q<
|
69
|
+
s.add_runtime_dependency(%q<erlectricity>, [">= 1.1.0"])
|
70
|
+
s.add_runtime_dependency(%q<bert>, [">= 0.1.0"])
|
71
|
+
s.add_runtime_dependency(%q<bertrpc>, [">= 0.4.0"])
|
67
72
|
else
|
68
|
-
s.add_dependency(%q<erlectricity>, [">= 1.0
|
69
|
-
s.add_dependency(%q<
|
73
|
+
s.add_dependency(%q<erlectricity>, [">= 1.1.0"])
|
74
|
+
s.add_dependency(%q<bert>, [">= 0.1.0"])
|
75
|
+
s.add_dependency(%q<bertrpc>, [">= 0.4.0"])
|
70
76
|
end
|
71
77
|
else
|
72
|
-
s.add_dependency(%q<erlectricity>, [">= 1.0
|
73
|
-
s.add_dependency(%q<
|
78
|
+
s.add_dependency(%q<erlectricity>, [">= 1.1.0"])
|
79
|
+
s.add_dependency(%q<bert>, [">= 0.1.0"])
|
80
|
+
s.add_dependency(%q<bertrpc>, [">= 0.4.0"])
|
74
81
|
end
|
75
82
|
end
|
data/lib/ernie.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'bert'
|
3
3
|
require 'logger'
|
4
4
|
|
5
5
|
class Ernie
|
@@ -30,39 +30,13 @@ class Ernie
|
|
30
30
|
self.logger.info(text) if self.logger
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.convert(item)
|
34
|
-
if item.instance_of?(Hash)
|
35
|
-
a = [:dict]
|
36
|
-
item.each_pair { |k, v| a << [convert(k), convert(v)] }
|
37
|
-
a
|
38
|
-
elsif item.instance_of?(Array)
|
39
|
-
item.map { |x| convert(x) }
|
40
|
-
else
|
41
|
-
item
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.deconvert(item)
|
46
|
-
if item.instance_of?(Array)
|
47
|
-
if item.first == :dict
|
48
|
-
item[1..-1].inject({}) do |acc, x|
|
49
|
-
acc[deconvert(x[0])] = deconvert(x[1]); acc
|
50
|
-
end
|
51
|
-
else
|
52
|
-
item.map { |x| deconvert(x) }
|
53
|
-
end
|
54
|
-
else
|
55
|
-
item
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
33
|
def self.dispatch(mod, fun, args)
|
60
|
-
xargs =
|
34
|
+
xargs = BERT::Decoder.convert(args)
|
61
35
|
self.log("-- " + [mod, fun, xargs].inspect)
|
62
36
|
self.mods[mod] || raise(ServerError.new("No such module '#{mod}'"))
|
63
37
|
self.mods[mod].funs[fun] || raise(ServerError.new("No such function '#{mod}:#{fun}'"))
|
64
38
|
res = self.mods[mod].funs[fun].call(*xargs)
|
65
|
-
convert(res)
|
39
|
+
BERT::Encoder.convert(res)
|
66
40
|
end
|
67
41
|
|
68
42
|
def self.start
|
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: 0.
|
4
|
+
version: 0.4.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: 2009-
|
12
|
+
date: 2009-10-08 00:00:00 -07:00
|
13
13
|
default_executable: ernie
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,17 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.0
|
23
|
+
version: 1.1.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bert
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
24
34
|
version:
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: bertrpc
|
@@ -30,7 +40,7 @@ dependencies:
|
|
30
40
|
requirements:
|
31
41
|
- - ">="
|
32
42
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
43
|
+
version: 0.4.0
|
34
44
|
version:
|
35
45
|
description:
|
36
46
|
email: tom@mojombo.com
|
@@ -44,6 +54,7 @@ extra_rdoc_files:
|
|
44
54
|
files:
|
45
55
|
- .document
|
46
56
|
- .gitignore
|
57
|
+
- History.txt
|
47
58
|
- LICENSE
|
48
59
|
- README.md
|
49
60
|
- Rakefile
|