mobility 1.0.2 → 1.0.7

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: 8c59ad405d9183d4a2a27905ecace4c3f25e1fdb7492646bed76866b5eefab8a
4
- data.tar.gz: 557c434ad2858d524b68a9580a0ae77b03a4361cc6e8b3b46f8883610c4c2598
3
+ metadata.gz: ddbf8662456ee4b547ed3ead85fd44a3af486cbe94d85ad77679f811a7a5b98d
4
+ data.tar.gz: 62fed63232e0bf182db5fdf9994ca3d2f50b61872b9e3c0bf4d1b4c7cf739698
5
5
  SHA512:
6
- metadata.gz: 8479d64a5db0190980afede4f638ecfb67a895312afa8c1d9d742a52c07298bf5898a0796606c9287907ebec5989dcb177ab41ced41d651f8843e057beb0e8f1
7
- data.tar.gz: fb61359a451ff909d81137365538bbdfa7726672da5bfe4ce75ee59b5ab07de9b6a9b9784708b65de998b75921551ed87ba81b3d04a27dae401c0918419b9283
6
+ metadata.gz: 449d4f885917546ffe9dab2678e39d597ecc340028e0e09293073487b8f8269ee097cea0b1ee28232cf04c05a1598d1e65be4d0be72b63b27f7e5cc543ab49bb
7
+ data.tar.gz: 19f561713598217a2f8cf18aee0d906076086adf254995d7ddaccbd3e4d5b3db27f3d402f189d935538b1ef84d8e1fe33471af746a7c8d502095baa8f9cadd12
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -21,10 +21,31 @@
21
21
  v1.0](https://github.com/shioyama/mobility/wiki/Introduction-to-Mobility-v1.0)
22
22
  for more details on how to upgrade.
23
23
 
24
- ### 1.0.2
24
+ ### 1.0.7
25
+ - Require set before using Set
26
+ ([#503](https://github.com/shioyama/mobility/pull/503))
27
+
28
+ ### 1.0.6
29
+ - Merge options including defaults into backend options
30
+ ([#502](https://github.com/shioyama/mobility/pull/502))
31
+
32
+ ### 1.0.5
33
+ - Fix duping with AR Table backend, fixes
34
+ [#490](https://github.com/shioyama/mobility/issues/490)
35
+ ([#499](https://github.com/shioyama/mobility/pull/499) and
36
+ [#501](https://github.com/shioyama/mobility/pull/501))
37
+
38
+ ### 1.0.4
39
+ - Correctly override default backend options, fixes
40
+ [#492](https://github.com/shioyama/mobility/issues/492)
41
+ ([#495](https://github.com/shioyama/mobility/pull/495))
42
+
43
+ ### 1.0.3
25
44
  - Fix `Mobility.default_backend`
26
45
  ([#497](https://github.com/shioyama/mobility/pull/497))
27
46
 
47
+ ### 1.0.2
48
+
28
49
  ### 1.0.1
29
50
 
30
51
  - Make `Mobility::Plugins::ActiveRecord::Query::VirtualRow` and
data/Gemfile.lock CHANGED
@@ -1,31 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mobility (1.0.1)
4
+ mobility (1.0.6)
5
5
  i18n (>= 0.6.10, < 2)
6
6
  request_store (~> 1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (6.0.3.4)
12
- activesupport (= 6.0.3.4)
13
- activerecord (6.0.3.4)
14
- activemodel (= 6.0.3.4)
15
- activesupport (= 6.0.3.4)
16
- activesupport (6.0.3.4)
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2, >= 2.2.2)
22
- benchmark-ips (2.8.3)
11
+ benchmark-ips (2.8.4)
23
12
  byebug (11.1.3)
24
13
  coderay (1.1.3)
25
- concurrent-ruby (1.1.7)
26
- database_cleaner (1.8.5)
14
+ concurrent-ruby (1.1.8)
15
+ database_cleaner (1.99.0)
27
16
  diff-lcs (1.4.4)
28
- ffi (1.13.1)
17
+ ffi (1.14.2)
29
18
  formatador (0.2.5)
30
19
  guard (2.16.2)
31
20
  formatador (>= 0.2.4)
@@ -41,14 +30,13 @@ GEM
41
30
  guard (~> 2.1)
42
31
  guard-compat (~> 1.1)
43
32
  rspec (>= 2.99.0, < 4.0)
44
- i18n (1.8.5)
33
+ i18n (1.8.8)
45
34
  concurrent-ruby (~> 1.0)
46
- listen (3.2.1)
35
+ listen (3.4.1)
47
36
  rb-fsevent (~> 0.10, >= 0.10.3)
48
37
  rb-inotify (~> 0.9, >= 0.9.10)
49
38
  lumberjack (1.2.8)
50
39
  method_source (1.0.0)
51
- minitest (5.14.3)
52
40
  nenv (0.3.0)
53
41
  notiffany (0.1.3)
54
42
  nenv (~> 0.1)
@@ -71,28 +59,24 @@ GEM
71
59
  rspec-core (~> 3.10.0)
72
60
  rspec-expectations (~> 3.10.0)
73
61
  rspec-mocks (~> 3.10.0)
74
- rspec-core (3.10.0)
62
+ rspec-core (3.10.1)
75
63
  rspec-support (~> 3.10.0)
76
- rspec-expectations (3.10.0)
64
+ rspec-expectations (3.10.1)
77
65
  diff-lcs (>= 1.2.0, < 2.0)
78
66
  rspec-support (~> 3.10.0)
79
- rspec-mocks (3.10.0)
67
+ rspec-mocks (3.10.2)
80
68
  diff-lcs (>= 1.2.0, < 2.0)
81
69
  rspec-support (~> 3.10.0)
82
- rspec-support (3.10.0)
70
+ rspec-support (3.10.2)
71
+ sequel (5.41.0)
83
72
  shellany (0.0.1)
84
- thor (1.0.1)
85
- thread_safe (0.3.6)
86
- tzinfo (1.2.9)
87
- thread_safe (~> 0.1)
88
- yard (0.9.25)
89
- zeitwerk (2.4.2)
73
+ thor (1.1.0)
74
+ yard (0.9.26)
90
75
 
91
76
  PLATFORMS
92
77
  ruby
93
78
 
94
79
  DEPENDENCIES
95
- activerecord (~> 6.0.0)
96
80
  benchmark-ips
97
81
  database_cleaner (~> 1.5, >= 1.5.3)
98
82
  guard-rspec
@@ -101,6 +85,7 @@ DEPENDENCIES
101
85
  pry-byebug
102
86
  rake (~> 12, >= 12.2.1)
103
87
  rspec (~> 3.0)
88
+ sequel (~> 5.0)
104
89
  yard (~> 0.9.0)
105
90
 
106
91
  BUNDLED WITH
data/README.md CHANGED
@@ -56,7 +56,7 @@ To use the latest pre-version of Mobility 1.0, add this line to your
56
56
  application's Gemfile:
57
57
 
58
58
  ```ruby
59
- gem 'mobility', '~> 1.0.2'
59
+ gem 'mobility', '~> 1.0.7'
60
60
  ```
61
61
 
62
62
  ### ActiveRecord (Rails)
data/lib/mobility.rb CHANGED
@@ -107,7 +107,7 @@ module Mobility
107
107
  # Alias to default backend defined on *translations_class+.
108
108
  # @return [Symbol,Class]
109
109
  def default_backend
110
- translations_class.defaults[:backend]
110
+ translations_class.defaults[:backend]&.first
111
111
  end
112
112
 
113
113
  # Configure Mobility
@@ -274,6 +274,12 @@ columns to that table.
274
274
  define_method :initialize_dup do |source|
275
275
  super(source)
276
276
  self.send("#{association_name}=", source.send(association_name).map(&:dup))
277
+
278
+ # for cache
279
+ # FIXME: do this better
280
+ if options[:cache]
281
+ instance_variable_set(:"@__mobility_#{association_name}_cache", {})
282
+ end
277
283
  end
278
284
  end
279
285
  include const_set(module_name, dupable)
@@ -1,4 +1,5 @@
1
1
  # frozen-string-literal: true
2
+ require "set"
2
3
  require "mobility/util"
3
4
  require "mobility/backends/sequel"
4
5
  require "mobility/backends/key_value"
@@ -1,5 +1,6 @@
1
1
  # frozen-string-literal: true
2
2
  require "tsort"
3
+ require "set"
3
4
  require "mobility/util"
4
5
 
5
6
  module Mobility
@@ -33,13 +33,6 @@ Defines:
33
33
  def initialize(*args, **original_options)
34
34
  super
35
35
 
36
- # Validate that the default backend from config has valid keys
37
- if (default = self.class.defaults[:backend])
38
- name, backend_options = default
39
- extra_keys = backend_options.keys - backend.valid_keys
40
- raise InvalidOptionKey, "These are not valid #{name} backend keys: #{extra_keys.join(', ')}." unless extra_keys.empty?
41
- end
42
-
43
36
  include InstanceMethods
44
37
  end
45
38
 
@@ -87,10 +80,10 @@ Defines:
87
80
 
88
81
  case options[:backend]
89
82
  when String, Symbol, Class
90
- @backend, @backend_options = options[:backend], options
83
+ @backend, @backend_options = options[:backend], options.dup
91
84
  when Array
92
85
  @backend, @backend_options = options[:backend]
93
- @backend_options = @backend_options.merge(original_options)
86
+ @backend_options = @backend_options.merge(options)
94
87
  when NilClass
95
88
  @backend = @backend_options = nil
96
89
  else
@@ -105,6 +98,14 @@ Defines:
105
98
  def validate_options(options)
106
99
  return super unless backend
107
100
  super(options.slice(*(options.keys - backend.valid_keys)))
101
+
102
+ # Validate that the default backend from config has valid keys, or if
103
+ # it is overridden by an array input that the array has valid keys.
104
+ if options[:backend].is_a?(Array)
105
+ name, backend_options = options[:backend]
106
+ extra_keys = backend_options.keys - backend.valid_keys
107
+ raise InvalidOptionKey, "These are not valid #{name} backend keys: #{extra_keys.join(', ')}." unless extra_keys.empty?
108
+ end
108
109
  end
109
110
 
110
111
  # Override default argument-handling in DSL to store kwargs passed along
@@ -8,7 +8,7 @@ module Mobility
8
8
  module VERSION
9
9
  MAJOR = 1
10
10
  MINOR = 0
11
- TINY = 2
11
+ TINY = 7
12
12
  PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
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.0.2
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Salzberg
@@ -34,7 +34,7 @@ cert_chain:
34
34
  gSQml7TqcC6dZRsZRwYqzD9kUwdAJoCqno2CBUKs2l0yQAjFT36lRrVJznb7uWwa
35
35
  xpPFnsrtyaZW6Dty8TSG3qzmeGpmpIotA8x1VA==
36
36
  -----END CERTIFICATE-----
37
- date: 2021-01-24 00:00:00.000000000 Z
37
+ date: 2021-02-04 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: request_store
metadata.gz.sig CHANGED
Binary file