amoeba 1.2.1 → 3.2.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.
- checksums.yaml +7 -0
- data/.cane +4 -0
- data/.gitignore +4 -1
- data/.rspec +2 -0
- data/.rubocop.yml +17 -0
- data/.travis.yml +110 -0
- data/Appraisals +76 -0
- data/Gemfile +11 -3
- data/README.md +763 -529
- data/Rakefile +6 -1
- data/amoeba.gemspec +20 -15
- data/defaults.reek +11 -0
- data/gemfiles/activerecord_4.2.gemfile +18 -0
- data/gemfiles/activerecord_5.0.gemfile +18 -0
- data/gemfiles/activerecord_5.1.gemfile +18 -0
- data/gemfiles/activerecord_5.2.gemfile +18 -0
- data/gemfiles/activerecord_6.0.gemfile +18 -0
- data/gemfiles/activerecord_6.1.gemfile +18 -0
- data/gemfiles/activerecord_head.gemfile +24 -0
- data/gemfiles/jruby_activerecord_6.1.gemfile +19 -0
- data/gemfiles/jruby_activerecord_head.gemfile +28 -0
- data/lib/amoeba.rb +13 -517
- data/lib/amoeba/class_methods.rb +28 -0
- data/lib/amoeba/cloner.rb +172 -0
- data/lib/amoeba/config.rb +182 -0
- data/lib/amoeba/instance_methods.rb +37 -0
- data/lib/amoeba/macros.rb +14 -0
- data/lib/amoeba/macros/base.rb +26 -0
- data/lib/amoeba/macros/has_and_belongs_to_many.rb +19 -0
- data/lib/amoeba/macros/has_many.rb +42 -0
- data/lib/amoeba/macros/has_one.rb +15 -0
- data/lib/amoeba/version.rb +1 -1
- data/spec/lib/amoeba_spec.rb +336 -111
- data/spec/spec_helper.rb +24 -3
- data/spec/support/data.rb +65 -84
- data/spec/support/models.rb +241 -25
- data/spec/support/schema.rb +102 -41
- metadata +63 -70
- data/.rvmrc +0 -1
data/spec/support/schema.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
ActiveRecord::Schema.define do
|
2
2
|
self.verbose = false
|
3
3
|
|
4
|
-
create_table :topics, :
|
4
|
+
create_table :topics, force: true do |t|
|
5
5
|
t.string :title
|
6
6
|
t.string :description
|
7
|
-
t.timestamps
|
7
|
+
t.timestamps null: true
|
8
8
|
end
|
9
9
|
|
10
|
-
create_table :posts, :
|
10
|
+
create_table :posts, force: true do |t|
|
11
11
|
t.integer :topic_id
|
12
12
|
t.integer :owner_id
|
13
13
|
t.integer :author_id
|
14
14
|
t.string :title
|
15
15
|
t.string :contents
|
16
|
-
t.timestamps
|
16
|
+
t.timestamps null: true
|
17
17
|
end
|
18
18
|
|
19
|
-
create_table :products, :
|
19
|
+
create_table :products, force: true do |t|
|
20
20
|
t.string :type
|
21
21
|
t.string :title
|
22
22
|
t.decimal :price
|
@@ -28,35 +28,41 @@ ActiveRecord::Schema.define do
|
|
28
28
|
t.string :metal
|
29
29
|
end
|
30
30
|
|
31
|
-
create_table :products_sections, :
|
31
|
+
create_table :products_sections, force: true do |t|
|
32
32
|
t.integer :section_id
|
33
33
|
t.integer :product_id
|
34
34
|
end
|
35
35
|
|
36
|
-
create_table :sections, :
|
36
|
+
create_table :sections, force: true do |t|
|
37
37
|
t.string :name
|
38
38
|
t.integer :num_employees
|
39
39
|
t.decimal :total_sales
|
40
40
|
end
|
41
41
|
|
42
|
-
create_table :images, :
|
42
|
+
create_table :images, force: true do |t|
|
43
43
|
t.string :filename
|
44
44
|
t.integer :product_id
|
45
45
|
end
|
46
46
|
|
47
|
-
create_table :
|
47
|
+
create_table :companies, force: true do |t|
|
48
|
+
t.string :name
|
49
|
+
end
|
50
|
+
|
51
|
+
create_table :employees, force: true do |t|
|
52
|
+
t.integer :company_id
|
48
53
|
t.string :name
|
49
54
|
t.string :ssn
|
50
55
|
t.decimal :salary
|
51
56
|
end
|
52
57
|
|
53
|
-
create_table :customers, :
|
58
|
+
create_table :customers, force: true do |t|
|
59
|
+
t.integer :company_id
|
54
60
|
t.string :email
|
55
61
|
t.string :password
|
56
62
|
t.decimal :balance
|
57
63
|
end
|
58
64
|
|
59
|
-
create_table :addresses, :
|
65
|
+
create_table :addresses, force: true do |t|
|
60
66
|
t.integer :addressable_id
|
61
67
|
t.string :addressable_type
|
62
68
|
|
@@ -67,108 +73,163 @@ ActiveRecord::Schema.define do
|
|
67
73
|
t.string :zip
|
68
74
|
end
|
69
75
|
|
70
|
-
create_table :
|
76
|
+
create_table :photos, force: true do |t|
|
77
|
+
t.integer :imageable_id
|
78
|
+
t.string :imageable_type
|
79
|
+
|
80
|
+
t.string :name
|
81
|
+
t.integer :size
|
82
|
+
end
|
83
|
+
|
84
|
+
create_table :post_configs, force: true do |t|
|
71
85
|
t.integer :post_id
|
72
86
|
t.integer :is_visible
|
73
87
|
t.integer :is_open
|
74
88
|
t.string :password
|
75
|
-
t.timestamps
|
89
|
+
t.timestamps null: true
|
76
90
|
end
|
77
91
|
|
78
|
-
create_table :comments, :
|
92
|
+
create_table :comments, force: true do |t|
|
79
93
|
t.integer :post_id
|
80
94
|
t.string :contents
|
81
|
-
t.timestamps
|
95
|
+
t.timestamps null: true
|
82
96
|
end
|
83
97
|
|
84
|
-
create_table :custom_things, :
|
98
|
+
create_table :custom_things, force: true do |t|
|
99
|
+
t.integer :post_id
|
85
100
|
t.string :value
|
86
|
-
t.timestamps
|
101
|
+
t.timestamps null: true
|
87
102
|
end
|
88
103
|
|
89
|
-
create_table :comments, :
|
104
|
+
create_table :comments, force: true do |t|
|
90
105
|
t.integer :post_id
|
91
106
|
t.string :contents
|
92
107
|
t.string :nerf
|
93
|
-
t.timestamps
|
108
|
+
t.timestamps null: true
|
94
109
|
end
|
95
110
|
|
96
|
-
create_table :ratings, :
|
111
|
+
create_table :ratings, force: true do |t|
|
97
112
|
t.integer :comment_id
|
98
113
|
t.string :num_stars
|
99
|
-
t.timestamps
|
114
|
+
t.timestamps null: true
|
100
115
|
end
|
101
116
|
|
102
|
-
create_table :tags, :
|
117
|
+
create_table :tags, force: true do |t|
|
103
118
|
t.string :value
|
104
|
-
t.timestamps
|
119
|
+
t.timestamps null: true
|
105
120
|
end
|
106
121
|
|
107
|
-
create_table :users, :
|
122
|
+
create_table :users, force: true do |t|
|
108
123
|
t.integer :post_id
|
109
124
|
t.string :name
|
110
125
|
t.string :email
|
111
|
-
t.timestamps
|
126
|
+
t.timestamps null: true
|
112
127
|
end
|
113
128
|
|
114
|
-
create_table :authors, :
|
129
|
+
create_table :authors, force: true do |t|
|
115
130
|
t.string :full_name
|
116
131
|
t.string :nickname
|
117
|
-
t.timestamps
|
132
|
+
t.timestamps null: true
|
118
133
|
end
|
119
134
|
|
120
|
-
create_table :posts_tags, :
|
135
|
+
create_table :posts_tags, force: true do |t|
|
121
136
|
t.integer :post_id
|
122
137
|
t.integer :tag_id
|
123
138
|
end
|
124
139
|
|
125
|
-
create_table :notes, :
|
140
|
+
create_table :notes, force: true do |t|
|
126
141
|
t.string :value
|
127
|
-
t.timestamps
|
142
|
+
t.timestamps null: true
|
128
143
|
end
|
129
144
|
|
130
|
-
create_table :notes_posts, :
|
145
|
+
create_table :notes_posts, force: true do |t|
|
131
146
|
t.integer :post_id
|
132
147
|
t.integer :note_id
|
133
148
|
end
|
134
149
|
|
135
|
-
create_table :widgets, :
|
150
|
+
create_table :widgets, force: true do |t|
|
136
151
|
t.string :value
|
137
152
|
end
|
138
153
|
|
139
|
-
create_table :post_widgets, :
|
154
|
+
create_table :post_widgets, force: true do |t|
|
140
155
|
t.integer :post_id
|
141
156
|
t.integer :widget_id
|
142
157
|
end
|
143
158
|
|
144
|
-
create_table :categories, :
|
159
|
+
create_table :categories, force: true do |t|
|
145
160
|
t.string :title
|
146
161
|
t.string :description
|
147
162
|
end
|
148
163
|
|
149
|
-
create_table :supercats, :
|
164
|
+
create_table :supercats, force: true do |t|
|
150
165
|
t.integer :post_id
|
151
166
|
t.integer :category_id
|
152
167
|
t.string :ramblings
|
153
168
|
t.string :other_ramblings
|
154
|
-
t.timestamps
|
169
|
+
t.timestamps null: true
|
155
170
|
end
|
156
171
|
|
157
|
-
create_table :superkittens, :
|
172
|
+
create_table :superkittens, force: true do |t|
|
158
173
|
t.integer :supercat_id
|
159
174
|
t.string :value
|
160
|
-
t.timestamps
|
175
|
+
t.timestamps null: true
|
161
176
|
end
|
162
177
|
|
163
|
-
create_table :accounts, :
|
178
|
+
create_table :accounts, force: true do |t|
|
164
179
|
t.integer :post_id
|
165
180
|
t.string :title
|
166
|
-
t.timestamps
|
181
|
+
t.timestamps null: true
|
167
182
|
end
|
168
183
|
|
169
|
-
create_table :histories, :
|
184
|
+
create_table :histories, force: true do |t|
|
170
185
|
t.integer :account_id
|
171
186
|
t.string :some_stuff
|
187
|
+
t.timestamps null: true
|
188
|
+
end
|
189
|
+
|
190
|
+
create_table :metal_objects, force: true do |t|
|
191
|
+
t.string :type
|
192
|
+
t.integer :parent_id
|
193
|
+
t.timestamps null: true
|
194
|
+
end
|
195
|
+
|
196
|
+
create_table :super_admins, force: true do |t|
|
197
|
+
t.string :email
|
198
|
+
t.string :password
|
199
|
+
t.boolean :active, null: false, default: true
|
200
|
+
t.timestamps null: true
|
201
|
+
end
|
202
|
+
|
203
|
+
create_table :boxes, force: true do |t|
|
204
|
+
t.string :title
|
205
|
+
t.timestamps null: true
|
206
|
+
end
|
207
|
+
|
208
|
+
create_table :box_products, force: true do |t|
|
209
|
+
t.string :type
|
210
|
+
t.integer :box_id
|
211
|
+
t.integer :box_sub_product_id
|
212
|
+
t.string :title
|
213
|
+
t.timestamps null: true
|
214
|
+
end
|
215
|
+
|
216
|
+
create_table :stages, force: true do |t|
|
217
|
+
t.string :title
|
218
|
+
t.string :type
|
219
|
+
t.integer :external_id
|
220
|
+
t.timestamps null: true
|
221
|
+
end
|
222
|
+
|
223
|
+
create_table :participants, force: true do |t|
|
224
|
+
t.string :name
|
225
|
+
t.string :type
|
226
|
+
t.integer :stage_id
|
227
|
+
t.timestamps
|
228
|
+
end
|
229
|
+
|
230
|
+
create_table :custom_rules, force: true do |t|
|
231
|
+
t.string :description
|
232
|
+
t.integer :stage_id
|
172
233
|
t.timestamps
|
173
234
|
end
|
174
235
|
end
|
metadata
CHANGED
@@ -1,150 +1,143 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amoeba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Vaughn Draughon
|
9
|
-
|
8
|
+
- Oleksandr Simonov
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
17
|
requirements:
|
19
|
-
- -
|
18
|
+
- - ">="
|
20
19
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
20
|
+
version: 1.6.0
|
22
21
|
type: :development
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
|
-
- -
|
25
|
+
- - ">="
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
27
|
+
version: 1.6.0
|
30
28
|
- !ruby/object:Gem::Dependency
|
31
29
|
name: rspec
|
32
30
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
31
|
requirements:
|
35
|
-
- -
|
32
|
+
- - ">="
|
36
33
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
34
|
+
version: 3.0.0
|
38
35
|
type: :development
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
|
-
- -
|
39
|
+
- - ">="
|
44
40
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
41
|
+
version: 3.0.0
|
46
42
|
- !ruby/object:Gem::Dependency
|
47
43
|
name: sqlite3
|
48
44
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
45
|
requirements:
|
51
|
-
- -
|
46
|
+
- - ">="
|
52
47
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
48
|
+
version: '1.3'
|
54
49
|
type: :development
|
55
50
|
prerelease: false
|
56
51
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
52
|
requirements:
|
59
|
-
- -
|
53
|
+
- - ">="
|
60
54
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
55
|
+
version: '1.3'
|
62
56
|
- !ruby/object:Gem::Dependency
|
63
57
|
name: activerecord
|
64
58
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
59
|
requirements:
|
67
|
-
- -
|
60
|
+
- - ">="
|
68
61
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
62
|
+
version: 4.2.0
|
70
63
|
type: :runtime
|
71
64
|
prerelease: false
|
72
65
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
66
|
requirements:
|
75
|
-
- -
|
67
|
+
- - ">="
|
76
68
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
78
|
-
description:
|
79
|
-
copy associated children, with recursive support for nested of grandchildren. The
|
80
|
-
behavior is controllable with a simple DSL both on your rails models and on the
|
81
|
-
fly, i.e. per instance. Numerous configuration styles and preprocessing directives
|
82
|
-
are included for power and flexibility. Supports preprocessing of field values to
|
83
|
-
prepend strings such as "Copy of ", to nullify or process field values with regular
|
84
|
-
expressions. Supports most association types including has_one :through and has_many
|
85
|
-
:through.
|
69
|
+
version: 4.2.0
|
70
|
+
description: |
|
71
|
+
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.
|
86
72
|
|
87
|
-
|
88
|
-
|
89
|
-
nested copy, copy associations, copy relations, copy relationships, duplicate associations,
|
90
|
-
duplicate associated records, duplicate child records, duplicate children, copy
|
91
|
-
all, duplicate all, clone child associations, clone nested children, clone associated
|
92
|
-
child records, nested clone, clone associations, clone relations, clone relationships,
|
93
|
-
cloning child associations, cloning nested children, cloning associated child records,
|
94
|
-
deep_cloning, nested cloning, cloning associations, cloning relations, cloning relationships,
|
95
|
-
cloning child associations, cloning nested children, cloning associated child records,
|
96
|
-
nested cloning, cloning associations, cloning relations, cloning relationships,
|
97
|
-
cloning child associations, cloning nested children, cloning associated child records,
|
98
|
-
deep_cloning, nested cloning, cloning associations, cloning relations, cloning relationships,
|
99
|
-
duplicate child associations, duplicate nested children, duplicate associated child
|
100
|
-
records, nested duplicate, duplicate associations, duplicate relations, duplicate
|
101
|
-
relationships, duplicate child associations, duplicate nested children, duplicate
|
102
|
-
associated child records, deep_duplicate, nested duplicate, duplicate associations,
|
103
|
-
duplicate relations, duplicate relationships, deep_copy, deep_clone, deep_cloning,
|
104
|
-
deep clone, deep cloning, has_one, has_many, has_and_belongs_to_many
|
105
|
-
|
106
|
-
'
|
107
|
-
email: vaughn@rocksolidwebdesign.com
|
73
|
+
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
|
74
|
+
email: alex@simonov.me
|
108
75
|
executables: []
|
109
76
|
extensions: []
|
110
77
|
extra_rdoc_files: []
|
111
78
|
files:
|
112
|
-
- .
|
113
|
-
- .
|
79
|
+
- ".cane"
|
80
|
+
- ".gitignore"
|
81
|
+
- ".rspec"
|
82
|
+
- ".rubocop.yml"
|
83
|
+
- ".travis.yml"
|
84
|
+
- Appraisals
|
114
85
|
- Gemfile
|
115
86
|
- README.md
|
116
87
|
- Rakefile
|
117
88
|
- amoeba.gemspec
|
89
|
+
- defaults.reek
|
90
|
+
- gemfiles/activerecord_4.2.gemfile
|
91
|
+
- gemfiles/activerecord_5.0.gemfile
|
92
|
+
- gemfiles/activerecord_5.1.gemfile
|
93
|
+
- gemfiles/activerecord_5.2.gemfile
|
94
|
+
- gemfiles/activerecord_6.0.gemfile
|
95
|
+
- gemfiles/activerecord_6.1.gemfile
|
96
|
+
- gemfiles/activerecord_head.gemfile
|
97
|
+
- gemfiles/jruby_activerecord_6.1.gemfile
|
98
|
+
- gemfiles/jruby_activerecord_head.gemfile
|
118
99
|
- lib/amoeba.rb
|
100
|
+
- lib/amoeba/class_methods.rb
|
101
|
+
- lib/amoeba/cloner.rb
|
102
|
+
- lib/amoeba/config.rb
|
103
|
+
- lib/amoeba/instance_methods.rb
|
104
|
+
- lib/amoeba/macros.rb
|
105
|
+
- lib/amoeba/macros/base.rb
|
106
|
+
- lib/amoeba/macros/has_and_belongs_to_many.rb
|
107
|
+
- lib/amoeba/macros/has_many.rb
|
108
|
+
- lib/amoeba/macros/has_one.rb
|
119
109
|
- lib/amoeba/version.rb
|
120
110
|
- spec/lib/amoeba_spec.rb
|
121
111
|
- spec/spec_helper.rb
|
122
112
|
- spec/support/data.rb
|
123
113
|
- spec/support/models.rb
|
124
114
|
- spec/support/schema.rb
|
125
|
-
homepage: http://github.com/
|
115
|
+
homepage: http://github.com/amoeba-rb/amoeba
|
126
116
|
licenses:
|
127
117
|
- BSD
|
128
|
-
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
129
120
|
rdoc_options: []
|
130
121
|
require_paths:
|
131
122
|
- lib
|
132
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
124
|
requirements:
|
135
|
-
- -
|
125
|
+
- - ">="
|
136
126
|
- !ruby/object:Gem::Version
|
137
127
|
version: '0'
|
138
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
129
|
requirements:
|
141
|
-
- -
|
130
|
+
- - ">="
|
142
131
|
- !ruby/object:Gem::Version
|
143
132
|
version: '0'
|
144
133
|
requirements: []
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
specification_version: 3
|
134
|
+
rubygems_version: 3.2.17
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
149
137
|
summary: Easy copying of rails models and their child associations.
|
150
|
-
test_files:
|
138
|
+
test_files:
|
139
|
+
- spec/lib/amoeba_spec.rb
|
140
|
+
- spec/spec_helper.rb
|
141
|
+
- spec/support/data.rb
|
142
|
+
- spec/support/models.rb
|
143
|
+
- spec/support/schema.rb
|