lb-persistence 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +7 -12
- data/.gitignore +1 -0
- data/.rubocop.yml +18 -0
- data/Guardfile +1 -2
- data/Rakefile +1 -3
- data/lb-persistence.gemspec +10 -13
- data/lib/lb/persistence/functions.rb +0 -2
- data/lib/lb/persistence/relation/joins.rb +2 -2
- data/lib/lb/persistence/version.rb +1 -1
- data/lib/lb/persistence.rb +1 -1
- data/rakelib/ci.rake +14 -10
- data/rakelib/spec.rake +36 -0
- data/spec/spec_helper.rb +0 -2
- data/spec/unit/lb/persistence/functions/class_methods/group_prefix_spec.rb +1 -1
- data/spec/unit/lb/persistence/functions/class_methods/wrap_prefix_spec.rb +1 -1
- metadata +30 -74
- data/.rubocop.yml +0 -1
- data/config/rubocop.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aaa4e82cdf55105539b2b0b922221f1c13edba4f415550f606c92f992154616
|
4
|
+
data.tar.gz: d67a1ad39dfc23b52720978f5283ae1cb4fe0d808ab14e8a709fcdb067320556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01ca45c267be5d5a4d072d65a67d0fb26635f3c0c37587ccfb3d9951a8965ebb3851616ce660484c253715971c7b0da4554f2f3caf8bca51208067631b379496
|
7
|
+
data.tar.gz: 1b2f8d96eca4a1cf9340180dadb3935904f1eb900a8131cdeb700e15eb9bd8936a17f9a3a3a76b9c5d16e9dcf1c5386773d0060589305232caa347e2e5fd8aec
|
data/.github/workflows/ci.yml
CHANGED
@@ -9,19 +9,14 @@ jobs:
|
|
9
9
|
runs-on: ubuntu-latest
|
10
10
|
strategy:
|
11
11
|
matrix:
|
12
|
-
ruby_version: ['2.
|
12
|
+
ruby_version: ['2.7', '3.0', '3.1', 'head']
|
13
13
|
steps:
|
14
|
-
- uses: actions/checkout@
|
15
|
-
- name: Set up Ruby
|
16
|
-
uses:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
16
|
+
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
|
17
17
|
with:
|
18
18
|
ruby-version: ${{ matrix.ruby_version }}
|
19
19
|
- name: Install dependencies
|
20
|
-
run:
|
21
|
-
|
22
|
-
|
23
|
-
- name: Build and test with Rake
|
24
|
-
run: |
|
25
|
-
gem install bundler
|
26
|
-
bundle install --jobs 4 --retry 3
|
27
|
-
bundle exec rake ci
|
20
|
+
run: bundle install
|
21
|
+
- name: Run tests
|
22
|
+
run: bundle exec rake ci
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.7
|
3
|
+
NewCops: enable
|
4
|
+
DisplayCopNames: true
|
5
|
+
Exclude:
|
6
|
+
- 'vendor/**/*'
|
7
|
+
Naming/FileName:
|
8
|
+
Exclude:
|
9
|
+
- Rakefile
|
10
|
+
Metrics/BlockLength:
|
11
|
+
Exclude:
|
12
|
+
- 'spec/**/*.rb'
|
13
|
+
- '*.gemspec'
|
14
|
+
Lint/ConstantDefinitionInBlock:
|
15
|
+
Exclude:
|
16
|
+
- 'spec/**/*.rb'
|
17
|
+
Style/OperatorMethodCall:
|
18
|
+
Enabled: false
|
data/Guardfile
CHANGED
@@ -6,8 +6,7 @@ guard :bundler do
|
|
6
6
|
watch(/\A(.+)\.gemspec\z/)
|
7
7
|
end
|
8
8
|
|
9
|
-
guard :rspec, cmd:
|
10
|
-
File.read('.rspec').split.join(' '),
|
9
|
+
guard :rspec, cmd: "bundle exec rspec #{File.read('.rspec').split.join(' ')}",
|
11
10
|
failed_mode: :keep do
|
12
11
|
# Run all specs if configuration is modified
|
13
12
|
watch('.rspec') { 'spec' }
|
data/Rakefile
CHANGED
data/lb-persistence.gemspec
CHANGED
@@ -18,20 +18,17 @@ Gem::Specification.new do |gem|
|
|
18
18
|
.split($INPUT_RECORD_SEPARATOR)
|
19
19
|
gem.executables = `git ls-files -- bin/*`
|
20
20
|
.split("\n").map { |f| File.basename(f) }
|
21
|
-
gem.test_files = `git ls-files -- spec`
|
22
|
-
.split($INPUT_RECORD_SEPARATOR)
|
23
21
|
gem.extra_rdoc_files = %w[README.md]
|
24
|
-
gem.required_ruby_version = '>= 2.
|
22
|
+
gem.required_ruby_version = '>= 2.7'
|
25
23
|
|
26
|
-
gem.add_dependency 'dry-struct', '~> 1.
|
27
|
-
gem.add_dependency 'rom', '~> 5.
|
28
|
-
gem.add_dependency 'rom-sql', '~> 3.
|
24
|
+
gem.add_dependency 'dry-struct', '~> 1.6'
|
25
|
+
gem.add_dependency 'rom', '~> 5.3'
|
26
|
+
gem.add_dependency 'rom-sql', '~> 3.6'
|
29
27
|
|
30
|
-
gem.add_development_dependency '
|
31
|
-
gem.add_development_dependency '
|
32
|
-
gem.add_development_dependency '
|
33
|
-
gem.add_development_dependency '
|
34
|
-
gem.add_development_dependency '
|
35
|
-
gem.
|
36
|
-
gem.add_development_dependency 'sqlite3', '~> 1.3'
|
28
|
+
gem.add_development_dependency 'rake', '~> 13.0.6'
|
29
|
+
gem.add_development_dependency 'rspec', '~> 3.12.0'
|
30
|
+
gem.add_development_dependency 'rspec-core', '~> 3.12.1'
|
31
|
+
gem.add_development_dependency 'rubocop', '~> 1.5'
|
32
|
+
gem.add_development_dependency 'sqlite3', '~> 1.6'
|
33
|
+
gem.metadata['rubygems_mfa_required'] = 'true'
|
37
34
|
end
|
@@ -39,9 +39,7 @@ module LB
|
|
39
39
|
group: :remove_key_prefix_inject_for,
|
40
40
|
wrap: :remove_key_prefix_inject_hash_for
|
41
41
|
}.each do |operation, inject|
|
42
|
-
# rubocop:disable Layout/LineLength
|
43
42
|
define_method :"#{operation}_prefix" do |array, key, keys, prefix, model = nil|
|
44
|
-
# rubocop:enable Layout/LineLength
|
45
43
|
compose do |ops|
|
46
44
|
ops << t(operation, key, keys)
|
47
45
|
ops << t(:map_array,
|
@@ -21,11 +21,11 @@ module LB
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def qualify_on(on)
|
24
|
-
on.
|
24
|
+
on.to_h do |source, target|
|
25
25
|
source = source.qualified if source.respond_to?(:qualified)
|
26
26
|
target = target.qualified if target.respond_to?(:qualified)
|
27
27
|
[source, target]
|
28
|
-
end
|
28
|
+
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def prefixed(relation,
|
data/lib/lb/persistence.rb
CHANGED
data/rakelib/ci.rake
CHANGED
@@ -1,24 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
namespace :metrics do
|
4
|
+
desc 'Check code style with RuboCop'
|
5
|
+
task :rubocop do
|
6
|
+
require 'rubocop'
|
7
|
+
begin
|
8
|
+
# args = %W[--config #{config.config_file}]
|
9
|
+
args = []
|
10
|
+
raise 'Rubocop failed' unless RuboCop::CLI.new.run(args).zero?
|
11
|
+
rescue Encoding::CompatibilityError => e
|
12
|
+
abort e.message
|
13
|
+
end
|
14
|
+
end
|
7
15
|
end
|
8
16
|
|
9
|
-
desc 'Run
|
17
|
+
desc 'Run CI tasks'
|
10
18
|
task ci: %w[ci:metrics]
|
11
19
|
|
12
20
|
namespace :ci do
|
13
21
|
tasks = %w[
|
14
|
-
metrics:coverage
|
15
|
-
metrics:yardstick:verify
|
16
22
|
metrics:rubocop
|
17
|
-
metrics:flog
|
18
|
-
metrics:flay
|
19
23
|
spec:integration
|
20
24
|
]
|
21
25
|
|
22
|
-
desc 'Run metrics
|
26
|
+
desc 'Run metrics'
|
23
27
|
task metrics: tasks
|
24
28
|
end
|
data/rakelib/spec.rake
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
# Remove existing same-named tasks
|
7
|
+
%w[spec spec:unit spec:integration].each do |task|
|
8
|
+
klass = Rake::Task
|
9
|
+
klass[task].clear if klass.task_defined?(task)
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Run all specs'
|
13
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
14
|
+
task.pattern = 'spec/{unit,integration}/**/*_spec.rb'
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :spec do
|
18
|
+
desc 'Run unit specs'
|
19
|
+
RSpec::Core::RakeTask.new(:unit) do |task|
|
20
|
+
task.pattern = 'spec/unit/**/*_spec.rb'
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Run integration specs'
|
24
|
+
RSpec::Core::RakeTask.new(:integration) do |task|
|
25
|
+
task.pattern = 'spec/integration/**/*_spec.rb'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
rescue LoadError
|
29
|
+
%w[spec spec:unit spec:integration].each do |name|
|
30
|
+
task name do
|
31
|
+
warn "In order to run #{name}, do: gem install rspec"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
task test: :spec
|
data/spec/spec_helper.rb
CHANGED
@@ -7,7 +7,7 @@ describe LB::Persistence::Functions, '.group_prefix' do
|
|
7
7
|
|
8
8
|
let(:object) do
|
9
9
|
described_class.t(:group_prefix, key, keys, prefix, nested_class)
|
10
|
-
|
10
|
+
.>> described_class.t(:model, model_class)
|
11
11
|
end
|
12
12
|
|
13
13
|
let(:key) { :items }
|
@@ -7,7 +7,7 @@ describe LB::Persistence::Functions, '.wrap_prefix' do
|
|
7
7
|
|
8
8
|
let(:object) do
|
9
9
|
described_class.t(:wrap_prefix, key, keys, prefix, nested_class)
|
10
|
-
|
10
|
+
.>> described_class.t(:model, model_class)
|
11
11
|
end
|
12
12
|
|
13
13
|
let(:key) { :item }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lb-persistence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firas Zaidan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|
@@ -16,146 +16,112 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rom
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5.
|
40
|
+
version: '5.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rom-sql
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.6'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 13.0.6
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 13.0.6
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 3.12.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.12.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rspec-core
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 3.12.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: guard-rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '4.7'
|
104
|
-
- - ">="
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: 4.7.3
|
107
|
-
type: :development
|
108
|
-
prerelease: false
|
109
|
-
version_requirements: !ruby/object:Gem::Requirement
|
110
|
-
requirements:
|
111
|
-
- - "~>"
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '4.7'
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: 4.7.3
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: guard-rubocop
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '1.3'
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '1.3'
|
96
|
+
version: 3.12.1
|
131
97
|
- !ruby/object:Gem::Dependency
|
132
98
|
name: rubocop
|
133
99
|
requirement: !ruby/object:Gem::Requirement
|
134
100
|
requirements:
|
135
101
|
- - "~>"
|
136
102
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
103
|
+
version: '1.5'
|
138
104
|
type: :development
|
139
105
|
prerelease: false
|
140
106
|
version_requirements: !ruby/object:Gem::Requirement
|
141
107
|
requirements:
|
142
108
|
- - "~>"
|
143
109
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
110
|
+
version: '1.5'
|
145
111
|
- !ruby/object:Gem::Dependency
|
146
112
|
name: sqlite3
|
147
113
|
requirement: !ruby/object:Gem::Requirement
|
148
114
|
requirements:
|
149
115
|
- - "~>"
|
150
116
|
- !ruby/object:Gem::Version
|
151
|
-
version: '1.
|
117
|
+
version: '1.6'
|
152
118
|
type: :development
|
153
119
|
prerelease: false
|
154
120
|
version_requirements: !ruby/object:Gem::Requirement
|
155
121
|
requirements:
|
156
122
|
- - "~>"
|
157
123
|
- !ruby/object:Gem::Version
|
158
|
-
version: '1.
|
124
|
+
version: '1.6'
|
159
125
|
description: LB Persistence API
|
160
126
|
email:
|
161
127
|
- firas@zaidan.de
|
@@ -178,7 +144,6 @@ files:
|
|
178
144
|
- config/flog.yml
|
179
145
|
- config/mutant.yml
|
180
146
|
- config/reek.yml
|
181
|
-
- config/rubocop.yml
|
182
147
|
- config/yardstick.yml
|
183
148
|
- lb-persistence.gemspec
|
184
149
|
- lib/lb-persistence.rb
|
@@ -189,6 +154,7 @@ files:
|
|
189
154
|
- lib/lb/persistence/types.rb
|
190
155
|
- lib/lb/persistence/version.rb
|
191
156
|
- rakelib/ci.rake
|
157
|
+
- rakelib/spec.rake
|
192
158
|
- spec/shared/settings.rb
|
193
159
|
- spec/spec_helper.rb
|
194
160
|
- spec/support/helper.rb
|
@@ -202,8 +168,9 @@ files:
|
|
202
168
|
homepage: https://github.com/lb-rb/lb-persistence
|
203
169
|
licenses:
|
204
170
|
- MIT
|
205
|
-
metadata:
|
206
|
-
|
171
|
+
metadata:
|
172
|
+
rubygems_mfa_required: 'true'
|
173
|
+
post_install_message:
|
207
174
|
rdoc_options: []
|
208
175
|
require_paths:
|
209
176
|
- lib
|
@@ -212,26 +179,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
179
|
requirements:
|
213
180
|
- - ">="
|
214
181
|
- !ruby/object:Gem::Version
|
215
|
-
version: '2.
|
182
|
+
version: '2.7'
|
216
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
184
|
requirements:
|
218
185
|
- - ">="
|
219
186
|
- !ruby/object:Gem::Version
|
220
187
|
version: '0'
|
221
188
|
requirements: []
|
222
|
-
|
223
|
-
|
224
|
-
signing_key:
|
189
|
+
rubygems_version: 3.4.10
|
190
|
+
signing_key:
|
225
191
|
specification_version: 4
|
226
192
|
summary: LB Persistence API
|
227
|
-
test_files:
|
228
|
-
- spec/shared/settings.rb
|
229
|
-
- spec/spec_helper.rb
|
230
|
-
- spec/support/helper.rb
|
231
|
-
- spec/unit/lb/persistence/class_methods/new_spec.rb
|
232
|
-
- spec/unit/lb/persistence/connect_spec.rb
|
233
|
-
- spec/unit/lb/persistence/container_spec.rb
|
234
|
-
- spec/unit/lb/persistence/functions/class_methods/group_prefix_spec.rb
|
235
|
-
- spec/unit/lb/persistence/functions/class_methods/wrap_prefix_spec.rb
|
236
|
-
- spec/unit/lb/persistence/repository_spec.rb
|
237
|
-
- spec/unit/lb/persistence/uri_spec.rb
|
193
|
+
test_files: []
|
data/.rubocop.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
./config/rubocop.yml
|