boltless 1.3.0 → 1.4.0

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: 88dc165632f28b71d32b8fc06b253e66f1e6df7654234cc7a621399a7914b91a
4
- data.tar.gz: 2830e7b2e4fb9dda29b664775b69c32d4d0e173d1497137d7e5a4fc2560cfe5b
3
+ metadata.gz: b6287e2e459d31aa987ecc3836efea0ff864c33ce2b453b89f1cc00d211164fb
4
+ data.tar.gz: f3625712bca97435faacc8a5ee2fe5a047d0dd145c6f12c110a6a922a741fec9
5
5
  SHA512:
6
- metadata.gz: '09a49bdc13725730c55646631a38eb9c9e0d3b22271ee31a7c946ea87014e688327a850ffbf1b346595fc22015c118eda2184f9ec49a5d3b9bb247e291a05960'
7
- data.tar.gz: 8f63a6463ca18b9b7764e3d6e0e27526da64838a8ee20baba3ee63df44de9c122427a4af2d8e8be1e736d92055afa31e1811f51776dc3388c99241d629f99c9c
6
+ metadata.gz: 769a2669a0e8766f82d4520b056fc9afc911902966932d288e715c1b411db6ac04066691b2356043fa974cbe38880a38edeaadd142bd2a6b394b21f12ec883c9
7
+ data.tar.gz: 8792723e1583ebd71c812706e5249536009f36a4cfb6a86c79d1cbb81a0c10e95489ed678a5086f741d644a351768e2e3be95b9939c76c7f285c19ad2c7b1ae6
data/Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
- FROM hausgold/ruby:2.5
1
+ FROM hausgold/ruby:2.7
2
2
  MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
3
3
 
4
4
  # Update system gem
5
- RUN gem update --system '3.3.26'
5
+ RUN gem update --system '3.4.22'
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.3.0' --no-document --no-prerelease
14
+ gem install bundler -v '~> 2.4.22' --no-document --no-prerelease
15
15
 
16
16
  # Add new web user
17
17
  RUN mkdir /app && \
data/Gemfile CHANGED
@@ -6,3 +6,18 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  # Specify your gem's dependencies in boltless.gemspec
8
8
  gemspec
9
+
10
+ # Development dependencies
11
+ gem 'appraisal', '~> 2.4'
12
+ gem 'benchmark-ips', '~> 2.10'
13
+ gem 'bundler', '~> 2.3'
14
+ gem 'countless', '~> 1.1'
15
+ gem 'guard-rspec', '~> 4.7'
16
+ gem 'irb', '~> 1.2'
17
+ gem 'rspec', '~> 3.12'
18
+ gem 'rubocop', '~> 1.28'
19
+ gem 'rubocop-rails', '~> 2.14'
20
+ gem 'rubocop-rspec', '~> 2.10'
21
+ gem 'simplecov', '>= 0.22'
22
+ gem 'yard', '>= 0.9.28'
23
+ gem 'yard-activesupport-concern', '>= 0.0.1'
data/Makefile CHANGED
@@ -16,11 +16,21 @@ VENDOR_DIR ?= vendor/bundle
16
16
  GEMFILES_DIR ?= gemfiles
17
17
 
18
18
  # Host binaries
19
+ AWK ?= awk
19
20
  BASH ?= bash
20
21
  COMPOSE ?= docker-compose
22
+ CP ?= cp
23
+ DOCKER ?= docker
24
+ EXPORT ?= export
25
+ FIND ?= find
26
+ GREP ?= grep
27
+ HEAD ?= head
21
28
  ID ?= id
22
29
  MKDIR ?= mkdir
23
30
  RM ?= rm
31
+ SORT ?= sort
32
+ TEST ?= test
33
+ XARGS ?= xargs
24
34
 
25
35
  # Container binaries
26
36
  APPRAISAL ?= appraisal
@@ -30,6 +40,7 @@ RAKE ?= rake
30
40
  RSPEC ?= rspec
31
41
  RUBOCOP ?= rubocop
32
42
  YARD ?= yard
43
+ RUBY_VERSION := ruby-version
33
44
 
34
45
  # Files
35
46
  GEMFILES ?= $(subst _,-,$(patsubst $(GEMFILES_DIR)/%.gemfile,%,\
@@ -108,7 +119,8 @@ test-style: \
108
119
 
109
120
  test-style-ruby:
110
121
  # Run the static code analyzer (rubocop)
111
- @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a)
122
+ @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a \
123
+ || ($(TEST) $$($(RUBY_VERSION)) != '2.7' && true))
112
124
 
113
125
  clean:
114
126
  # Clean the dependencies
@@ -45,7 +45,7 @@ module Boltless
45
45
  def build_cypher(**replacements)
46
46
  # Process the given replacements in order to prevent Cypher
47
47
  # injections from user given values
48
- replacements = replacements \
48
+ replacements = replacements
49
49
  .stringify_keys
50
50
  .each_with_object({}) do |(key, val), memo|
51
51
  val = prepare_label(val) if key.match?(/_labels?$|^labels?$/)
@@ -75,7 +75,7 @@ module Boltless
75
75
  raise ArgumentError, "Bad labels: #{inputs.inspect}" if list.empty?
76
76
 
77
77
  list.map do |input|
78
- res = input.to_s.underscore.gsub(/-/, '_').camelcase
78
+ res = input.to_s.underscore.gsub('-', '_').camelcase
79
79
  res.match?(/[^a-z0-9]/i) ? "`#{res}`" : res
80
80
  end.sort.uniq.join(':')
81
81
  end
@@ -91,7 +91,7 @@ module Boltless
91
91
  raise ArgumentError, "Bad types: #{inputs.inspect}" if list.empty?
92
92
 
93
93
  list.map do |input|
94
- res = input.to_s.underscore.gsub(/-/, '_').upcase
94
+ res = input.to_s.underscore.gsub('-', '_').upcase
95
95
  res.match?(/[^a-z0-9_]/i) ? "`#{res}`" : res
96
96
  end.sort.uniq.join('|')
97
97
  end
@@ -106,7 +106,7 @@ module Boltless
106
106
  return %("") if inputs.empty?
107
107
 
108
108
  inputs.map do |input|
109
- "\"#{input.to_s.gsub(/"/, '\"')}\""
109
+ "\"#{input.to_s.gsub('"', '\"')}\""
110
110
  end.uniq.join(', ')
111
111
  end
112
112
 
@@ -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.3.0'
6
+ VERSION = '1.4.0'
7
7
 
8
8
  class << self
9
9
  # Returns the version of gem as a string.
@@ -33,7 +33,7 @@ RSpec.describe Boltless::Extensions::ConfigurationHandling do
33
33
  end
34
34
 
35
35
  it 'returns a logger with the default info level' do
36
- expect(described_class.logger.level).to be_eql(Logger::INFO)
36
+ expect(described_class.logger.level).to eql(Logger::INFO)
37
37
  end
38
38
  end
39
39
  end
@@ -38,37 +38,37 @@ RSpec.describe Boltless::Extensions::ConnectionPool do
38
38
  it 'returns a configured HTTP client (pool size)' do
39
39
  Boltless.configuration.connection_pool_size = 1
40
40
  reload.call
41
- expect(action.size).to be_eql(1)
41
+ expect(action.size).to be(1)
42
42
  end
43
43
 
44
44
  it 'returns a configured HTTP client (connection aquire timeout)' do
45
45
  Boltless.configuration.connection_pool_timeout = 1
46
46
  reload.call
47
- expect(action.instance_variable_get(:@timeout)).to be_eql(1)
47
+ expect(action.instance_variable_get(:@timeout)).to be(1)
48
48
  end
49
49
 
50
50
  it 'returns a configured HTTP client (persistent base URL)' do
51
51
  Boltless.configuration.base_url = 'http://test:1234'
52
52
  reload.call
53
- expect(options.persistent).to be_eql('http://test:1234')
53
+ expect(options.persistent).to eql('http://test:1234')
54
54
  end
55
55
 
56
56
  it 'returns a configured HTTP client (username)' do
57
57
  Boltless.configuration.username = 'test'
58
58
  reload.call
59
- expect(auth.first).to be_eql('test')
59
+ expect(auth.first).to eql('test')
60
60
  end
61
61
 
62
62
  it 'returns a configured HTTP client (password)' do
63
63
  Boltless.configuration.password = 'test'
64
64
  reload.call
65
- expect(auth.last).to be_eql('test')
65
+ expect(auth.last).to eql('test')
66
66
  end
67
67
 
68
68
  it 'returns a configured HTTP client (request timeout)' do
69
69
  Boltless.configuration.request_timeout = 7
70
70
  reload.call
71
- expect(options.timeout_options[:global_timeout]).to be_eql(7)
71
+ expect(options.timeout_options[:global_timeout]).to be(7)
72
72
  end
73
73
 
74
74
  it 'allows send requests' do
@@ -83,21 +83,21 @@ RSpec.describe Boltless::Extensions::Operations do
83
83
  context 'with an known index' do
84
84
  it 'returns true' do
85
85
  expect(described_class.component_name_present?('user_id')).to \
86
- be_eql(true)
86
+ be(true)
87
87
  end
88
88
  end
89
89
 
90
90
  context 'with an known constraint' do
91
91
  it 'returns true' do
92
92
  expect(described_class.component_name_present?('uniq_user_email')).to \
93
- be_eql(true)
93
+ be(true)
94
94
  end
95
95
  end
96
96
 
97
97
  context 'with an unknown name' do
98
98
  it 'returns false' do
99
99
  expect(described_class.component_name_present?('unknown')).to \
100
- be_eql(false)
100
+ be(false)
101
101
  end
102
102
  end
103
103
  end
@@ -111,7 +111,7 @@ RSpec.describe Boltless::Extensions::Operations do
111
111
 
112
112
  it 'returns the known index names' do
113
113
  expect(described_class.index_names).to \
114
- match_array(%w[user_id session_id])
114
+ contain_exactly('user_id', 'session_id')
115
115
  end
116
116
  end
117
117
 
@@ -127,14 +127,14 @@ RSpec.describe Boltless::Extensions::Operations do
127
127
 
128
128
  it 'returns the known constraint names' do
129
129
  expect(described_class.constraint_names).to \
130
- match_array(%w[uniq_user_email uniq_user_session])
130
+ contain_exactly('uniq_user_email', 'uniq_user_session')
131
131
  end
132
132
  end
133
133
 
134
134
  describe '.add_index' do
135
135
  it 'allows to create a new index' do
136
136
  described_class.add_index(name: 'user_id', for: '(n:User)', on: 'n.id')
137
- expect(described_class.index_names).to match_array(['user_id'])
137
+ expect(described_class.index_names).to contain_exactly('user_id')
138
138
  end
139
139
  end
140
140
 
@@ -146,7 +146,7 @@ RSpec.describe Boltless::Extensions::Operations do
146
146
  context 'with an existing index' do
147
147
  it 'allows to drop an index' do
148
148
  described_class.drop_index('user_id')
149
- expect(described_class.index_names).to match_array([])
149
+ expect(described_class.index_names).to be_empty
150
150
  end
151
151
  end
152
152
 
@@ -162,7 +162,7 @@ RSpec.describe Boltless::Extensions::Operations do
162
162
  described_class.add_constraint(name: 'uniq_user_email', for: '(n:User)',
163
163
  require: 'n.email IS UNIQUE')
164
164
  expect(described_class.constraint_names).to \
165
- match_array(['uniq_user_email'])
165
+ contain_exactly('uniq_user_email')
166
166
  end
167
167
  end
168
168
 
@@ -175,7 +175,7 @@ RSpec.describe Boltless::Extensions::Operations do
175
175
  context 'with an existing constraint' do
176
176
  it 'allows to drop an constraint' do
177
177
  described_class.drop_constraint('uniq_user_email')
178
- expect(described_class.constraint_names).to match_array([])
178
+ expect(described_class.constraint_names).to be_empty
179
179
  end
180
180
  end
181
181
 
@@ -66,7 +66,7 @@ RSpec.describe Boltless::Extensions::Transactions do
66
66
 
67
67
  it 'returns the user names' do
68
68
  expect(action.pluck(:name)).to \
69
- match_array(%w[Bernd Klaus Uwe Monika])
69
+ contain_exactly('Bernd', 'Klaus', 'Uwe', 'Monika')
70
70
  end
71
71
 
72
72
  it 'returns a Boltless::Result' do
@@ -151,7 +151,7 @@ RSpec.describe Boltless::Extensions::Transactions do
151
151
  it 'rolls back the transaction (no data is written)' do
152
152
  suppress(StandardError) { action }
153
153
  cypher, args = count_users_statement
154
- expect(described_class.execute!(cypher, **args).value).to be_eql(0)
154
+ expect(described_class.execute!(cypher, **args).value).to be(0)
155
155
  end
156
156
  end
157
157
 
@@ -166,11 +166,11 @@ RSpec.describe Boltless::Extensions::Transactions do
166
166
  end
167
167
 
168
168
  it 'returns 4 results (one for each statement)' do
169
- expect(action.count).to be_eql(4)
169
+ expect(action.count).to be(4)
170
170
  end
171
171
 
172
172
  it 'returns the correct created user count' do
173
- expect(action.last.value).to be_eql(3)
173
+ expect(action.last.value).to be(3)
174
174
  end
175
175
  end
176
176
  end
@@ -199,7 +199,7 @@ RSpec.describe Boltless::Extensions::Transactions do
199
199
  it 'rolls back the transaction (no data is written)' do
200
200
  suppress(StandardError) { action }
201
201
  cypher, args = count_users_statement
202
- expect(described_class.execute!(cypher, **args).value).to be_eql(0)
202
+ expect(described_class.execute!(cypher, **args).value).to be(0)
203
203
  end
204
204
  end
205
205
 
@@ -214,11 +214,11 @@ RSpec.describe Boltless::Extensions::Transactions do
214
214
  end
215
215
 
216
216
  it 'returns 4 results (one for each statement)' do
217
- expect(action.count).to be_eql(4)
217
+ expect(action.count).to be(4)
218
218
  end
219
219
 
220
220
  it 'returns the correct created user count' do
221
- expect(action.last.value).to be_eql(3)
221
+ expect(action.last.value).to be(3)
222
222
  end
223
223
  end
224
224
  end
@@ -247,7 +247,7 @@ RSpec.describe Boltless::Extensions::Transactions do
247
247
  suppress(StandardError) { action }
248
248
  cypher, args = count_users_statement
249
249
  expect(described_class.execute!(cypher, **args).value).to \
250
- be_eql(0)
250
+ be(0)
251
251
  end
252
252
  end
253
253
 
@@ -261,13 +261,13 @@ RSpec.describe Boltless::Extensions::Transactions do
261
261
  end
262
262
 
263
263
  it 'returns true' do
264
- expect(action).to be_eql(true)
264
+ expect(action).to be(true)
265
265
  end
266
266
 
267
267
  it 'rolls back the transaction (no data is written)' do
268
268
  suppress(StandardError) { action }
269
269
  cypher, args = count_users_statement
270
- expect(described_class.execute!(cypher, **args).value).to be_eql(0)
270
+ expect(described_class.execute!(cypher, **args).value).to be(0)
271
271
  end
272
272
  end
273
273
 
@@ -281,13 +281,13 @@ RSpec.describe Boltless::Extensions::Transactions do
281
281
  end
282
282
 
283
283
  it 'returns an empty array (due to no finalization statements given)' do
284
- expect(action).to match_array([])
284
+ expect(action).to be_empty
285
285
  end
286
286
 
287
287
  it 'completed the transaction (data is written)' do
288
288
  suppress(StandardError) { action }
289
289
  cypher, args = count_users_statement
290
- expect(described_class.execute!(cypher, **args).value).to be_eql(1)
290
+ expect(described_class.execute!(cypher, **args).value).to be(1)
291
291
  end
292
292
  end
293
293
 
@@ -298,10 +298,10 @@ RSpec.describe Boltless::Extensions::Transactions do
298
298
  it 'allows direct access to each result' do
299
299
  Boltless.transaction! do |tx|
300
300
  cypher, args = fetch_date_statement
301
- expect(tx.run!(cypher, **args).value).to be_eql(Date.today.to_s)
301
+ expect(tx.run!(cypher, **args).value).to eql(Date.today.to_s)
302
302
 
303
303
  cypher, args = fetch_static_number_statement
304
- expect(tx.run!(cypher, **args).value).to be_eql(9867)
304
+ expect(tx.run!(cypher, **args).value).to be(9867)
305
305
  end
306
306
  end
307
307
  # rubocop:enable RSpec/MultipleExpectations
@@ -330,7 +330,7 @@ RSpec.describe Boltless::Extensions::Transactions do
330
330
  it 'rolls back the transaction (no data is written)' do
331
331
  suppress(StandardError) { action }
332
332
  cypher, args = count_users_statement
333
- expect(described_class.execute!(cypher, **args).value).to be_eql(0)
333
+ expect(described_class.execute!(cypher, **args).value).to be(0)
334
334
  end
335
335
  end
336
336
 
@@ -354,7 +354,7 @@ RSpec.describe Boltless::Extensions::Transactions do
354
354
  it 'rolls back the transaction (no data is written)' do
355
355
  suppress(StandardError) { action }
356
356
  cypher, args = count_users_statement
357
- expect(described_class.execute!(cypher, **args).value).to be_eql(0)
357
+ expect(described_class.execute!(cypher, **args).value).to be(0)
358
358
  end
359
359
  end
360
360
 
@@ -368,13 +368,13 @@ RSpec.describe Boltless::Extensions::Transactions do
368
368
  end
369
369
 
370
370
  it 'returns true' do
371
- expect(action).to be_eql(true)
371
+ expect(action).to be(true)
372
372
  end
373
373
 
374
374
  it 'rolls back the transaction (no data is written)' do
375
375
  suppress(StandardError) { action }
376
376
  cypher, args = count_users_statement
377
- expect(described_class.execute!(cypher, **args).value).to be_eql(0)
377
+ expect(described_class.execute!(cypher, **args).value).to be(0)
378
378
  end
379
379
  end
380
380
 
@@ -388,13 +388,13 @@ RSpec.describe Boltless::Extensions::Transactions do
388
388
  end
389
389
 
390
390
  it 'returns an empty array (due to no finalization statements given)' do
391
- expect(action).to match_array([])
391
+ expect(action).to be_empty
392
392
  end
393
393
 
394
394
  it 'completed the transaction (data is written)' do
395
395
  suppress(StandardError) { action }
396
396
  cypher, args = count_users_statement
397
- expect(described_class.execute!(cypher, **args).value).to be_eql(1)
397
+ expect(described_class.execute!(cypher, **args).value).to be(1)
398
398
  end
399
399
  end
400
400
 
@@ -405,10 +405,10 @@ RSpec.describe Boltless::Extensions::Transactions do
405
405
  it 'allows direct access to each result' do
406
406
  Boltless.transaction do |tx|
407
407
  cypher, args = fetch_date_statement
408
- expect(tx.run(cypher, **args).value).to be_eql(Date.today.to_s)
408
+ expect(tx.run(cypher, **args).value).to eql(Date.today.to_s)
409
409
 
410
410
  cypher, args = fetch_static_number_statement
411
- expect(tx.run(cypher, **args).value).to be_eql(9867)
411
+ expect(tx.run(cypher, **args).value).to be(9867)
412
412
  end
413
413
  end
414
414
  # rubocop:enable RSpec/MultipleExpectations