mobility 1.2.5 → 1.2.8

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: ad89c4b8f858e06961d867d4d6fef4ae2b7fa05228c29beb1262d6bdfbd60eff
4
- data.tar.gz: 8e626e914ffc5533cd1d7932f66bf7c14acaeae2b0b1bd9cba17539a23389fb6
3
+ metadata.gz: 17bc48ee3eb32c8a9590bd2272a584cd2c6419464acd55466513e0d2e3c296f2
4
+ data.tar.gz: e29dbc1fb5276e466e3da8d8d88bf0ac6c993589dcb69603ac90881b33296b0b
5
5
  SHA512:
6
- metadata.gz: 4d1d31e256f1f2cd9c04ed2f83d73dcef576248bbc0dfc28550da9d2d7e9c66aef0df73ab955324b0669dfdd13ad2bf790049125e16bd9a263d8c3df10713c84
7
- data.tar.gz: 00a3d9bd1b1fd47fd0e9c732d9ee40709761490029269b629500c876b5d4acdb847e8c512a8de9329a213578202430120b956adb322c7921300895f9dabd8931
6
+ metadata.gz: b938078ab08169631d98f8437109f391ab6ea942813652be76f30b94d986753aa0c0fb826b1e3e738372dc874273d944a2082afe97a4799a8648e39002d340f3
7
+ data.tar.gz: 99c18855141b073b7530eae978c7873727d40ef4e6eb22d7f5c84a0c4880e20f1586f3293776cde460794cc37ff88710a6b612b5a3552a4f6ee39abca074e347
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  ## 1.2
4
4
 
5
+ ### 1.2.8
6
+ - Fix issues with subclassing, such as when using AR STI,
7
+ fixes [#566](https://github.com/shioyama/mobility/issues/566)
8
+ ([#568](https://github.com/shioyama/mobility/pull/568))
9
+ - Handle attribute_method_matchers rename (part of #560)
10
+
11
+ ### 1.2.7
12
+ - Do not query same attribute more than once, fixes
13
+ [#564](https://github.com/shioyama/mobility/pull/578)
14
+ ([#577](https://github.com/shioyama/mobility/pull/577))
15
+
16
+ ### 1.2.6
17
+ - Require mfa on rubygems
18
+ ([#545](https://github.com/shioyama/mobility/pull/545))
19
+
5
20
  ### 1.2.5
6
21
  - Avoid referencing ActiveRecord::Base
7
22
  ([#550](https://github.com/shioyama/mobility/pull/550))
data/Gemfile CHANGED
@@ -8,11 +8,11 @@ orm, orm_version = ENV['ORM'], ENV['ORM_VERSION']
8
8
  group :development, :test do
9
9
  case orm
10
10
  when 'active_record'
11
- orm_version ||= '6.1'
11
+ orm_version ||= '7.0'
12
12
  case orm_version
13
- when '4.2', '5.0', '5.1', '5.2', '6.0', '6.1'
13
+ when '4.2', '5.0', '5.1', '5.2', '6.0', '6.1', '7.0'
14
14
  gem 'activerecord', "~> #{orm_version}.0"
15
- when '7.0'
15
+ when 'edge'
16
16
  git 'https://github.com/rails/rails.git', branch: 'main' do
17
17
  gem 'activerecord'
18
18
  gem 'activesupport'
data/Gemfile.lock CHANGED
@@ -1,15 +1,16 @@
1
1
  GIT
2
2
  remote: https://github.com/rails/rails.git
3
- revision: 5647a9c1ced68d20338552d47a3b755e10a271c4
3
+ revision: ed3130a41d7728b2e650c1b9093545e0d06af489
4
4
  branch: main
5
5
  specs:
6
- activemodel (7.0.0.alpha2)
7
- activesupport (= 7.0.0.alpha2)
8
- activerecord (7.0.0.alpha2)
9
- activemodel (= 7.0.0.alpha2)
10
- activesupport (= 7.0.0.alpha2)
11
- activesupport (7.0.0.alpha2)
6
+ activemodel (7.1.0.alpha)
7
+ activesupport (= 7.1.0.alpha)
8
+ activerecord (7.1.0.alpha)
9
+ activemodel (= 7.1.0.alpha)
10
+ activesupport (= 7.1.0.alpha)
11
+ activesupport (7.1.0.alpha)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ connection_pool (>= 2.2.5)
13
14
  i18n (>= 1.6, < 2)
14
15
  minitest (>= 5.1)
15
16
  tzinfo (~> 2.0)
@@ -24,14 +25,15 @@ PATH
24
25
  GEM
25
26
  remote: https://rubygems.org/
26
27
  specs:
27
- benchmark-ips (2.9.1)
28
+ benchmark-ips (2.10.0)
28
29
  byebug (11.1.3)
29
30
  coderay (1.1.3)
30
- concurrent-ruby (1.1.9)
31
+ concurrent-ruby (1.1.10)
32
+ connection_pool (2.2.5)
31
33
  database_cleaner (1.99.0)
32
- diff-lcs (1.4.4)
33
- ffi (1.15.4)
34
- formatador (0.3.0)
34
+ diff-lcs (1.5.0)
35
+ ffi (1.15.5)
36
+ formatador (1.1.0)
35
37
  guard (2.18.0)
36
38
  formatador (>= 0.2.4)
37
39
  listen (>= 2.7, < 4.0)
@@ -46,50 +48,52 @@ GEM
46
48
  guard (~> 2.1)
47
49
  guard-compat (~> 1.1)
48
50
  rspec (>= 2.99.0, < 4.0)
49
- i18n (1.8.10)
51
+ i18n (1.10.0)
50
52
  concurrent-ruby (~> 1.0)
51
- listen (3.7.0)
53
+ listen (3.7.1)
52
54
  rb-fsevent (~> 0.10, >= 0.10.3)
53
55
  rb-inotify (~> 0.9, >= 0.9.10)
54
56
  lumberjack (1.2.8)
55
57
  method_source (1.0.0)
56
- minitest (5.14.4)
58
+ minitest (5.16.0)
57
59
  nenv (0.3.0)
58
60
  notiffany (0.1.3)
59
61
  nenv (~> 0.1)
60
62
  shellany (~> 0.0)
61
- pg (1.2.3)
63
+ pg (1.3.5)
62
64
  pry (0.13.1)
63
65
  coderay (~> 1.1)
64
66
  method_source (~> 1.0)
65
67
  pry-byebug (3.9.0)
66
68
  byebug (~> 11.0)
67
69
  pry (~> 0.13.0)
68
- rack (2.2.3)
70
+ rack (2.2.3.1)
69
71
  rake (12.3.3)
70
- rb-fsevent (0.11.0)
72
+ rb-fsevent (0.11.1)
71
73
  rb-inotify (0.10.1)
72
74
  ffi (~> 1.0)
73
- request_store (1.5.0)
75
+ request_store (1.5.1)
74
76
  rack (>= 1.4)
75
- rspec (3.10.0)
76
- rspec-core (~> 3.10.0)
77
- rspec-expectations (~> 3.10.0)
78
- rspec-mocks (~> 3.10.0)
79
- rspec-core (3.10.1)
80
- rspec-support (~> 3.10.0)
81
- rspec-expectations (3.10.1)
77
+ rspec (3.11.0)
78
+ rspec-core (~> 3.11.0)
79
+ rspec-expectations (~> 3.11.0)
80
+ rspec-mocks (~> 3.11.0)
81
+ rspec-core (3.11.0)
82
+ rspec-support (~> 3.11.0)
83
+ rspec-expectations (3.11.0)
82
84
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.10.0)
84
- rspec-mocks (3.10.2)
85
+ rspec-support (~> 3.11.0)
86
+ rspec-mocks (3.11.1)
85
87
  diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.10.0)
87
- rspec-support (3.10.2)
88
+ rspec-support (~> 3.11.0)
89
+ rspec-support (3.11.0)
88
90
  shellany (0.0.1)
89
- thor (1.1.0)
91
+ thor (1.2.1)
90
92
  tzinfo (2.0.4)
91
93
  concurrent-ruby (~> 1.0)
92
- yard (0.9.26)
94
+ webrick (1.7.0)
95
+ yard (0.9.28)
96
+ webrick (~> 1.7.0)
93
97
 
94
98
  PLATFORMS
95
99
  ruby
data/README.md CHANGED
@@ -55,7 +55,7 @@ Installation
55
55
  Add this line to your application's Gemfile:
56
56
 
57
57
  ```ruby
58
- gem 'mobility', '~> 1.2.5'
58
+ gem 'mobility', '~> 1.2.8'
59
59
  ```
60
60
 
61
61
  ### ActiveRecord (Rails)
@@ -153,7 +153,13 @@ the ActiveRecord dirty plugin for more information.
153
153
  # suffixes is simplest given they change from Rails version to version.
154
154
  def patterns
155
155
  @patterns ||=
156
- (klass.attribute_method_matchers.map { |p| "#{p.prefix}%s#{p.suffix}" } - excluded_patterns)
156
+ begin
157
+ # Method name changes in Rails 7.1
158
+ attribute_method_patterns = klass.respond_to?(:attribute_method_patterns) ?
159
+ klass.attribute_method_patterns :
160
+ klass.attribute_method_matchers
161
+ attribute_method_patterns.map { |p| "#{p.prefix}%s#{p.suffix}" } - excluded_patterns
162
+ end
157
163
  end
158
164
 
159
165
  private
@@ -223,10 +223,13 @@ enabled for any one attribute on the model.
223
223
 
224
224
  keys, predicates = opts.keys.map(&:to_s), []
225
225
 
226
+ used_keys = []
227
+
226
228
  query_map = mods.inject(IDENTITY) do |qm, mod|
227
- i18n_keys = mod.names & keys
229
+ i18n_keys = mod.names & keys - used_keys
228
230
  next qm if i18n_keys.empty?
229
231
 
232
+ used_keys += i18n_keys
230
233
  mod_predicates = i18n_keys.map do |key|
231
234
  build_predicate(scope.backend_node(key.to_sym, locale), opts.delete(key))
232
235
  end
@@ -159,16 +159,22 @@ Defines:
159
159
  raise KeyError, "No backend for: #{name}"
160
160
  end
161
161
 
162
- def inherited(klass)
163
- parent_classes = mobility_backend_classes.freeze # ensure backend classes are not modified after being inherited
164
- klass.class_eval { @mobility_backend_classes = parent_classes.dup }
165
- super
166
- end
167
-
168
162
  protected
169
163
 
170
164
  def mobility_backend_classes
171
- @mobility_backend_classes ||= {}
165
+ if @mobility_backend_classes
166
+ @mobility_backend_classes
167
+ else
168
+ @mobility_backend_classes = {}
169
+ parent_class = self.superclass
170
+ while parent_class&.respond_to?(:mobility_backend_classes, true)
171
+ # ensure backend classes are not modified after being inherited
172
+ parent_class_classes = parent_class.mobility_backend_classes.freeze
173
+ @mobility_backend_classes.merge!(parent_class_classes)
174
+ parent_class = parent_class.superclass
175
+ end
176
+ @mobility_backend_classes
177
+ end
172
178
  end
173
179
  end
174
180
 
@@ -135,10 +135,13 @@ ActiveRecord query plugin.
135
135
  keys, predicates = cond.keys, []
136
136
  model = dataset.model
137
137
 
138
+ used_keys = []
139
+
138
140
  query_map = attribute_modules(model).inject(IDENTITY) do |qm, mod|
139
- i18n_keys = mod.names.map(&:to_sym) & keys
141
+ i18n_keys = mod.names.map(&:to_sym) & keys - used_keys
140
142
  next qm if i18n_keys.empty?
141
143
 
144
+ used_keys += i18n_keys
142
145
  mod_predicates = i18n_keys.map do |key|
143
146
  build_predicate(dataset.backend_op(key, locale), cond.delete(key))
144
147
  end
@@ -8,7 +8,7 @@ module Mobility
8
8
  module VERSION
9
9
  MAJOR = 1
10
10
  MINOR = 2
11
- TINY = 5
11
+ TINY = 8
12
12
  PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Salzberg
@@ -11,8 +11,8 @@ cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhjaHJp
14
- cy9EQz1kZWppbWF0YS9EQz1jb20wHhcNMjEwMjE4MTMxMzA5WhcNMjIwMjE4MTMx
15
- MzA5WjAjMSEwHwYDVQQDDBhjaHJpcy9EQz1kZWppbWF0YS9EQz1jb20wggGiMA0G
14
+ cy9EQz1kZWppbWF0YS9EQz1jb20wHhcNMjIwMzAyMDMyMTA5WhcNMjMwMzAyMDMy
15
+ MTA5WjAjMSEwHwYDVQQDDBhjaHJpcy9EQz1kZWppbWF0YS9EQz1jb20wggGiMA0G
16
16
  CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDURCKbt5oY0sCp4kYK1u5SLzVHg6Q1
17
17
  2LejeQvUGpR3gulWqrq/507XRxE/9FSpLfgo3cGGYio1/gg2Yp7pBI4ZNEz8d2Vg
18
18
  6caWLHYtHYF0/jlo177UspEF1bt3lCCmaA/ZyQpvoLi76Jf6VCBjepMqhLjeBSsA
@@ -24,17 +24,17 @@ cert_chain:
24
24
  XL6xoRitCG7CX0IqmMKuLiKA/J0amAikHGsCAwEAAaN3MHUwCQYDVR0TBAIwADAL
25
25
  BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFMNUGAhS68egZT6DOfJwrfIdCtT/MB0GA1Ud
26
26
  EQQWMBSBEmNocmlzQGRlamltYXRhLmNvbTAd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FR46jpfZVlgt0K5XBQVNvp/A
34
+ QHgocnSksU5GOM+G2UhjVycbTamd+bCxjWAZTEDZNafFt5CmnfK1D1UTIblR/ci9
35
+ fUDdW+GhxhobB8N1mtDRlhELoxLLjx7mSvJ3Wg==
36
36
  -----END CERTIFICATE-----
37
- date: 2021-12-04 00:00:00.000000000 Z
37
+ date: 2022-06-18 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: request_store
@@ -249,7 +249,9 @@ licenses:
249
249
  metadata:
250
250
  homepage_uri: https://github.com/shioyama/mobility
251
251
  source_code_uri: https://github.com/shioyama/mobility
252
+ bug_tracker_uri: https://github.com/shioyama/mobility/issues
252
253
  changelog_uri: https://github.com/shioyama/mobility/blob/master/CHANGELOG.md
254
+ rubygems_mfa_required: 'true'
253
255
  post_install_message: |2
254
256
 
255
257
  Warning: Mobility v1.0 includes backwards-incompatible changes (mostly around configuration).
metadata.gz.sig CHANGED
Binary file