grumlin 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/.rubocop.yml +53 -12
- data/Gemfile.lock +1 -1
- data/lib/async/channel.rb +1 -1
- data/lib/grumlin/client.rb +1 -1
- data/lib/grumlin/edge.rb +1 -3
- data/lib/grumlin/order.rb +1 -5
- data/lib/grumlin/pop.rb +1 -5
- data/lib/grumlin/request_dispatcher.rb +1 -1
- data/lib/grumlin/step.rb +1 -1
- data/lib/grumlin/sugar.rb +3 -17
- data/lib/grumlin/t.rb +1 -5
- data/lib/grumlin/test/rspec/gremlin_context.rb +7 -1
- data/lib/grumlin/transport.rb +2 -2
- data/lib/grumlin/u.rb +1 -6
- data/lib/grumlin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea9263ebc4f6303d3dc02ccd39c8dd04f2b46b434456edad4466a19ebe7dede2
|
4
|
+
data.tar.gz: 84205bc8a2568987933d6cce5c576cbbf298700659b31d7435ecac1fde030029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fc512adc3e110cc6a6ed2f348a24b888b5f5443d566eb1f57bb3b56dad60529390f1c4c52b1391296f75a1ea4cd79dc70eb427c3f57b4bf4f4c6417e54bbe95
|
7
|
+
data.tar.gz: 36029a741e2d89654cbb5a9ecd28213c7122e3ecc35cd030baa320af71bd238560d1e671a8b9d2aa1f4b40938d1787679b2166733b0ebc429d5a5a113142d3b2
|
data/.github/workflows/main.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -7,24 +7,44 @@ require:
|
|
7
7
|
- rubocop-performance
|
8
8
|
- rubocop-rspec
|
9
9
|
|
10
|
-
Style/StringLiterals:
|
11
|
-
Enabled: true
|
12
|
-
EnforcedStyle: double_quotes
|
13
|
-
|
14
|
-
Style/StringLiteralsInInterpolation:
|
15
|
-
Enabled: true
|
16
|
-
EnforcedStyle: double_quotes
|
17
|
-
|
18
|
-
Style/Documentation:
|
19
|
-
Enabled: false
|
20
|
-
|
21
10
|
Layout/LineLength:
|
22
11
|
Max: 120
|
12
|
+
Exclude:
|
13
|
+
- spec/**/*_spec.rb
|
23
14
|
|
24
15
|
Metrics/BlockLength:
|
25
16
|
Exclude:
|
26
17
|
- spec/**/*_spec.rb
|
27
18
|
|
19
|
+
Metrics/MethodLength:
|
20
|
+
Max: 20
|
21
|
+
|
22
|
+
Metrics/ParameterLists:
|
23
|
+
Max: 6
|
24
|
+
|
25
|
+
Naming/MethodName:
|
26
|
+
IgnoredPatterns:
|
27
|
+
- toList
|
28
|
+
- inVLabel
|
29
|
+
- outVLabel
|
30
|
+
- inV
|
31
|
+
- outV
|
32
|
+
|
33
|
+
Naming/VariableName:
|
34
|
+
AllowedIdentifiers:
|
35
|
+
- inV
|
36
|
+
- outV
|
37
|
+
- inVLabel
|
38
|
+
- outVLabel
|
39
|
+
|
40
|
+
Naming/MethodParameterName:
|
41
|
+
AllowedNames:
|
42
|
+
- id
|
43
|
+
- inV
|
44
|
+
- outV
|
45
|
+
- inVLabel
|
46
|
+
- outVLabel
|
47
|
+
|
28
48
|
RSpec/NamedSubject:
|
29
49
|
Enabled: false
|
30
50
|
|
@@ -34,5 +54,26 @@ RSpec/NestedGroups:
|
|
34
54
|
RSpec/ExampleLength:
|
35
55
|
Enabled: false
|
36
56
|
|
57
|
+
RSpec/MultipleExpectations:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
RSpec/DescribeClass:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/WordArray:
|
64
|
+
Exclude:
|
65
|
+
- spec/**/*_spec.rb
|
66
|
+
|
67
|
+
Style/StringLiterals:
|
68
|
+
Enabled: true
|
69
|
+
EnforcedStyle: double_quotes
|
70
|
+
|
71
|
+
Style/StringLiteralsInInterpolation:
|
72
|
+
Enabled: true
|
73
|
+
EnforcedStyle: double_quotes
|
74
|
+
|
75
|
+
Style/Documentation:
|
76
|
+
Enabled: false
|
77
|
+
|
37
78
|
Style/MultilineBlockChain:
|
38
|
-
Enabled: false
|
79
|
+
Enabled: false
|
data/Gemfile.lock
CHANGED
data/lib/async/channel.rb
CHANGED
data/lib/grumlin/client.rb
CHANGED
data/lib/grumlin/edge.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# rubocop:disable Naming/VariableName,Naming/MethodParameterName,Naming/MethodName
|
4
3
|
module Grumlin
|
5
4
|
class Edge
|
6
5
|
attr_reader :label, :id, :inVLabel, :outVLabel, :inV, :outV
|
7
6
|
|
8
|
-
def initialize(label:, id:, inVLabel:, outVLabel:, inV:, outV:)
|
7
|
+
def initialize(label:, id:, inVLabel:, outVLabel:, inV:, outV:)
|
9
8
|
@label = label
|
10
9
|
@id = Typing.cast(id)
|
11
10
|
@inVLabel = inVLabel
|
@@ -24,4 +23,3 @@ module Grumlin
|
|
24
23
|
alias to_s inspect
|
25
24
|
end
|
26
25
|
end
|
27
|
-
# rubocop:enable Naming/MethodParameterName,Naming/VariableName,Naming/MethodName
|
data/lib/grumlin/order.rb
CHANGED
@@ -2,12 +2,10 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module Order
|
5
|
-
|
5
|
+
class << self
|
6
6
|
DESC = { "@type": "g:Order", "@value": "desc" }.freeze
|
7
7
|
ASC = { "@type": "g:Order", "@value": "desc" }.freeze
|
8
8
|
|
9
|
-
extend self # rubocop:disable Style/ModuleFunction
|
10
|
-
|
11
9
|
def asc
|
12
10
|
ASC
|
13
11
|
end
|
@@ -16,7 +14,5 @@ module Grumlin
|
|
16
14
|
DESC
|
17
15
|
end
|
18
16
|
end
|
19
|
-
|
20
|
-
extend Order
|
21
17
|
end
|
22
18
|
end
|
data/lib/grumlin/pop.rb
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module Pop
|
5
|
-
|
6
|
-
extend self # rubocop:disable Style/ModuleFunction
|
7
|
-
|
5
|
+
class << self
|
8
6
|
FIRST = { "@type": "g:Pop", "@value": "first" }.freeze
|
9
7
|
LAST = { "@type": "g:Pop", "@value": "last" }.freeze
|
10
8
|
ALL = { "@type": "g:Pop", "@value": "all" }.freeze
|
@@ -26,7 +24,5 @@ module Grumlin
|
|
26
24
|
MIXED
|
27
25
|
end
|
28
26
|
end
|
29
|
-
|
30
|
-
extend Pop
|
31
27
|
end
|
32
28
|
end
|
@@ -36,7 +36,7 @@ module Grumlin
|
|
36
36
|
|
37
37
|
# builds a response object, when it's ready sends it to the client via a channel
|
38
38
|
# TODO: sometimes response does not include requestID, no idea how to handle it so far.
|
39
|
-
def add_response(response) # rubocop:disable Metrics/AbcSize
|
39
|
+
def add_response(response) # rubocop:disable Metrics/AbcSize
|
40
40
|
request_id = response[:requestId]
|
41
41
|
raise "ERROR" unless ongoing_request?(request_id)
|
42
42
|
|
data/lib/grumlin/step.rb
CHANGED
data/lib/grumlin/sugar.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module Sugar
|
5
|
-
# TODO: how to use it in specs?
|
6
5
|
HELPERS = [
|
7
6
|
Grumlin::U,
|
8
7
|
Grumlin::T,
|
@@ -12,25 +11,12 @@ module Grumlin
|
|
12
11
|
].freeze
|
13
12
|
|
14
13
|
def self.included(base)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
module ClassMethods
|
19
|
-
def const_missing(name)
|
20
|
-
helper = HELPERS.find { |h| h.const_defined?(name) }
|
21
|
-
super if helper.nil?
|
22
|
-
|
23
|
-
const_set(name, helper)
|
14
|
+
HELPERS.each do |helper|
|
15
|
+
name = helper.name.split("::").last
|
16
|
+
base.const_set(name, helper)
|
24
17
|
end
|
25
18
|
end
|
26
19
|
|
27
|
-
def const_missing(name)
|
28
|
-
helper = HELPERS.find { |h| h.const_defined?(name) }
|
29
|
-
super if helper.nil?
|
30
|
-
|
31
|
-
const_set(name, helper)
|
32
|
-
end
|
33
|
-
|
34
20
|
def __
|
35
21
|
Grumlin::U
|
36
22
|
end
|
data/lib/grumlin/t.rb
CHANGED
@@ -2,12 +2,10 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module T
|
5
|
-
|
5
|
+
class << self
|
6
6
|
T_ID = { :@type => "g:T", :@value => "id" }.freeze # TODO: replace with a class?
|
7
7
|
T_LABEL = { :@type => "g:T", :@value => "label" }.freeze # TODO: replace with a class?
|
8
8
|
|
9
|
-
extend self # rubocop:disable Style/ModuleFunction
|
10
|
-
|
11
9
|
def id
|
12
10
|
T_ID
|
13
11
|
end
|
@@ -16,7 +14,5 @@ module Grumlin
|
|
16
14
|
T_LABEL
|
17
15
|
end
|
18
16
|
end
|
19
|
-
|
20
|
-
extend T
|
21
17
|
end
|
22
18
|
end
|
@@ -8,8 +8,14 @@ module Grumlin
|
|
8
8
|
|
9
9
|
::RSpec.shared_context GremlinContext do
|
10
10
|
include GremlinContext
|
11
|
+
include Grumlin::Sugar
|
11
12
|
|
12
|
-
|
13
|
+
before do
|
14
|
+
Grumlin::Sugar::HELPERS.each do |helper|
|
15
|
+
name = helper.name.split("::").last
|
16
|
+
stub_const(name, helper)
|
17
|
+
end
|
18
|
+
end
|
13
19
|
|
14
20
|
after do
|
15
21
|
Grumlin.config.default_pool.close
|
data/lib/grumlin/transport.rb
CHANGED
@@ -20,7 +20,7 @@ module Grumlin
|
|
20
20
|
@connected
|
21
21
|
end
|
22
22
|
|
23
|
-
def connect # rubocop:disable Metrics/
|
23
|
+
def connect # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
24
24
|
raise AlreadyConnectedError if connected?
|
25
25
|
|
26
26
|
@connection = Async::WebSocket::Client.connect(Async::HTTP::Endpoint.parse(@url), **@client_options)
|
@@ -56,7 +56,7 @@ module Grumlin
|
|
56
56
|
@request_channel << message
|
57
57
|
end
|
58
58
|
|
59
|
-
def close
|
59
|
+
def close
|
60
60
|
return unless connected?
|
61
61
|
|
62
62
|
@request_channel.close
|
data/lib/grumlin/u.rb
CHANGED
@@ -2,17 +2,12 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
module U
|
5
|
-
|
6
|
-
extend self # rubocop:disable Style/ModuleFunction
|
7
|
-
|
5
|
+
class << self
|
8
6
|
%w[addV V has count out values unfold].each do |step|
|
9
7
|
define_method step do |*args|
|
10
8
|
AnonymousStep.new(step, *args)
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
14
|
-
|
15
|
-
# TODO: add alias __
|
16
|
-
extend U
|
17
12
|
end
|
18
13
|
end
|
data/lib/grumlin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grumlin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Sinyavskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-pool
|