grumlin 0.12.0 → 0.12.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b01ddca4a13e70f6ab86875cd635655ebec77e877f374b0df9c8021f61ae7753
4
- data.tar.gz: c25ccd742c5c40ba797f92fe39176cf2605d485506e56a1a1e8852bbbc11ab0b
3
+ metadata.gz: d5ddac28eac1cb06e427f52d8639b8a75bdc9b4c867aa353199a05a51d847696
4
+ data.tar.gz: 3ac77adec54d09b74ab1b620de484205cfbee52249cfa6e4529a5b988b228537
5
5
  SHA512:
6
- metadata.gz: '042067879c5ae297f5d3a06f2f0a7302cccb5dc0e362fcdb15820f74e8aec6b1d9f5cd085bcfdbfe3d2f671fe8cae24b8da38c03a89e4a645c42a31d60218005'
7
- data.tar.gz: b740805e7ab51fc7d45aeb0a1cc11062778561439a51395de1cdf1bd771a8745768c17e4e0b2db4daf2382ba6008f898e469c3f474d4738775c72a99c47cdd75
6
+ metadata.gz: f5ced6bb8aca8250daba19e059bcf36dc5fb3fe31ded7b552ca297f858edd82203b1b178196a1b448952819a112d44c40ab64e85aeb9f0f5469e44f728a5a539
7
+ data.tar.gz: 6258168a26d952f31bb2087fef044914efb6c51d81355611954c3999d65a7e62f38bae0654da7f4213a40513093240acf673156547033bbf83de37f17313552f
@@ -65,7 +65,7 @@ jobs:
65
65
  mkdir ~/.gem
66
66
  cat << EOF > ~/.gem/credentials
67
67
  ---
68
- :rubygems_api_key: ${{ secrets.rubygems_api_key }}
68
+ :rubygems_api_key: ${{ secrets.RUBYGEMS_TOKEN }}
69
69
  EOF
70
70
  chmod 0600 /home/runner/.gem/credentials
71
71
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grumlin (0.12.0)
4
+ grumlin (0.12.4)
5
5
  async-pool (~> 0.3)
6
6
  async-websocket (~> 0.19)
7
7
  oj (~> 3.12)
@@ -64,7 +64,7 @@ GEM
64
64
  nio4r (2.5.8)
65
65
  nokogiri (1.11.7-x86_64-linux)
66
66
  racc (~> 1.4)
67
- oj (3.13.6)
67
+ oj (3.13.7)
68
68
  overcommit (0.57.0)
69
69
  childprocess (>= 0.6.3, < 5)
70
70
  iniparse (~> 1.4)
data/README.md CHANGED
@@ -73,6 +73,52 @@ class MyRepository
73
73
  end
74
74
  ```
75
75
 
76
+ #### IRB
77
+
78
+ An example of how to start an IRB session with support for executing gremlin queries:
79
+
80
+ ```ruby
81
+ Async do
82
+ include Grumlin::Sugar
83
+
84
+ IRB.start
85
+ ensure
86
+ Grumlin.close
87
+ end
88
+ ```
89
+
90
+ Please check out [bin/console](bin/console) for full source. A similar trick may be applied to PRY.
91
+
92
+ #### Rails console
93
+
94
+ In order to make it possible to execute gremlin queries from the rails console you need to define
95
+ a custom console class. It should look somehow like
96
+
97
+ ```ruby
98
+ class MyRailsConsole
99
+ def self.start
100
+ IRB::WorkSpace.prepend(Rails::Console::BacktraceCleaner)
101
+ IRB::ExtendCommandBundle.include(Rails::ConsoleMethods)
102
+
103
+ Async do
104
+ include Grumlin::Sugar
105
+
106
+ IRB.setup(binding.source_location[0], argv: [])
107
+ workspace = IRB::WorkSpace.new(binding)
108
+
109
+ IRB::Irb.new(workspace).run(IRB.conf)
110
+ ensure
111
+ Grumlin.close
112
+ end
113
+ end
114
+ end
115
+ ```
116
+
117
+ Then you need to reference it in your application.rb:
118
+ ```ruby
119
+ config.console = MyRailsConsole
120
+ ```
121
+
76
122
  #### Testing
77
123
 
78
124
  Grumlin provides a couple of helpers to simplify testing code written with it.
data/bin/console CHANGED
@@ -3,7 +3,9 @@
3
3
 
4
4
  require "bundler/setup"
5
5
  require "grumlin"
6
+
6
7
  require "irb"
8
+ require "irb/completion"
7
9
 
8
10
  Grumlin.configure do |config|
9
11
  config.url = ENV["GREMLIN_URL"] || "ws://localhost:8182/gremlin"
@@ -12,12 +14,7 @@ end
12
14
  Async do
13
15
  include Grumlin::Sugar
14
16
 
15
- IRB.setup(nil)
16
- workspace = IRB::WorkSpace.new(binding)
17
- irb = IRB::Irb.new(workspace)
18
- irb.eval_input
19
- rescue StandardError
20
- raise
17
+ IRB.start
21
18
  ensure
22
19
  Grumlin.close
23
20
  end
@@ -5,9 +5,10 @@ module Grumlin
5
5
  attr_reader :name, :args, :previous_step
6
6
 
7
7
  # TODO: add other steps
8
- SUPPORTED_STEPS = %i[E V addE addV as both by coalesce count dedup drop elementMap emit fold from group groupCount
9
- has hasId hasLabel hasNot id in inV label limit not order out outE path project property range
10
- repeat select skip tail to unfold union until valueMap values where with].freeze
8
+ SUPPORTED_STEPS = %i[E V addE addV as both bothE by coalesce count dedup drop elementMap emit fold from group
9
+ groupCount has hasId hasLabel hasNot id in inE inV is label limit not order out outE path
10
+ project property range repeat select sideEffect skip tail to unfold union until valueMap
11
+ values where with].freeze
11
12
 
12
13
  def initialize(name, *args, previous_step: nil)
13
14
  @name = name
data/lib/grumlin/sugar.rb CHANGED
@@ -2,21 +2,8 @@
2
2
 
3
3
  module Grumlin
4
4
  module Sugar
5
- HELPERS = [
6
- Grumlin::Tools::Order,
7
- Grumlin::Tools::P,
8
- Grumlin::Tools::Pop,
9
- Grumlin::Tools::Scope,
10
- Grumlin::Tools::T,
11
- Grumlin::Tools::U,
12
- Grumlin::Tools::WithOptions
13
- ].freeze
14
-
15
5
  def self.included(base)
16
- HELPERS.each do |helper|
17
- name = helper.name.split("::").last
18
- base.const_set(name, helper)
19
- end
6
+ base.include Grumlin::Tools
20
7
  end
21
8
 
22
9
  def __
@@ -11,9 +11,8 @@ module Grumlin
11
11
  include Grumlin::Sugar
12
12
 
13
13
  before do
14
- Grumlin::Sugar::HELPERS.each do |helper|
15
- name = helper.name.split("::").last
16
- stub_const(name, helper)
14
+ Grumlin::Tools.constants.each do |tool|
15
+ stub_const(tool.to_s, Grumlin::Tools.const_get(tool))
17
16
  end
18
17
  end
19
18
 
@@ -4,8 +4,8 @@ module Grumlin
4
4
  module Tools
5
5
  module U
6
6
  # TODO: add other start steps
7
- SUPPORTED_STEPS = %i[V addV count fold has id inV label out outV project repeat timeLimit unfold valueMap
8
- values].freeze
7
+ SUPPORTED_STEPS = %i[V addV count drop fold has id in inE inV label out outE outV project repeat timeLimit unfold
8
+ valueMap values].freeze
9
9
 
10
10
  class << self
11
11
  SUPPORTED_STEPS.each do |step|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Grumlin
4
- VERSION = "0.12.0"
4
+ VERSION = "0.12.4"
5
5
  end
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.12.0
4
+ version: 0.12.4
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-09-17 00:00:00.000000000 Z
11
+ date: 2021-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-pool