boltless 1.6.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 810df6c0da5c601e9c8474ba2c77c8ffe4890aad9b622bac10371d83ed195cea
4
- data.tar.gz: 06452e8b89e0223b0768b6c31d2f6f882acca5eb8849c44a5fe3b7782afcb34b
3
+ metadata.gz: 451b84cf72d19b6d8ac3b3f392c7575d980c56588b0364a6792759b84126e8c4
4
+ data.tar.gz: 569c835011a6dca3fff0fc26465ef7069931c054877133baff35f2762968e568
5
5
  SHA512:
6
- metadata.gz: 39b8c31d2de8ce6e344cac27cc8179e23a83175d1e8d500b8bee6e20815a7d62f2b3771640670918e37c749acb4f14afb4bb10bbb5779f90f84589e232592298
7
- data.tar.gz: c8973fb129dec86b78c76f40c6f9529d64a8899f1a5c5026d7e38677d194a4421f2b37c96ae0d6d7c70ea01892d09a74855357b7477fb8ce3f3d8c862b5905f8
6
+ metadata.gz: 5afae9aa76e195e244ee0ad71020b9a060005187d5ca24ff9ed7bf89e818b0928025b8090025a1e5c0927d477ff8d4b804782a82efae2a4ff260a19f55152595
7
+ data.tar.gz: a93ddd308706c876facf444f8f90407fa76164a26cea90de441063da68ad26cf63b1f2e2a10cc487c1a7e65f1aa0a1cb6f444aba31dad12a491e9f9190133df1
data/Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
- FROM hausgold/ruby:2.7
2
- MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
1
+ FROM hausgold/ruby:3.2
2
+ LABEL org.opencontainers.image.authors="containers@hausgold.de"
3
3
 
4
4
  # Update system gem
5
- RUN gem update --system '3.4.22'
5
+ RUN gem update --system '3.6.9'
6
6
 
7
7
  # Install system packages and the latest bundler
8
8
  RUN apt-get update -yqqq && \
@@ -11,7 +11,7 @@ RUN apt-get update -yqqq && \
11
11
  ca-certificates \
12
12
  bash-completion inotify-tools && \
13
13
  echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \
14
- gem install bundler -v '~> 2.4.22' --no-document --no-prerelease
14
+ gem install bundler -v '~> 2.6.9' --no-document --no-prerelease
15
15
 
16
16
  # Add new web user
17
17
  RUN mkdir /app && \
data/Gemfile CHANGED
@@ -10,14 +10,14 @@ gemspec
10
10
  # Development dependencies
11
11
  gem 'appraisal', '~> 2.4'
12
12
  gem 'benchmark-ips', '~> 2.10'
13
- gem 'bundler', '~> 2.3'
14
- gem 'countless', '~> 1.1'
13
+ gem 'bundler', '~> 2.6'
14
+ gem 'countless', '~> 2.0'
15
15
  gem 'guard-rspec', '~> 4.7'
16
16
  gem 'irb', '~> 1.2'
17
17
  gem 'rspec', '~> 3.12'
18
- gem 'rubocop', '~> 1.28'
19
- gem 'rubocop-rails', '~> 2.14'
20
- gem 'rubocop-rspec', '~> 2.10'
18
+ gem 'rubocop'
19
+ gem 'rubocop-rails'
20
+ gem 'rubocop-rspec'
21
21
  gem 'simplecov', '>= 0.22'
22
22
  gem 'yard', '>= 0.9.28'
23
23
  gem 'yard-activesupport-concern', '>= 0.0.1'
data/Makefile CHANGED
@@ -120,7 +120,7 @@ test-style: \
120
120
  test-style-ruby:
121
121
  # Run the static code analyzer (rubocop)
122
122
  @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a \
123
- || ($(TEST) $$($(RUBY_VERSION)) != '2.7' && true))
123
+ || ($(TEST) $$($(RUBY_VERSION)) != '3.2' && true))
124
124
 
125
125
  clean:
126
126
  # Clean the dependencies
data/docker-compose.yml CHANGED
@@ -1,4 +1,3 @@
1
- version: "3"
2
1
  services:
3
2
  neo4j:
4
3
  image: hausgold/neo4j:4.4
@@ -4,8 +4,8 @@ module Boltless
4
4
  module Extensions
5
5
  # A top-level gem-module extension to add easy-to-use connection pool.
6
6
  #
7
- # rubocop:disable Metrics/BlockLength because this is how
8
- # an +ActiveSupport::Concern+ looks like
7
+ # rubocop:disable Metrics/BlockLength -- because this is how an
8
+ # +ActiveSupport::Concern+ looks like
9
9
  module ConnectionPool
10
10
  extend ActiveSupport::Concern
11
11
 
@@ -21,9 +21,8 @@ module Boltless
21
21
  #
22
22
  # @raise [HTTP::Error] in case the upstream server did not come up
23
23
  #
24
- # rubocop:disable Metrics/MethodLength because of the
25
- # retry logic
26
- # rubocop:disable Metrics/AbcSize dito
24
+ # rubocop:disable Metrics/MethodLength -- because of the retry logic
25
+ # rubocop:disable Metrics/AbcSize -- ditto
27
26
  def wait_for_server!(connection)
28
27
  # Check if the server already accepted connections
29
28
  return connection if @upstream_is_ready
@@ -75,9 +74,9 @@ module Boltless
75
74
  # @see https://github.com/mperham/connection_pool
76
75
  # @return [::ConnectionPool] the connection pool instance
77
76
  #
78
- # rubocop:disable Metrics/MethodLength because of the
79
- # connection configuration
80
- # rubocop:disable Metrics/AbcSize dito
77
+ # rubocop:disable Metrics/MethodLength -- because of the connection
78
+ # configuration
79
+ # rubocop:disable Metrics/AbcSize -- ditto
81
80
  def connection_pool
82
81
  @connection_pool ||= begin
83
82
  conf = Boltless.configuration
@@ -4,8 +4,8 @@ module Boltless
4
4
  module Extensions
5
5
  # A top-level gem-module extension for neo4j operations.
6
6
  #
7
- # rubocop:disable Metrics/BlockLength because this is how
8
- # an +ActiveSupport::Concern+ looks like
7
+ # rubocop:disable Metrics/BlockLength -- because this is how an
8
+ # +ActiveSupport::Concern+ looks like
9
9
  module Operations
10
10
  extend ActiveSupport::Concern
11
11
 
@@ -16,11 +16,11 @@ module Boltless
16
16
  #
17
17
  # @param database [String, Symbol] the neo4j database to use
18
18
  #
19
- # rubocop:disable Metrics/MethodLength because of
20
- # multiple transactions
21
- # rubocop:disable Metrics/AbcSize because of the extra transaction
22
- # handlings (we cannot do multiple structural changes in a single
23
- # transaction)
19
+ # rubocop:disable Metrics/MethodLength -- because of multiple
20
+ # transactions
21
+ # rubocop:disable Metrics/AbcSize -- because of the extra transaction
22
+ # handlings (we cannot do multiple structural changes in
23
+ # a single transaction)
24
24
  def clear_database!(database: Boltless.configuration.default_db)
25
25
  logger.warn('Clear neo4j database ..')
26
26
 
@@ -100,7 +100,7 @@ module Boltless
100
100
  # @param on [String] the collection of nodes/properties to index
101
101
  # @param database [String, Symbol] the neo4j database to use
102
102
  #
103
- # rubocop:disable Metrics/ParameterLists because of the various
103
+ # rubocop:disable Metrics/ParameterLists -- because of the various
104
104
  # configuration options of a neo4j index
105
105
  def add_index(name:, for:, on:, type: :btree, options: nil,
106
106
  database: Boltless.configuration.default_db)
@@ -5,9 +5,9 @@ module Boltless
5
5
  # A top-level gem-module extension to add easy-to-use methods to use the
6
6
  # Cypher transactional API.
7
7
  #
8
- # rubocop:disable Metrics/BlockLength because this is how
9
- # an +ActiveSupport::Concern+ looks like
10
- # rubocop:disable Metrics/ModuleLength dito
8
+ # rubocop:disable Metrics/BlockLength -- because this is how an
9
+ # +ActiveSupport::Concern+ looks like
10
+ # rubocop:disable Metrics/ModuleLength -- ditto
11
11
  module Transactions
12
12
  extend ActiveSupport::Concern
13
13
 
@@ -149,8 +149,8 @@ module Boltless
149
149
  #
150
150
  # @raise [Mixed] when an exception occurs inside the user given block
151
151
  #
152
- # rubocop:disable Metrics/MethodLength because of the extra
153
- # error handling
152
+ # rubocop:disable Metrics/MethodLength -- because of the extra error
153
+ # handling
154
154
  def one_shot(access_mode = :write,
155
155
  database: Boltless.configuration.default_db,
156
156
  raw_results: false)
@@ -196,7 +196,7 @@ module Boltless
196
196
  # @raise [Mixed] when an exception occurs inside the user given
197
197
  # block, we re-raise it
198
198
  #
199
- # rubocop:disable Metrics/MethodLength because this is the workflow
199
+ # rubocop:disable Metrics/MethodLength -- because this is the workflow
200
200
  def transaction!(access_mode = :write,
201
201
  database: Boltless.configuration.default_db,
202
202
  raw_results: false)
@@ -251,7 +251,7 @@ module Boltless
251
251
  # @raise [Mixed] when an exception occurs inside the user given
252
252
  # block, we re-raise it
253
253
  #
254
- # rubocop:disable Metrics/MethodLength because this is the workflow
254
+ # rubocop:disable Metrics/MethodLength -- because this is the workflow
255
255
  def transaction(access_mode = :write,
256
256
  database: Boltless.configuration.default_db,
257
257
  raw_results: false)
@@ -4,8 +4,8 @@ module Boltless
4
4
  module Extensions
5
5
  # A top-level gem-module extension add helpers and utilites.
6
6
  #
7
- # rubocop:disable Metrics/BlockLength because this is how
8
- # an +ActiveSupport::Concern+ looks like
7
+ # rubocop:disable Metrics/BlockLength -- because this is how an
8
+ # +ActiveSupport::Concern+ looks like
9
9
  module Utilities
10
10
  extend ActiveSupport::Concern
11
11
 
@@ -39,9 +39,9 @@ module Boltless
39
39
  # template
40
40
  # @return [String] the built Cypher query
41
41
  #
42
- # rubocop:disable Metrics/MethodLength because of the various
42
+ # rubocop:disable Metrics/MethodLength -- because of the various
43
43
  # replacement strategies
44
- # rubocop:disable Metrics/AbcSize dito
44
+ # rubocop:disable Metrics/AbcSize -- ditto
45
45
  def build_cypher(**replacements)
46
46
  # Process the given replacements in order to prevent Cypher
47
47
  # injections from user given values
@@ -157,7 +157,7 @@ module Boltless
157
157
  # @param cypher [String] the Cypher query to check
158
158
  # @return [Symbol] the ANSI color name
159
159
  #
160
- # rubocop:disable Metrics/CyclomaticComplexity because of the
160
+ # rubocop:disable Metrics/CyclomaticComplexity -- because of the
161
161
  # various conditions
162
162
  def cypher_logging_color(cypher)
163
163
  cypher = cypher.to_s.downcase.lines.map(&:strip)
@@ -5,8 +5,8 @@ module Boltless
5
5
  # persistent connection for its whole runtime. This connection is strictly
6
6
  # owned by a single request object. It is not safe to share it.
7
7
  #
8
- # rubocop:disable Metrics/ClassLength because of the isolated
9
- # request abstraction
8
+ # rubocop:disable Metrics/ClassLength -- because of the isolated request
9
+ # abstraction
10
10
  class Request
11
11
  class << self
12
12
  # Convert a multiple Cypher queries and +Hash+ arguments into multiple
@@ -102,9 +102,9 @@ module Boltless
102
102
  # @raise [Errors::TransactionBeginError] when we fail to start a
103
103
  # new transaction
104
104
  #
105
- # rubocop:disable Metrics/MethodLength because of the error
106
- # handlings and transaction identifier parsing
107
- # rubocop:disable Metrics/AbcSize dito
105
+ # rubocop:disable Metrics/MethodLength -- because of the error handlings
106
+ # and transaction identifier parsing
107
+ # rubocop:disable Metrics/AbcSize -- ditto
108
108
  def begin_transaction
109
109
  log_query(:begin, Request.statement_payload('BEGIN')) do
110
110
  handle_transport_errors do
@@ -234,9 +234,9 @@ module Boltless
234
234
  # error in the response, so we assume the transaction was rolled back
235
235
  # by neo4j
236
236
  #
237
- # rubocop:disable Metrics/MethodLength because of the result
238
- # handling (error, raw result, restructured result)
239
- # rubocop:disable Metrics/AbcSize dito
237
+ # rubocop:disable Metrics/MethodLength -- because of the result handling
238
+ # (error, raw result, restructured result)
239
+ # rubocop:disable Metrics/AbcSize -- ditto
240
240
  def handle_response_body(res, tx_id: nil)
241
241
  # Parse the response body as a whole, which is returned by
242
242
  # the configured raw response handler
@@ -306,8 +306,8 @@ module Boltless
306
306
  # @yield the given user block
307
307
  # @return [Mixed] the result of the user given block
308
308
  #
309
- # rubocop:disable Metrics/MethodLength because of the
310
- # configuration handling
309
+ # rubocop:disable Metrics/MethodLength -- because of the configuration
310
+ # handling
311
311
  def log_query(tx_id, *statements)
312
312
  # When no query logging is enabled, we won't do it
313
313
  enabled = Boltless.configuration.query_log_enabled
@@ -357,9 +357,9 @@ module Boltless
357
357
  # @param statements [Array<Hash>] the Cypher statements to run
358
358
  # @return [String] the assembled logging string
359
359
  #
360
- # rubocop:disable Metrics/MethodLength because of the complex
361
- # logging string assembling/formatting
362
- # rubocop:disable Metrics/AbcSize dito
360
+ # rubocop:disable Metrics/MethodLength -- because of the complex logging
361
+ # string assembling/formatting
362
+ # rubocop:disable Metrics/AbcSize -- ditto
363
363
  def generate_log_str(tx_id, duration, *statements)
364
364
  dur = "(#{duration}ms)".colorize(color: :magenta, mode: :bold) \
365
365
  if duration
@@ -65,9 +65,9 @@ module Boltless
65
65
  #
66
66
  # @param pp [PP] a pretty printer instance to use
67
67
  #
68
- # rubocop:disable Metrics/MethodLength because of the pretty
69
- # printing logic
70
- # rubocop:disable Metrics/AbcSize dito
68
+ # rubocop:disable Metrics/MethodLength -- because of the pretty printing
69
+ # logic
70
+ # rubocop:disable Metrics/AbcSize -- ditto
71
71
  def pretty_print(pp)
72
72
  pp.object_group(self) do
73
73
  pp.breakable
@@ -76,7 +76,7 @@ module Boltless
76
76
  pp.comma_breakable
77
77
 
78
78
  pp.text('rows=')
79
- if rows.count > 1
79
+ if rows.many?
80
80
  pp.group(1, '[', ']') do
81
81
  pp.pp(first)
82
82
  pp.comma_breakable
@@ -3,8 +3,8 @@
3
3
  module Boltless
4
4
  # A lightweight result row, used for convenient result data access.
5
5
  #
6
- # rubocop:disable Lint/StructNewOverride because we have an
7
- # own implementation for +#values+
6
+ # rubocop:disable Lint/StructNewOverride -- because we have an own
7
+ # implementation for +#values+
8
8
  ResultRow = Struct.new(:result, :values, :meta, :graph) do
9
9
  # A simple shortcut to easily access the row columns
10
10
  delegate :columns, to: :result
@@ -59,6 +59,9 @@ module Boltless
59
59
  #
60
60
  # @raise [Errors::RequestError] when an error occurs, see request object
61
61
  # for fine-grained details
62
+ #
63
+ # rubocop:disable Naming/PredicateMethod -- because this method performs an
64
+ # action, not a predicate check (bool is for error signaling)
62
65
  def begin!
63
66
  # We do not allow messing around in wrong states
64
67
  unless @raw_state == :not_yet_started
@@ -70,6 +73,7 @@ module Boltless
70
73
  @raw_state = :open
71
74
  true
72
75
  end
76
+ # rubocop:enable Naming/PredicateMethod
73
77
 
74
78
  # Begin a new transaction. We rescue all errors transparently.
75
79
  #
@@ -180,6 +184,9 @@ module Boltless
180
184
  #
181
185
  # @raise [Errors::RequestError] when an error occurs, see request object
182
186
  # for fine-grained details
187
+ #
188
+ # rubocop:disable Naming/PredicateMethod -- because this method performs
189
+ # an action, not a predicate check (bool is for error signaling)
183
190
  def rollback!
184
191
  # We do not allow messing around in wrong states
185
192
  raise Errors::TransactionInBadStateError, 'Transaction not open' \
@@ -189,6 +196,7 @@ module Boltless
189
196
  @raw_state = :closed
190
197
  true
191
198
  end
199
+ # rubocop:enable Naming/PredicateMethod
192
200
 
193
201
  # Rollback this transaction. We rescue all errors transparently.
194
202
  #
@@ -3,7 +3,7 @@
3
3
  # The gem version details.
4
4
  module Boltless
5
5
  # The version of the +boltless+ gem
6
- VERSION = '1.6.0'
6
+ VERSION = '2.0.0'
7
7
 
8
8
  class << self
9
9
  # Returns the version of gem as a string.
data/lib/boltless.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'zeitwerk'
4
+ require 'base64'
4
5
  require 'http'
5
6
  require 'connection_pool'
6
7
  require 'oj'
@@ -23,7 +23,7 @@ RSpec.describe Boltless::Extensions::ConnectionPool do
23
23
  Base64.decode64(options.headers['Authorization'].split.last).split(':')
24
24
  end
25
25
 
26
- # rubocop:disable RSpec/IdenticalEqualityAssertion because we want to
26
+ # rubocop:disable RSpec/IdenticalEqualityAssertion -- because we want to
27
27
  # check for a memoized result
28
28
  it 'returns a memoized connection pool instance' do
29
29
  expect(described_class.connection_pool).to \
@@ -292,9 +292,9 @@ RSpec.describe Boltless::Extensions::Transactions do
292
292
  end
293
293
 
294
294
  context 'with intermediate results' do
295
- # rubocop:disable RSpec/MultipleExpectations because of the
296
- # in-block testing
297
- # rubocop:disable RSpec/ExampleLength dito
295
+ # rubocop:disable RSpec/MultipleExpectations -- because of the in-block
296
+ # testing
297
+ # rubocop:disable RSpec/ExampleLength -- ditto
298
298
  it 'allows direct access to each result' do
299
299
  Boltless.transaction! do |tx|
300
300
  cypher, args = fetch_date_statement
@@ -399,9 +399,9 @@ RSpec.describe Boltless::Extensions::Transactions do
399
399
  end
400
400
 
401
401
  context 'with intermediate results' do
402
- # rubocop:disable RSpec/MultipleExpectations because of the
403
- # in-block testing
404
- # rubocop:disable RSpec/ExampleLength dito
402
+ # rubocop:disable RSpec/MultipleExpectations -- because of the in-block
403
+ # testing
404
+ # rubocop:disable RSpec/ExampleLength -- ditto
405
405
  it 'allows direct access to each result' do
406
406
  Boltless.transaction do |tx|
407
407
  cypher, args = fetch_date_statement
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # rubocop:disable RSpec/NestedGroups because nesting makes sense here
5
+ # rubocop:disable RSpec/NestedGroups -- because nesting makes sense here
6
6
  RSpec.describe Boltless::Request do
7
7
  let(:new_instance) { ->(**args) { described_class.new(connection, **args) } }
8
8
  let(:instance) { new_instance.call }
data/spec/spec_helper.rb CHANGED
@@ -9,7 +9,7 @@ require 'yaml'
9
9
  require 'boltless'
10
10
 
11
11
  # Load all support helpers and shared examples
12
- Dir[File.join(__dir__, 'support', '**', '*.rb')].sort.each { |f| require f }
12
+ Dir[File.join(__dir__, 'support', '**', '*.rb')].each { |f| require f }
13
13
 
14
14
  RSpec.configure do |config|
15
15
  # Enable flags like --only-failures and --next-failure
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Print some information
4
+ #
5
+ # rubocop:disable Rails/Output -- because we want to write to stdout here
4
6
  puts
5
7
  puts <<DESC
6
8
  -------------- Versions --------------
@@ -9,3 +11,4 @@ puts <<DESC
9
11
  --------------------------------------
10
12
  DESC
11
13
  puts
14
+ # rubocop:enable Rails/Output
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boltless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-01-30 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -16,14 +15,28 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '6.1'
18
+ version: '7.1'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '6.1'
25
+ version: '7.1'
26
+ - !ruby/object:Gem::Dependency
27
+ name: base64
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.2.0
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: colorize
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -175,7 +188,6 @@ files:
175
188
  - spec/spec_helper.rb
176
189
  - spec/support/helpers.rb
177
190
  - spec/support/suite_context.rb
178
- homepage:
179
191
  licenses:
180
192
  - MIT
181
193
  metadata:
@@ -184,7 +196,6 @@ metadata:
184
196
  changelog_uri: https://github.com/hausgold/boltless/blob/master/CHANGELOG.md
185
197
  bug_tracker_uri: https://github.com/hausgold/boltless/issues
186
198
  documentation_uri: https://www.rubydoc.info/gems/boltless
187
- post_install_message:
188
199
  rdoc_options: []
189
200
  require_paths:
190
201
  - lib
@@ -192,15 +203,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
203
  requirements:
193
204
  - - ">="
194
205
  - !ruby/object:Gem::Version
195
- version: '2.7'
206
+ version: '3.2'
196
207
  required_rubygems_version: !ruby/object:Gem::Requirement
197
208
  requirements:
198
209
  - - ">="
199
210
  - !ruby/object:Gem::Version
200
211
  version: '0'
201
212
  requirements: []
202
- rubygems_version: 3.4.22
203
- signing_key:
213
+ rubygems_version: 3.6.9
204
214
  specification_version: 4
205
215
  summary: neo4j driver, via the HTTP API
206
216
  test_files: []