amoeba 3.3.0 → 3.4.0

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/activerecord_head.yml +26 -0
  3. data/.github/workflows/jruby.yml +4 -1
  4. data/.github/workflows/rspec.yml +49 -0
  5. data/.github/workflows/rubocop.yml +20 -0
  6. data/.gitignore +1 -0
  7. data/.rubocop.yml +2 -2
  8. data/.rubocop_todo.yml +64 -35
  9. data/Appraisals +25 -15
  10. data/CHANGELOG.md +54 -0
  11. data/Gemfile +1 -0
  12. data/README.md +26 -1
  13. data/amoeba.gemspec +10 -12
  14. data/docs/contributing.md +19 -0
  15. data/docs/test_refactor.md +20 -0
  16. data/gemfiles/activerecord_6.1.gemfile +8 -0
  17. data/gemfiles/activerecord_7.0.gemfile +3 -0
  18. data/gemfiles/{activerecord_6.0.gemfile → activerecord_7.1.gemfile} +3 -1
  19. data/gemfiles/{activerecord_5.2.gemfile → activerecord_8.0.gemfile} +4 -2
  20. data/gemfiles/activerecord_8.1.gemfile +21 -0
  21. data/gemfiles/activerecord_head.gemfile +3 -1
  22. data/gemfiles/jruby_activerecord_7.0.gemfile +2 -2
  23. data/gemfiles/jruby_activerecord_head.gemfile +2 -0
  24. data/lib/amoeba/cloner.rb +4 -2
  25. data/lib/amoeba/config.rb +8 -3
  26. data/lib/amoeba/version.rb +1 -1
  27. data/spec/lib/amoeba_spec.rb +405 -225
  28. data/spec/spec_helper.rb +3 -1
  29. data/spec/support/data.rb +2 -0
  30. data/spec/support/models.rb +11 -2
  31. data/spec/support/schema.rb +2 -0
  32. metadata +26 -43
  33. data/.github/workflows/ruby_25.yml +0 -30
  34. data/.github/workflows/ruby_26.yml +0 -30
  35. data/.github/workflows/ruby_27.yml +0 -30
  36. data/.github/workflows/ruby_30.yml +0 -34
  37. data/.github/workflows/ruby_31.yml +0 -34
  38. data/.github/workflows/ruby_32.yml +0 -34
  39. data/.github/workflows/ruby_head.yml +0 -34
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
4
 
3
5
  SimpleCov.start do
@@ -30,7 +32,7 @@ adapter = if defined?(JRuby)
30
32
  ActiveRecord::Base.establish_connection(adapter: adapter, database: ':memory:')
31
33
 
32
34
  ::RSpec.configure do |config|
33
- config.order = :default
35
+ config.order = :defined
34
36
  end
35
37
 
36
38
  load File.dirname(__FILE__) + '/support/schema.rb'
data/spec/support/data.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  u1 = User.create(name: 'Robert Johnson', email: 'bob@crossroads.com')
2
4
  u2 = User.create(name: 'Miles Davis', email: 'miles@kindofblue.com')
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Topic < ActiveRecord::Base
2
4
  has_many :posts
3
5
  end
@@ -108,7 +110,7 @@ class CustomThing < ActiveRecord::Base
108
110
  end
109
111
  end
110
112
 
111
- serialize :value, ArrayPack
113
+ serialize :value, coder: ArrayPack
112
114
 
113
115
  before_create :hydrate_me
114
116
 
@@ -202,7 +204,7 @@ class Product < ActiveRecord::Base
202
204
  has_many :images
203
205
  has_and_belongs_to_many :sections
204
206
 
205
- SECTION_COUNT_QUERY = 'SELECT COUNT(*) AS section_count FROM products_sections WHERE product_id = ?'.freeze
207
+ SECTION_COUNT_QUERY = 'SELECT COUNT(*) AS section_count FROM products_sections WHERE product_id = ?'
206
208
 
207
209
  amoeba do
208
210
  enable
@@ -218,6 +220,13 @@ class Section < ActiveRecord::Base
218
220
  end
219
221
 
220
222
  class Image < ActiveRecord::Base
223
+ def truthy?
224
+ true
225
+ end
226
+
227
+ def falsey?
228
+ false
229
+ end
221
230
  end
222
231
 
223
232
  class Shirt < Product
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ActiveRecord::Schema.define do
2
4
  self.verbose = false
3
5
 
metadata CHANGED
@@ -1,118 +1,100 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amoeba
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vaughn Draughon
8
8
  - Oleksandr Simonov
9
- autorequire:
9
+ - Joseph Haig
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-30 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 3.0.0
20
+ version: 3.13.0
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 3.0.0
27
+ version: 3.13.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rubocop
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.16'
34
+ version: 1.71.0
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.16'
41
+ version: 1.71.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rubocop-rake
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0.6'
48
+ version: 0.6.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0.6'
55
+ version: 0.6.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rubocop-rspec
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '2.4'
62
+ version: 2.27.1
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '2.4'
70
- - !ruby/object:Gem::Dependency
71
- name: sqlite3
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '1.3'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '1.3'
69
+ version: 2.27.1
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: activerecord
86
72
  requirement: !ruby/object:Gem::Requirement
87
73
  requirements:
88
74
  - - ">="
89
75
  - !ruby/object:Gem::Version
90
- version: 5.2.0
76
+ version: 6.1.0
91
77
  type: :runtime
92
78
  prerelease: false
93
79
  version_requirements: !ruby/object:Gem::Requirement
94
80
  requirements:
95
81
  - - ">="
96
82
  - !ruby/object:Gem::Version
97
- version: 5.2.0
83
+ version: 6.1.0
98
84
  description: |
99
85
  An extension to ActiveRecord to allow the duplication method to also copy associated children, with recursive support for nested of grandchildren. The behavior is controllable with a simple DSL both on your rails models and on the fly, i.e. per instance. Numerous configuration styles and preprocessing directives are included for power and flexibility. Supports preprocessing of field values to prepend strings such as "Copy of ", to nullify or process field values with regular expressions. Supports most association types including has_one :through and has_many :through.
100
86
 
101
87
  Tags: copy child associations, copy nested children, copy associated child records, nested copy, copy associations, copy relations, copy relationships, duplicate associations, duplicate associated records, duplicate child records, duplicate children, copy all, duplicate all, clone child associations, clone nested children, clone associated child records, nested clone, clone associations, clone relations, clone relationships, cloning child associations, cloning nested children, cloning associated child records, deep_cloning, nested cloning, cloning associations, cloning relations, cloning relationships, cloning child associations, cloning nested children, cloning associated child records, nested cloning, cloning associations, cloning relations, cloning relationships, cloning child associations, cloning nested children, cloning associated child records, deep_cloning, nested cloning, cloning associations, cloning relations, cloning relationships, duplicate child associations, duplicate nested children, duplicate associated child records, nested duplicate, duplicate associations, duplicate relations, duplicate relationships, duplicate child associations, duplicate nested children, duplicate associated child records, deep_duplicate, nested duplicate, duplicate associations, duplicate relations, duplicate relationships, deep_copy, deep_clone, deep_cloning, deep clone, deep cloning, has_one, has_many, has_and_belongs_to_many
102
- email: alex@simonov.me
88
+ email: josephhaig@gmail.com
103
89
  executables: []
104
90
  extensions: []
105
91
  extra_rdoc_files: []
106
92
  files:
107
93
  - ".cane"
94
+ - ".github/workflows/activerecord_head.yml"
108
95
  - ".github/workflows/jruby.yml"
109
- - ".github/workflows/ruby_25.yml"
110
- - ".github/workflows/ruby_26.yml"
111
- - ".github/workflows/ruby_27.yml"
112
- - ".github/workflows/ruby_30.yml"
113
- - ".github/workflows/ruby_31.yml"
114
- - ".github/workflows/ruby_32.yml"
115
- - ".github/workflows/ruby_head.yml"
96
+ - ".github/workflows/rspec.yml"
97
+ - ".github/workflows/rubocop.yml"
116
98
  - ".gitignore"
117
99
  - ".rspec"
118
100
  - ".rubocop.yml"
@@ -125,10 +107,13 @@ files:
125
107
  - Rakefile
126
108
  - amoeba.gemspec
127
109
  - defaults.reek
128
- - gemfiles/activerecord_5.2.gemfile
129
- - gemfiles/activerecord_6.0.gemfile
110
+ - docs/contributing.md
111
+ - docs/test_refactor.md
130
112
  - gemfiles/activerecord_6.1.gemfile
131
113
  - gemfiles/activerecord_7.0.gemfile
114
+ - gemfiles/activerecord_7.1.gemfile
115
+ - gemfiles/activerecord_8.0.gemfile
116
+ - gemfiles/activerecord_8.1.gemfile
132
117
  - gemfiles/activerecord_head.gemfile
133
118
  - gemfiles/jruby_activerecord_7.0.gemfile
134
119
  - gemfiles/jruby_activerecord_head.gemfile
@@ -152,7 +137,6 @@ homepage: http://github.com/amoeba-rb/amoeba
152
137
  licenses:
153
138
  - BSD-2-Clause
154
139
  metadata: {}
155
- post_install_message:
156
140
  rdoc_options: []
157
141
  require_paths:
158
142
  - lib
@@ -160,15 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
144
  requirements:
161
145
  - - ">="
162
146
  - !ruby/object:Gem::Version
163
- version: '2.5'
147
+ version: '3.0'
164
148
  required_rubygems_version: !ruby/object:Gem::Requirement
165
149
  requirements:
166
150
  - - ">="
167
151
  - !ruby/object:Gem::Version
168
152
  version: '0'
169
153
  requirements: []
170
- rubygems_version: 3.4.10
171
- signing_key:
154
+ rubygems_version: 4.0.16
172
155
  specification_version: 4
173
156
  summary: Easy copying of rails models and their child associations.
174
157
  test_files: []
@@ -1,30 +0,0 @@
1
- name: Ruby 2.5
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
-
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- gemfile: [ activerecord_5.2, activerecord_6.0, activerecord_6.1 ]
16
- env:
17
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
18
- steps:
19
- - uses: actions/checkout@v4
20
- - name: Set up Ruby
21
- uses: ruby/setup-ruby@v1
22
- with:
23
- ruby-version: 2.5
24
- bundler-cache: true
25
- - name: Run tests
26
- run: bundle exec rspec
27
- - name: Coveralls
28
- uses: coverallsapp/github-action@master
29
- with:
30
- github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,30 +0,0 @@
1
- name: Ruby 2.6
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
-
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- gemfile: [ activerecord_5.2, activerecord_6.0, activerecord_6.1 ]
16
- env:
17
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
18
- steps:
19
- - uses: actions/checkout@v4
20
- - name: Set up Ruby
21
- uses: ruby/setup-ruby@v1
22
- with:
23
- ruby-version: 2.6
24
- bundler-cache: true
25
- - name: Run tests
26
- run: bundle exec rspec
27
- - name: Coveralls
28
- uses: coverallsapp/github-action@master
29
- with:
30
- github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,30 +0,0 @@
1
- name: Ruby 2.7
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
-
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- gemfile: [ activerecord_5.2, activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
16
- env:
17
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
18
- steps:
19
- - uses: actions/checkout@v4
20
- - name: Set up Ruby
21
- uses: ruby/setup-ruby@v1
22
- with:
23
- ruby-version: 2.7
24
- bundler-cache: true
25
- - name: Run tests
26
- run: bundle exec rspec
27
- - name: Coveralls
28
- uses: coverallsapp/github-action@master
29
- with:
30
- github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,34 +0,0 @@
1
- name: Ruby 3.0
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
-
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
16
- # sqlite 1.3 is not compatible with Ruby 3.0+. If this changes or
17
- # sqlite is no longer a dependency then the Active Record 5.2 tests
18
- # can be added:
19
- # gemfile: [ activerecord_5.2, activerecord_6.0, activerecord_6.1, activerecord_head ]
20
- env:
21
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
22
- steps:
23
- - uses: actions/checkout@v4
24
- - name: Set up Ruby
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: 3.0
28
- bundler-cache: true
29
- - name: Run tests
30
- run: bundle exec rspec
31
- - name: Coveralls
32
- uses: coverallsapp/github-action@master
33
- with:
34
- github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,34 +0,0 @@
1
- name: Ruby 3.1
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
-
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
16
- # sqlite 1.3 is not compatible with Ruby 3.0+. If this changes or
17
- # sqlite is no longer a dependency then the Active Record 5.2 tests
18
- # can be added:
19
- # gemfile: [ activerecord_5.2, activerecord_6.0, activerecord_6.1, activerecord_head ]
20
- env:
21
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
22
- steps:
23
- - uses: actions/checkout@v4
24
- - name: Set up Ruby
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: 3.1
28
- bundler-cache: true
29
- - name: Run tests
30
- run: bundle exec rspec
31
- - name: Coveralls
32
- uses: coverallsapp/github-action@master
33
- with:
34
- github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,34 +0,0 @@
1
- name: Ruby 3.2
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
-
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
16
- # sqlite 1.3 is not compatible with Ruby 3.0+. If this changes or
17
- # sqlite is no longer a dependency then the Active Record 5.2 tests
18
- # can be added:
19
- # gemfile: [ activerecord_5.2, activerecord_6.0, activerecord_6.1, activerecord_head ]
20
- env:
21
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
22
- steps:
23
- - uses: actions/checkout@v4
24
- - name: Set up Ruby
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: 3.2
28
- bundler-cache: true
29
- - name: Run tests
30
- run: bundle exec rspec
31
- - name: Coveralls
32
- uses: coverallsapp/github-action@master
33
- with:
34
- github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,34 +0,0 @@
1
- name: Ruby head
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
-
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
16
- # sqlite 1.3 is not compatible with Ruby 3.0+. If this changes or
17
- # sqlite is no longer a dependency then the Active Record 5.2 tests
18
- # can be added:
19
- # gemfile: [ activerecord_5.2, activerecord_6.0, activerecord_6.1, activerecord_head ]
20
- env:
21
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
22
- steps:
23
- - uses: actions/checkout@v4
24
- - name: Set up Ruby
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: head
28
- bundler-cache: true
29
- - name: Run tests
30
- run: bundle exec rspec
31
- - name: Coveralls
32
- uses: coverallsapp/github-action@master
33
- with:
34
- github-token: ${{ secrets.GITHUB_TOKEN }}