krpc 0.3.2 → 0.4.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/krpc.gemspec +6 -6
- data/lib/krpc.rb +2 -2
- data/lib/krpc/client.rb +54 -48
- data/lib/krpc/connection.rb +38 -33
- data/lib/krpc/core_extensions.rb +3 -3
- data/lib/krpc/decoder.rb +13 -20
- data/lib/krpc/doc.rb +29 -30
- data/lib/krpc/encoder.rb +19 -31
- data/lib/krpc/error.rb +2 -1
- data/lib/krpc/gen.rb +36 -37
- data/lib/krpc/krpc.pb.rb +87 -26
- data/lib/krpc/procedure_name_parser.rb +47 -0
- data/lib/krpc/protobuf_extensions.rb +22 -1
- data/lib/krpc/protobuf_utils.rb +28 -31
- data/lib/krpc/service.rb +44 -67
- data/lib/krpc/streaming.rb +30 -30
- data/lib/krpc/types.rb +73 -154
- data/lib/krpc/version.rb +8 -1
- metadata +17 -16
- data/lib/krpc/attributes.rb +0 -80
data/lib/krpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: krpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Więch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: colorize
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.6'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.13'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.13'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.5'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.5'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '11.3'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '11.3'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: hanna-nouveau
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,6 @@ files:
|
|
136
136
|
- README.md
|
137
137
|
- krpc.gemspec
|
138
138
|
- lib/krpc.rb
|
139
|
-
- lib/krpc/attributes.rb
|
140
139
|
- lib/krpc/client.rb
|
141
140
|
- lib/krpc/connection.rb
|
142
141
|
- lib/krpc/core_extensions.rb
|
@@ -146,6 +145,7 @@ files:
|
|
146
145
|
- lib/krpc/error.rb
|
147
146
|
- lib/krpc/gen.rb
|
148
147
|
- lib/krpc/krpc.pb.rb
|
148
|
+
- lib/krpc/procedure_name_parser.rb
|
149
149
|
- lib/krpc/protobuf_extensions.rb
|
150
150
|
- lib/krpc/protobuf_utils.rb
|
151
151
|
- lib/krpc/repl_tools.rb
|
@@ -174,13 +174,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: 2.1.0
|
175
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
|
-
- - "
|
177
|
+
- - ">"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
179
|
+
version: 1.3.1
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.5.1
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Client library for kRPC
|
186
186
|
test_files: []
|
187
|
+
has_rdoc:
|
data/lib/krpc/attributes.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'krpc/error'
|
2
|
-
|
3
|
-
module KRPC
|
4
|
-
module Attributes
|
5
|
-
class << self
|
6
|
-
|
7
|
-
def is_any_start_with?(attrs, prefix)
|
8
|
-
attrs.any?{|a| a.start_with? prefix }
|
9
|
-
end
|
10
|
-
alias_method :asw?, :is_any_start_with?
|
11
|
-
|
12
|
-
def is_a_property_accessor(attrs) asw?(attrs,"Property.") end
|
13
|
-
def is_a_property_getter(attrs) asw?(attrs,"Property.Get(") end
|
14
|
-
def is_a_property_setter(attrs) asw?(attrs,"Property.Set(") end
|
15
|
-
def is_a_class_method_or_property_accessor(attrs) asw?(attrs,"Class.") end
|
16
|
-
def is_a_class_method(attrs) asw?(attrs,"Class.Method(") end
|
17
|
-
def is_a_class_static_method(attrs) asw?(attrs,"Class.StaticMethod(") end
|
18
|
-
def is_a_class_property_accessor(attrs) asw?(attrs,"Class.Property.") end
|
19
|
-
def is_a_class_property_getter(attrs) asw?(attrs,"Class.Property.Get(") end
|
20
|
-
def is_a_class_property_setter(attrs) asw?(attrs,"Class.Property.Set(") end
|
21
|
-
|
22
|
-
def get_service_name(attrs)
|
23
|
-
if is_a_class_method(attrs) || is_a_class_static_method(attrs)
|
24
|
-
attrs.each do |a|
|
25
|
-
return $1 if /^Class\.(?:Static)?Method\(([^,\.]+)\.[^,]+,[^,]+\)$/ =~ a
|
26
|
-
end
|
27
|
-
elsif is_a_class_property_accessor(attrs)
|
28
|
-
attrs.each do |a|
|
29
|
-
return $1 if /^Class\.Property.(?:Get|Set)\(([^,\.]+)\.[^,]+,[^,]+\)$/ =~ a
|
30
|
-
end
|
31
|
-
end
|
32
|
-
raise(ValueError, "Procedure attributes are not a class method or property accessor")
|
33
|
-
end
|
34
|
-
|
35
|
-
def get_class_name(attrs)
|
36
|
-
if is_a_class_method(attrs) || is_a_class_static_method(attrs)
|
37
|
-
attrs.each do |a|
|
38
|
-
return $1 if /^Class\.(?:Static)?Method\([^,\.]+\.([^,\.]+),[^,]+\)$/ =~ a
|
39
|
-
end
|
40
|
-
elsif is_a_class_property_accessor(attrs)
|
41
|
-
attrs.each do |a|
|
42
|
-
return $1 if /^Class\.Property.(?:Get|Set)\([^,\.]+\.([^,]+),[^,]+\)$/ =~ a
|
43
|
-
end
|
44
|
-
end
|
45
|
-
raise(ValueError, "Procedure attributes are not a class method or property accessor")
|
46
|
-
end
|
47
|
-
|
48
|
-
def get_property_name(attrs)
|
49
|
-
if is_a_property_accessor(attrs)
|
50
|
-
attrs.each do |a|
|
51
|
-
return $1 if /^Property\.(?:Get|Set)\((.+)\)$/ =~ a
|
52
|
-
end
|
53
|
-
end
|
54
|
-
raise(ValueError, "Procedure attributes are not a property accessor")
|
55
|
-
end
|
56
|
-
|
57
|
-
def get_class_method_or_property_name(attrs)
|
58
|
-
if is_a_class_method(attrs) || is_a_class_static_method(attrs) || is_a_class_property_accessor(attrs)
|
59
|
-
attrs.each do |a|
|
60
|
-
return $1 if /^Class\.(?:(?:Static)?Method|Property\.(?:Get|Set))\([^,]+,([^,]+)\)$/ =~ a
|
61
|
-
end
|
62
|
-
end
|
63
|
-
raise(ValueError, "Procedure attributes are not a class method or class property accessor")
|
64
|
-
end
|
65
|
-
|
66
|
-
def get_parameter_type_attrs(pos, attrs)
|
67
|
-
attrs.map do |a|
|
68
|
-
(/^ParameterType\(#{pos}\).(.+)$/ =~ a) ? $1 : nil
|
69
|
-
end.compact
|
70
|
-
end
|
71
|
-
|
72
|
-
def get_return_type_attrs(attrs)
|
73
|
-
attrs.map do |a|
|
74
|
-
(/^ReturnType.(.+)$/ =~ a) ? $1 : nil
|
75
|
-
end.compact
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|