sequel-batches 2.0.2 → 2.0.3

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: 3cd6e15b3473080a3ccc2db4959cddb601624fc0bde9bda3bfad153d9e60194b
4
- data.tar.gz: 840ea07efcc58c518a2022f21e4423fc1e2887b2a552c05d5905077ae02daa8a
3
+ metadata.gz: 04f8ae7798b4499734e05f2c832ab01f31e10e7f4fc5c1f00a28bab74849e87a
4
+ data.tar.gz: 42a570ce32264ca13b7aff386bc7919a027699abe7e21c35dd62ca86e715ba0e
5
5
  SHA512:
6
- metadata.gz: a1ae993708db8f425d9901047fb868498f0b1e0957e2fc56578ec23f388e095fd2ba509a3a09c7b9d485c9b7f7e1bf390144bc2e74c09bf585c7b4b708376b24
7
- data.tar.gz: 5d19d482faf0959d6a873dd17dc62595c7d5c972d1d35d169ece1c53f880d5ba1e116b6db5d27e04e3731c2f74da989ac361df215fe9d2daa061a2c6b9e43f69
6
+ metadata.gz: 4acd36d8b43e7963dfef29ac9408a76259276bd45678e7be7cb8e0f12f48e6be7d6274c400f5c110a0f1843efdf9abbdeeace8576dcd01f261ead8a1301bc993
7
+ data.tar.gz: c05e40d2f038db4a12717480debebfe6f202abc27fdb5bf78a236e33e303a5c90455e54d794fd1d3863bf30c4ca0fec935c70052c236a97ea8433e4e0c054469
@@ -29,7 +29,7 @@ jobs:
29
29
  strategy:
30
30
  fail-fast: false
31
31
  matrix:
32
- ruby: ["2.7", "3.0", "3.1"]
32
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
33
33
 
34
34
  name: ${{ matrix.ruby }}
35
35
 
@@ -41,7 +41,6 @@ jobs:
41
41
  bundler-cache: true
42
42
 
43
43
  - run: psql -c 'CREATE DATABASE batches_test'
44
- - run: bundle exec rake bundle:audit
45
44
  - run: bundle exec rake lint
46
45
  - run: bundle exec rspec
47
46
 
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_gem:
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 2.7
6
+ TargetRubyVersion: 3.0
7
7
  Include:
8
8
  - lib/**/*.rb
9
9
  - spec/**/*.rb
data/Gemfile CHANGED
@@ -4,3 +4,12 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in sequel-batches.gemspec
6
6
  gemspec
7
+
8
+ gem "bundler"
9
+ gem "pg"
10
+ gem "pry"
11
+ gem "rake"
12
+ gem "rspec"
13
+ gem "rubocop-config-umbrellio"
14
+ gem "simplecov"
15
+ gem "simplecov-lcov"
data/Gemfile.lock CHANGED
@@ -1,105 +1,129 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sequel-batches (2.0.2)
4
+ sequel-batches (2.0.3)
5
5
  sequel
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (7.0.3.1)
10
+ activesupport (7.1.3.4)
11
+ base64
12
+ bigdecimal
11
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ connection_pool (>= 2.2.5)
15
+ drb
12
16
  i18n (>= 1.6, < 2)
13
17
  minitest (>= 5.1)
18
+ mutex_m
14
19
  tzinfo (~> 2.0)
15
20
  ast (2.4.2)
16
- bundler-audit (0.9.1)
17
- bundler (>= 1.2.0, < 3)
18
- thor (~> 1.0)
21
+ base64 (0.2.0)
22
+ bigdecimal (3.1.8)
19
23
  coderay (1.1.3)
20
- concurrent-ruby (1.1.10)
21
- diff-lcs (1.5.0)
24
+ concurrent-ruby (1.3.3)
25
+ connection_pool (2.4.1)
26
+ diff-lcs (1.5.1)
22
27
  docile (1.4.0)
23
- i18n (1.12.0)
28
+ drb (2.2.1)
29
+ i18n (1.14.5)
24
30
  concurrent-ruby (~> 1.0)
25
- method_source (1.0.0)
26
- minitest (5.16.2)
27
- parallel (1.22.1)
28
- parser (3.1.2.1)
31
+ json (2.7.2)
32
+ language_server-protocol (3.17.0.3)
33
+ method_source (1.1.0)
34
+ minitest (5.24.1)
35
+ mutex_m (0.2.0)
36
+ parallel (1.25.1)
37
+ parser (3.3.3.0)
29
38
  ast (~> 2.4.1)
30
- pg (1.4.2)
31
- pry (0.14.1)
39
+ racc
40
+ pg (1.5.6)
41
+ pry (0.14.2)
32
42
  coderay (~> 1.1)
33
43
  method_source (~> 1.0)
34
- rack (2.2.4)
44
+ racc (1.8.0)
45
+ rack (3.1.4)
35
46
  rainbow (3.1.1)
36
- rake (13.0.6)
37
- regexp_parser (2.5.0)
38
- rexml (3.2.5)
39
- rspec (3.11.0)
40
- rspec-core (~> 3.11.0)
41
- rspec-expectations (~> 3.11.0)
42
- rspec-mocks (~> 3.11.0)
43
- rspec-core (3.11.0)
44
- rspec-support (~> 3.11.0)
45
- rspec-expectations (3.11.0)
47
+ rake (13.2.1)
48
+ regexp_parser (2.9.2)
49
+ rexml (3.3.1)
50
+ strscan
51
+ rspec (3.13.0)
52
+ rspec-core (~> 3.13.0)
53
+ rspec-expectations (~> 3.13.0)
54
+ rspec-mocks (~> 3.13.0)
55
+ rspec-core (3.13.0)
56
+ rspec-support (~> 3.13.0)
57
+ rspec-expectations (3.13.1)
46
58
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.11.0)
48
- rspec-mocks (3.11.1)
59
+ rspec-support (~> 3.13.0)
60
+ rspec-mocks (3.13.1)
49
61
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.11.0)
51
- rspec-support (3.11.0)
52
- rubocop (1.30.1)
62
+ rspec-support (~> 3.13.0)
63
+ rspec-support (3.13.1)
64
+ rubocop (1.63.5)
65
+ json (~> 2.3)
66
+ language_server-protocol (>= 3.17.0)
53
67
  parallel (~> 1.10)
54
- parser (>= 3.1.0.0)
68
+ parser (>= 3.3.0.2)
55
69
  rainbow (>= 2.2.2, < 4.0)
56
70
  regexp_parser (>= 1.8, < 3.0)
57
71
  rexml (>= 3.2.5, < 4.0)
58
- rubocop-ast (>= 1.18.0, < 2.0)
72
+ rubocop-ast (>= 1.31.1, < 2.0)
59
73
  ruby-progressbar (~> 1.7)
60
- unicode-display_width (>= 1.4.0, < 3.0)
61
- rubocop-ast (1.21.0)
62
- parser (>= 3.1.1.0)
63
- rubocop-config-umbrellio (1.30.0.65)
64
- rubocop (~> 1.30.0)
65
- rubocop-performance (~> 1.14.0)
66
- rubocop-rails (~> 2.14.2)
74
+ unicode-display_width (>= 2.4.0, < 3.0)
75
+ rubocop-ast (1.31.3)
76
+ parser (>= 3.3.1.0)
77
+ rubocop-capybara (2.21.0)
78
+ rubocop (~> 1.41)
79
+ rubocop-config-umbrellio (1.63.0.93)
80
+ rubocop (~> 1.63.0)
81
+ rubocop-performance (~> 1.21.0)
82
+ rubocop-rails (~> 2.24.0)
67
83
  rubocop-rake (~> 0.6.0)
68
- rubocop-rspec (~> 2.11.1)
84
+ rubocop-rspec (~> 2.29.0)
69
85
  rubocop-sequel (~> 0.3.3)
70
- rubocop-performance (1.14.3)
71
- rubocop (>= 1.7.0, < 2.0)
72
- rubocop-ast (>= 0.4.0)
73
- rubocop-rails (2.14.2)
86
+ rubocop-factory_bot (2.26.1)
87
+ rubocop (~> 1.61)
88
+ rubocop-performance (1.21.1)
89
+ rubocop (>= 1.48.1, < 2.0)
90
+ rubocop-ast (>= 1.31.1, < 2.0)
91
+ rubocop-rails (2.24.1)
74
92
  activesupport (>= 4.2.0)
75
93
  rack (>= 1.1)
76
- rubocop (>= 1.7.0, < 2.0)
94
+ rubocop (>= 1.33.0, < 2.0)
95
+ rubocop-ast (>= 1.31.1, < 2.0)
77
96
  rubocop-rake (0.6.0)
78
97
  rubocop (~> 1.0)
79
- rubocop-rspec (2.11.1)
80
- rubocop (~> 1.19)
98
+ rubocop-rspec (2.29.2)
99
+ rubocop (~> 1.40)
100
+ rubocop-capybara (~> 2.17)
101
+ rubocop-factory_bot (~> 2.22)
102
+ rubocop-rspec_rails (~> 2.28)
103
+ rubocop-rspec_rails (2.29.1)
104
+ rubocop (~> 1.61)
81
105
  rubocop-sequel (0.3.4)
82
106
  rubocop (~> 1.0)
83
- ruby-progressbar (1.11.0)
84
- sequel (5.59.0)
85
- simplecov (0.21.2)
107
+ ruby-progressbar (1.13.0)
108
+ sequel (5.81.0)
109
+ bigdecimal
110
+ simplecov (0.22.0)
86
111
  docile (~> 1.1)
87
112
  simplecov-html (~> 0.11)
88
113
  simplecov_json_formatter (~> 0.1)
89
114
  simplecov-html (0.12.3)
90
115
  simplecov-lcov (0.8.0)
91
116
  simplecov_json_formatter (0.1.4)
92
- thor (1.2.1)
93
- tzinfo (2.0.5)
117
+ strscan (3.1.0)
118
+ tzinfo (2.0.6)
94
119
  concurrent-ruby (~> 1.0)
95
- unicode-display_width (2.2.0)
120
+ unicode-display_width (2.5.0)
96
121
 
97
122
  PLATFORMS
98
123
  ruby
99
124
 
100
125
  DEPENDENCIES
101
126
  bundler
102
- bundler-audit
103
127
  pg
104
128
  pry
105
129
  rake
@@ -110,4 +134,4 @@ DEPENDENCIES
110
134
  simplecov-lcov
111
135
 
112
136
  BUNDLED WITH
113
- 2.3.19
137
+ 2.5.14
data/README.md CHANGED
@@ -17,7 +17,7 @@ gem 'sequel-batches'
17
17
  In order to use the feature you should enable the extension:
18
18
 
19
19
  ```ruby
20
- Sequel::DATABASES.first.extension :batches
20
+ DB.extension(:batches)
21
21
  ```
22
22
 
23
23
  After that the `#in_batches` method becomes available on dataset:
@@ -39,8 +39,8 @@ options = {
39
39
  order: :desc,
40
40
  }
41
41
 
42
- Event.where(type: "login").in_batches(options) do |ds|
43
- ds.delete
42
+ Event.where(type: "login").in_batches(**options) do |dataset|
43
+ dataset.delete
44
44
  end
45
45
  ```
46
46
 
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- require "bundler/audit/task"
5
4
  require "rspec/core/rake_task"
6
5
  require "rubocop/rake_task"
7
6
 
@@ -13,6 +12,5 @@ RuboCop::RakeTask.new(:lint) do |t|
13
12
  t.requires << "rubocop-rspec"
14
13
  t.requires << "rubocop-performance"
15
14
  end
16
- Bundler::Audit::Task.new
17
15
 
18
16
  task default: %i[lint spec]
@@ -21,19 +21,19 @@ module Sequel::Extensions::Batches
21
21
  base_ds = setup_base_ds or return
22
22
  return enum_for(:call) unless block_given?
23
23
 
24
- current_instance = nil
24
+ current_pk = nil
25
25
 
26
26
  loop do
27
27
  working_ds =
28
- if current_instance
29
- base_ds.where(generate_conditions(current_instance.to_h, sign: sign_from_exclusive))
28
+ if current_pk
29
+ base_ds.where(generate_conditions(current_pk.to_h, sign: sign_from_exclusive))
30
30
  else
31
31
  base_ds
32
32
  end
33
33
 
34
34
  working_ds_pk = working_ds.select(*qualified_pk).order(*order_by(qualified: true)).limit(of)
35
- current_instance = db.from(working_ds_pk).select(*pk).order(*order_by).last or break
36
- working_ds = working_ds.where(generate_conditions(current_instance.to_h, sign: sign_to_inclusive))
35
+ current_pk = db.from(working_ds_pk).select(*pk).order(*order_by).last or break
36
+ working_ds = working_ds.where(generate_conditions(current_pk.to_h, sign: sign_to_inclusive))
37
37
 
38
38
  yield working_ds
39
39
  end
@@ -94,7 +94,7 @@ module Sequel::Extensions::Batches
94
94
  end
95
95
 
96
96
  def setup_base_ds
97
- base_ds = ds.order(*order_by(qualified: true))
97
+ base_ds = ds
98
98
  base_ds = base_ds.where(generate_conditions(check_pk(start), sign: sign_from_inclusive)) if start
99
99
  base_ds = base_ds.where(generate_conditions(check_pk(finish), sign: sign_to_inclusive)) if finish
100
100
 
@@ -105,7 +105,8 @@ module Sequel::Extensions::Batches
105
105
  return unless actual_start && actual_finish
106
106
 
107
107
  base_ds = base_ds.where(generate_conditions(actual_start, sign: sign_from_inclusive))
108
- base_ds.where(generate_conditions(actual_finish, sign: sign_to_inclusive))
108
+ base_ds = base_ds.where(generate_conditions(actual_finish, sign: sign_to_inclusive))
109
+ base_ds.order(*order_by(qualified: true))
109
110
  end
110
111
  end
111
112
  end
@@ -14,6 +14,6 @@ module Sequel
14
14
  end
15
15
  end
16
16
 
17
- ::Sequel::Dataset.register_extension(:batches, Sequel::Extensions::Batches)
17
+ Sequel::Dataset.register_extension(:batches, Sequel::Extensions::Batches)
18
18
 
19
19
  require_relative "batches/yielder"
@@ -5,10 +5,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "sequel-batches"
8
- spec.version = "2.0.2"
8
+ spec.version = "2.0.3"
9
9
  spec.authors = %w[fiscal-cliff umbrellio]
10
10
  spec.email = ["oss@umbrellio.biz"]
11
- spec.required_ruby_version = ">= 2.7"
11
+ spec.required_ruby_version = ">= 3.0"
12
12
 
13
13
  spec.summary = "The extension mimics AR5 batches api"
14
14
  spec.description = "Allows you to split your dataset in batches"
@@ -19,14 +19,4 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency "sequel"
22
-
23
- spec.add_development_dependency "bundler"
24
- spec.add_development_dependency "bundler-audit"
25
- spec.add_development_dependency "pg"
26
- spec.add_development_dependency "pry"
27
- spec.add_development_dependency "rake"
28
- spec.add_development_dependency "rspec"
29
- spec.add_development_dependency "rubocop-config-umbrellio"
30
- spec.add_development_dependency "simplecov"
31
- spec.add_development_dependency "simplecov-lcov"
32
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-batches
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - fiscal-cliff
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-10 00:00:00.000000000 Z
12
+ date: 2024-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel
@@ -25,132 +25,6 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: bundler
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: bundler-audit
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: pg
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: pry
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: rake
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: rspec
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '0'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: rubocop-config-umbrellio
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: simplecov
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '0'
133
- type: :development
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '0'
140
- - !ruby/object:Gem::Dependency
141
- name: simplecov-lcov
142
- requirement: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - ">="
145
- - !ruby/object:Gem::Version
146
- version: '0'
147
- type: :development
148
- prerelease: false
149
- version_requirements: !ruby/object:Gem::Requirement
150
- requirements:
151
- - - ">="
152
- - !ruby/object:Gem::Version
153
- version: '0'
154
28
  description: Allows you to split your dataset in batches
155
29
  email:
156
30
  - oss@umbrellio.biz
@@ -184,14 +58,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
58
  requirements:
185
59
  - - ">="
186
60
  - !ruby/object:Gem::Version
187
- version: '2.7'
61
+ version: '3.0'
188
62
  required_rubygems_version: !ruby/object:Gem::Requirement
189
63
  requirements:
190
64
  - - ">="
191
65
  - !ruby/object:Gem::Version
192
66
  version: '0'
193
67
  requirements: []
194
- rubygems_version: 3.3.19
68
+ rubygems_version: 3.5.23
195
69
  signing_key:
196
70
  specification_version: 4
197
71
  summary: The extension mimics AR5 batches api