umbrellio-utils 0.5.0 → 0.6.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: c467440e60fca9a678c36cf4ef98a64bf907d6255ab125fa49c1c5a7bebcc58c
4
- data.tar.gz: ae937f7096cd4cc0facc940990cfffd0263cf16d8f568628cef84fd78d36d4cf
3
+ metadata.gz: ec19f3835e4ffb14ac0640e7ebca549343e2f91f190fc06d5fd7419f549dbe11
4
+ data.tar.gz: fc6cb1c5b66662b087e6c8febb8c0727bb3f96dabf1ca668f2e850081d6261d2
5
5
  SHA512:
6
- metadata.gz: cd966392f19e67cf5c7fbc36d9b2e5add185160d6cc7d3679efa6d3a40884eec37f83467af847b29bc14ddc8cced216e39402b6c645abcb6811162e7f59ad3cc
7
- data.tar.gz: fbaad56491705678f219b645f535e4a409d42007ccdbbe6aaaa4f6c76f79e48f48132e44fea3d98952636d72cc1f9f0ea0465328feed1998170faf04448b50b2
6
+ metadata.gz: f4088a39103d9ba5a6e1cf7490049f4cb7194df22aca62fe47d56dc69f5822b2eecc148527b40e7f36e23749fb50be150941fb051eb1ba2cfc92d54376f05306
7
+ data.tar.gz: 6f339403d5d06d7b71ae547f21ddb1a3d776e04852a38d53867092215c3742b92dc5beac1ae587de978025a22d01d5c91b6eb4086d940b13203f02f422fc6fa0
@@ -3,52 +3,60 @@ name: Test
3
3
  on: [push, pull_request]
4
4
 
5
5
  env:
6
- FULL_COVERAGE_CHECK: false # Sometimes, sometimes...
6
+ FULL_COVERAGE_CHECK: false # Someday, someday...
7
7
 
8
8
  jobs:
9
- full-check:
9
+ test:
10
10
  runs-on: ubuntu-latest
11
11
 
12
12
  # We want to run on external PRs, but not on our own internal PRs as they'll be run on push event
13
13
  if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'umbrellio/utils'
14
14
 
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: ["2.7", "3.0", "3.1"]
19
+
20
+ services:
21
+ postgres:
22
+ image: postgres
23
+ env:
24
+ POSTGRES_USER: root
25
+ POSTGRES_HOST_AUTH_METHOD: trust
26
+ options: >-
27
+ --health-cmd pg_isready
28
+ --health-interval 10s
29
+ --health-timeout 5s
30
+ --health-retries 5
31
+ ports:
32
+ - 5432:5432
33
+ env:
34
+ PGHOST: localhost
35
+ PGUSER: root
36
+
15
37
  steps:
16
38
  - uses: actions/checkout@v2
39
+
17
40
  - uses: ruby/setup-ruby@v1
18
41
  with:
19
- ruby-version: "3.1"
42
+ ruby-version: ${{ matrix.ruby }}
20
43
  bundler-cache: true
44
+
45
+ - run: psql -c 'CREATE DATABASE umbrellio_utils_test'
46
+
21
47
  - name: Run Linter
22
48
  run: bundle exec ci-helper RubocopLint
49
+
23
50
  - name: Check missed spec suffixes
24
51
  run: bundle exec ci-helper CheckSpecSuffixes --extra-paths spec/*.rb --ignored-paths spec/*_helper.rb
52
+
25
53
  - name: Run specs
26
54
  run: bundle exec ci-helper RunSpecs
55
+
27
56
  - name: Audit
28
57
  run: bundle exec ci-helper BundlerAudit
58
+
29
59
  - name: Coveralls
30
60
  uses: coverallsapp/github-action@master
31
61
  with:
32
62
  github-token: ${{ secrets.GITHUB_TOKEN }}
33
- specs:
34
- runs-on: ubuntu-latest
35
-
36
- env:
37
- FULL_TEST_COVERAGE_CHECK: false
38
-
39
- # We want to run on external PRs, but not on our own internal PRs as they'll be run on push event
40
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'umbrellio/utils'
41
-
42
- strategy:
43
- fail-fast: false
44
- matrix:
45
- ruby: ["2.7", "3.0"]
46
-
47
- steps:
48
- - uses: actions/checkout@v2
49
- - uses: ruby/setup-ruby@v1
50
- with:
51
- ruby-version: ${{ matrix.ruby }}
52
- bundler-cache: true
53
- - name: Run specs
54
- run: bundle exec rspec
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /log/
data/.rubocop.yml CHANGED
@@ -21,3 +21,6 @@ Naming/RescuedExceptionsVariableName:
21
21
  Style/HashConversion:
22
22
  Exclude:
23
23
  - spec/**/*_spec.rb
24
+
25
+ Naming/VariableNumber:
26
+ CheckSymbols: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- umbrellio-utils (0.5.0)
4
+ umbrellio-utils (0.6.0)
5
5
  memery (~> 1)
6
6
 
7
7
  GEM
@@ -34,7 +34,7 @@ GEM
34
34
  ruby2_keywords (~> 0.0.2)
35
35
  method_source (1.0.0)
36
36
  mini_portile2 (2.8.0)
37
- minitest (5.16.2)
37
+ minitest (5.16.3)
38
38
  nokogiri (1.13.8)
39
39
  mini_portile2 (~> 2.8.0)
40
40
  racc (~> 1.4)
@@ -46,8 +46,9 @@ GEM
46
46
  racc (~> 1.4)
47
47
  nori (2.6.0)
48
48
  parallel (1.22.1)
49
- parser (3.1.2.0)
49
+ parser (3.1.2.1)
50
50
  ast (~> 2.4.1)
51
+ pg (1.4.3)
51
52
  pry (0.14.1)
52
53
  coderay (~> 1.1)
53
54
  method_source (~> 1.0)
@@ -73,42 +74,43 @@ GEM
73
74
  diff-lcs (>= 1.2.0, < 2.0)
74
75
  rspec-support (~> 3.11.0)
75
76
  rspec-support (3.11.0)
76
- rubocop (1.30.1)
77
+ rubocop (1.35.0)
78
+ json (~> 2.3)
77
79
  parallel (~> 1.10)
78
- parser (>= 3.1.0.0)
80
+ parser (>= 3.1.2.1)
79
81
  rainbow (>= 2.2.2, < 4.0)
80
82
  regexp_parser (>= 1.8, < 3.0)
81
83
  rexml (>= 3.2.5, < 4.0)
82
- rubocop-ast (>= 1.18.0, < 2.0)
84
+ rubocop-ast (>= 1.20.1, < 2.0)
83
85
  ruby-progressbar (~> 1.7)
84
86
  unicode-display_width (>= 1.4.0, < 3.0)
85
- rubocop-ast (1.19.1)
87
+ rubocop-ast (1.21.0)
86
88
  parser (>= 3.1.1.0)
87
- rubocop-config-umbrellio (1.30.0.65)
88
- rubocop (~> 1.30.0)
89
+ rubocop-config-umbrellio (1.35.0.69)
90
+ rubocop (~> 1.35.0)
89
91
  rubocop-performance (~> 1.14.0)
90
- rubocop-rails (~> 2.14.2)
92
+ rubocop-rails (~> 2.15.0)
91
93
  rubocop-rake (~> 0.6.0)
92
- rubocop-rspec (~> 2.11.1)
94
+ rubocop-rspec (~> 2.12.0)
93
95
  rubocop-sequel (~> 0.3.3)
94
96
  rubocop-performance (1.14.3)
95
97
  rubocop (>= 1.7.0, < 2.0)
96
98
  rubocop-ast (>= 0.4.0)
97
- rubocop-rails (2.14.2)
99
+ rubocop-rails (2.15.2)
98
100
  activesupport (>= 4.2.0)
99
101
  rack (>= 1.1)
100
102
  rubocop (>= 1.7.0, < 2.0)
101
103
  rubocop-rake (0.6.0)
102
104
  rubocop (~> 1.0)
103
- rubocop-rspec (2.11.1)
104
- rubocop (~> 1.19)
105
+ rubocop-rspec (2.12.1)
106
+ rubocop (~> 1.31)
105
107
  rubocop-sequel (0.3.4)
106
108
  rubocop (~> 1.0)
107
109
  ruby-progressbar (1.11.0)
108
110
  ruby2_keywords (0.0.5)
109
111
  semantic_logger (4.11.0)
110
112
  concurrent-ruby (~> 1.0)
111
- sequel (5.58.0)
113
+ sequel (5.59.0)
112
114
  simplecov (0.21.2)
113
115
  docile (~> 1.1)
114
116
  simplecov-html (~> 0.11)
@@ -143,12 +145,14 @@ DEPENDENCIES
143
145
  ci-helper
144
146
  nokogiri
145
147
  nori
148
+ pg
146
149
  pry
147
150
  rake
148
151
  rspec
149
152
  rspec-json_matcher
150
153
  rubocop-config-umbrellio
151
154
  semantic_logger
155
+ sequel
152
156
  simplecov
153
157
  simplecov-lcov
154
158
  timecop
@@ -156,4 +160,4 @@ DEPENDENCIES
156
160
  yard
157
161
 
158
162
  BUNDLED WITH
159
- 2.3.19
163
+ 2.3.20
@@ -6,8 +6,6 @@ module UmbrellioUtils
6
6
 
7
7
  HandledConstaintError = Class.new(StandardError)
8
8
 
9
- DEFAULT_SLEEP_INTERVAL = defined?(Rails) && Rails.env.production? ? 1 : 0
10
-
11
9
  def handle_constraint_error(constraint_name, &block)
12
10
  DB.transaction(savepoint: true, &block)
13
11
  rescue Sequel::UniqueConstraintViolation => e
@@ -27,7 +25,7 @@ module UmbrellioUtils
27
25
  primary_key = primary_key_from(**options)
28
26
 
29
27
  with_temp_table(dataset, **options) do |ids|
30
- dataset.model.where(primary_key => ids).each(&block)
28
+ dataset.model.where(primary_key => ids).reverse(primary_key).each(&block)
31
29
  end
32
30
  end
33
31
 
@@ -51,7 +49,7 @@ module UmbrellioUtils
51
49
 
52
50
  break if pk_set.empty?
53
51
 
54
- sleep(sleep_interval) if sleep_interval.positive?
52
+ Kernel.sleep(sleep_interval) if sleep_interval.positive?
55
53
  clear_lamian_logs!
56
54
  end
57
55
  ensure
@@ -59,6 +57,7 @@ module UmbrellioUtils
59
57
  end
60
58
 
61
59
  def clear_lamian_logs!
60
+ return unless defined?(Lamian)
62
61
  Lamian.logger.send(:logdevs).each { |x| x.truncate(0) && x.rewind }
63
62
  end
64
63
 
@@ -84,14 +83,14 @@ module UmbrellioUtils
84
83
  options.fetch(:primary_key, :id)
85
84
  end
86
85
 
87
- def sleep_inteval_from(sleep)
86
+ def sleep_interval_from(sleep)
88
87
  case sleep
89
88
  when Numeric
90
89
  sleep
91
90
  when FalseClass
92
91
  0
93
92
  else
94
- DEFAULT_SLEEP_INTERVAL
93
+ defined?(Rails) && Rails.env.production? ? 1 : 0
95
94
  end
96
95
  end
97
96
  end
@@ -73,7 +73,7 @@ module UmbrellioUtils
73
73
  log.message,
74
74
  log.tags,
75
75
  log.named_tags,
76
- log.time.utc.iso8601(3),
76
+ log.time.utc.iso8601(9),
77
77
  ]
78
78
  end
79
79
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UmbrellioUtils
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
data/log/.keep ADDED
File without changes
@@ -35,12 +35,14 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "ci-helper"
36
36
  spec.add_development_dependency "nokogiri"
37
37
  spec.add_development_dependency "nori"
38
+ spec.add_development_dependency "pg"
38
39
  spec.add_development_dependency "pry"
39
40
  spec.add_development_dependency "rake"
40
41
  spec.add_development_dependency "rspec"
41
42
  spec.add_development_dependency "rspec-json_matcher"
42
43
  spec.add_development_dependency "rubocop-config-umbrellio"
43
44
  spec.add_development_dependency "semantic_logger"
45
+ spec.add_development_dependency "sequel"
44
46
  spec.add_development_dependency "simplecov"
45
47
  spec.add_development_dependency "simplecov-lcov"
46
48
  spec.add_development_dependency "timecop"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umbrellio-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JustAnotherDude
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memery
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pg
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: pry
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +206,20 @@ dependencies:
192
206
  - - ">="
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: sequel
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
195
223
  - !ruby/object:Gem::Dependency
196
224
  name: simplecov
197
225
  requirement: !ruby/object:Gem::Requirement
@@ -286,6 +314,7 @@ files:
286
314
  - lib/umbrellio_utils/store.rb
287
315
  - lib/umbrellio_utils/vault.rb
288
316
  - lib/umbrellio_utils/version.rb
317
+ - log/.keep
289
318
  - umbrellio_utils.gemspec
290
319
  homepage: https://github.com/umbrellio/utils
291
320
  licenses:
@@ -309,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
338
  - !ruby/object:Gem::Version
310
339
  version: '0'
311
340
  requirements: []
312
- rubygems_version: 3.3.17
341
+ rubygems_version: 3.3.20
313
342
  signing_key:
314
343
  specification_version: 4
315
344
  summary: A set of utilities that speed up development