anonymous_active_record 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_record'
3
+ # external gems
4
+ require "version_gem"
5
+ require "active_record"
6
+ require "active_support/core_ext/array/extract_options"
4
7
 
5
- require 'anonymous_active_record/version'
6
- require 'anonymous_active_record/generator'
7
- require 'anonymous_active_record/factory'
8
+ require "anonymous_active_record/version"
9
+ require "anonymous_active_record/generator"
10
+ require "anonymous_active_record/factory"
8
11
 
9
12
  # Public API for AnonymousActiveRecord is:
10
13
  #
@@ -38,11 +41,11 @@ require 'anonymous_active_record/factory'
38
41
  #
39
42
  module AnonymousActiveRecord
40
43
  DEFAULT_CONNECTION_PARAMS = {
41
- adapter: 'sqlite3',
42
- encoding: 'utf8',
43
- database: ':memory:'
44
+ adapter: "sqlite3",
45
+ encoding: "utf8",
46
+ database: ":memory:",
44
47
  }.freeze
45
- DEFAULT_PARENT_KLASS = 'ActiveRecord::Base'
48
+ DEFAULT_PARENT_KLASS = "ActiveRecord::Base"
46
49
 
47
50
  # Defines a pseudo anonymous class in a particular namespace of your choosing.
48
51
  def generate(table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: DEFAULT_PARENT_KLASS, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
@@ -58,33 +61,27 @@ module AnonymousActiveRecord
58
61
  type = col.delete(:type)
59
62
  t.column(name, type, **col)
60
63
  elsif col.is_a?(Array)
61
- if col[-1].is_a?(Hash)
62
- if col[-1].present?
63
- t.column col[0], **col[-1]
64
- else
65
- t.column col[0], :string
66
- end
64
+ options = col.extract_options!
65
+ if options.present?
66
+ t.column(*col, **options)
67
+ elsif col.length == 1
68
+ t.column(col[0], :string)
67
69
  else
68
- t.column col[0], col[-1] || :string
70
+ t.column(col[0], col[-1] || :string)
69
71
  end
70
72
  else
71
- t.column col, :string
73
+ t.column(col, :string)
72
74
  end
73
75
  end
74
76
  indexes.each do |idx_options|
75
77
  if idx_options.is_a?(Hash)
76
78
  column_names = idx_options.delete(:columns)
77
- t.index column_names, **idx_options
79
+ t.index(column_names, **idx_options)
78
80
  elsif idx_options.is_a?(Array)
79
- if idx_options.length == 1
80
- t.index idx_options[0]
81
- elsif idx_options[-1].is_a?(Hash)
82
- t.index idx_options[0], **idx_options[-1]
83
- else
84
- t.index idx_options[0], idx_options[-1]
85
- end
81
+ options = idx_options.extract_options!
82
+ t.index(*idx_options, **options)
86
83
  else
87
- t.index idx_options
84
+ t.index(idx_options)
88
85
  end
89
86
  end
90
87
  t.timestamps if timestamps
@@ -145,3 +142,7 @@ module AnonymousActiveRecord
145
142
 
146
143
  module_function :generate, :factory, :factory!, :_factory
147
144
  end
145
+
146
+ AnonymousActiveRecord::Version.class_eval do
147
+ extend VersionGem::Basic
148
+ end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,211 +1,269 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anonymous_active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
8
  autorequire:
9
9
  bindir: exe
10
- cert_chain: []
11
- date: 2021-02-14 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEgDCCAuigAwIBAgIBATANBgkqhkiG9w0BAQsFADBDMRUwEwYDVQQDDAxwZXRl
14
+ ci5ib2xpbmcxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
15
+ A2NvbTAeFw0yMzA5MjAxNzMwMjhaFw0yNDA5MTkxNzMwMjhaMEMxFTATBgNVBAMM
16
+ DHBldGVyLmJvbGluZzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
17
+ LGQBGRYDY29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA+a9Uv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7x0q2PocGIDU5zsPn/WNTkCXPmB
34
+ CHGvqDNWq4M7ncTKAaS2XExgyb7uPdq9fKiOW8nmH+zCiGzJXzBWwZlKf7L4Ht9E
35
+ a3f0e5C+zvee9Z5Ng9ciyfav9/fcXgYt5MjoBv27THr5XfBhgOCIHSYW2tqJmWKi
36
+ KuxrfYrN+9HvMdm+nZ6TypmKftHY3Gj+/uu+g8Icm/zrvTWAEE0mcJOkfrIoNPJb
37
+ pF8dMA==
38
+ -----END CERTIFICATE-----
39
+ date: 2024-09-18 00:00:00.000000000 Z
12
40
  dependencies:
13
41
  - !ruby/object:Gem::Dependency
14
- name: bundler
42
+ name: activerecord
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
45
  - - ">="
18
46
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
47
+ version: '5'
48
+ type: :runtime
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
52
  - - ">="
25
53
  - !ruby/object:Gem::Version
26
- version: '0'
54
+ version: '5'
27
55
  - !ruby/object:Gem::Dependency
28
- name: rake
56
+ name: activesupport
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - "~>"
59
+ - - ">="
32
60
  - !ruby/object:Gem::Version
33
- version: '13'
34
- type: :development
61
+ version: '5'
62
+ type: :runtime
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - "~>"
66
+ - - ">="
39
67
  - !ruby/object:Gem::Version
40
- version: '13'
68
+ version: '5'
41
69
  - !ruby/object:Gem::Dependency
42
- name: rspec
70
+ name: version_gem
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: '3'
48
- type: :development
75
+ version: '1.1'
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 1.1.4
79
+ type: :runtime
49
80
  prerelease: false
50
81
  version_requirements: !ruby/object:Gem::Requirement
51
82
  requirements:
52
83
  - - "~>"
53
84
  - !ruby/object:Gem::Version
54
- version: '3'
85
+ version: '1.1'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 1.1.4
55
89
  - !ruby/object:Gem::Dependency
56
- name: rspec-block_is_expected
90
+ name: yard
57
91
  requirement: !ruby/object:Gem::Requirement
58
92
  requirements:
59
93
  - - "~>"
60
94
  - !ruby/object:Gem::Version
61
- version: '1'
95
+ version: '0.9'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 0.9.34
62
99
  type: :development
63
100
  prerelease: false
64
101
  version_requirements: !ruby/object:Gem::Requirement
65
102
  requirements:
66
103
  - - "~>"
67
104
  - !ruby/object:Gem::Version
68
- version: '1'
105
+ version: '0.9'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 0.9.34
69
109
  - !ruby/object:Gem::Dependency
70
- name: rubocop
110
+ name: yard-junk
71
111
  requirement: !ruby/object:Gem::Requirement
72
112
  requirements:
73
113
  - - "~>"
74
114
  - !ruby/object:Gem::Version
75
- version: '1.9'
115
+ version: 0.0.10
76
116
  type: :development
77
117
  prerelease: false
78
118
  version_requirements: !ruby/object:Gem::Requirement
79
119
  requirements:
80
120
  - - "~>"
81
121
  - !ruby/object:Gem::Version
82
- version: '1.9'
122
+ version: 0.0.10
83
123
  - !ruby/object:Gem::Dependency
84
- name: rubocop-md
124
+ name: kettle-soup-cover
85
125
  requirement: !ruby/object:Gem::Requirement
86
126
  requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '1.0'
87
130
  - - ">="
88
131
  - !ruby/object:Gem::Version
89
- version: '0'
132
+ version: 1.0.2
90
133
  type: :development
91
134
  prerelease: false
92
135
  version_requirements: !ruby/object:Gem::Requirement
93
136
  requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '1.0'
94
140
  - - ">="
95
141
  - !ruby/object:Gem::Version
96
- version: '0'
142
+ version: 1.0.2
97
143
  - !ruby/object:Gem::Dependency
98
- name: rubocop-minitest
144
+ name: rake
99
145
  requirement: !ruby/object:Gem::Requirement
100
146
  requirements:
101
- - - ">="
147
+ - - "~>"
102
148
  - !ruby/object:Gem::Version
103
- version: '0'
149
+ version: '13'
104
150
  type: :development
105
151
  prerelease: false
106
152
  version_requirements: !ruby/object:Gem::Requirement
107
153
  requirements:
108
- - - ">="
154
+ - - "~>"
109
155
  - !ruby/object:Gem::Version
110
- version: '0'
156
+ version: '13'
111
157
  - !ruby/object:Gem::Dependency
112
- name: rubocop-packaging
158
+ name: rspec
113
159
  requirement: !ruby/object:Gem::Requirement
114
160
  requirements:
115
- - - ">="
161
+ - - "~>"
116
162
  - !ruby/object:Gem::Version
117
- version: '0'
163
+ version: '3'
118
164
  type: :development
119
165
  prerelease: false
120
166
  version_requirements: !ruby/object:Gem::Requirement
121
167
  requirements:
122
- - - ">="
168
+ - - "~>"
123
169
  - !ruby/object:Gem::Version
124
- version: '0'
170
+ version: '3'
125
171
  - !ruby/object:Gem::Dependency
126
- name: rubocop-performance
172
+ name: rspec-block_is_expected
127
173
  requirement: !ruby/object:Gem::Requirement
128
174
  requirements:
129
- - - ">="
175
+ - - "~>"
130
176
  - !ruby/object:Gem::Version
131
- version: '0'
177
+ version: '1'
132
178
  type: :development
133
179
  prerelease: false
134
180
  version_requirements: !ruby/object:Gem::Requirement
135
181
  requirements:
136
- - - ">="
182
+ - - "~>"
137
183
  - !ruby/object:Gem::Version
138
- version: '0'
184
+ version: '1'
139
185
  - !ruby/object:Gem::Dependency
140
- name: rubocop-rake
186
+ name: sqlite3
141
187
  requirement: !ruby/object:Gem::Requirement
142
188
  requirements:
143
- - - ">="
189
+ - - "~>"
144
190
  - !ruby/object:Gem::Version
145
- version: '0'
191
+ version: '1'
146
192
  type: :development
147
193
  prerelease: false
148
194
  version_requirements: !ruby/object:Gem::Requirement
149
195
  requirements:
150
- - - ">="
196
+ - - "~>"
151
197
  - !ruby/object:Gem::Version
152
- version: '0'
198
+ version: '1'
153
199
  - !ruby/object:Gem::Dependency
154
- name: rubocop-rspec
200
+ name: rubocop-lts
155
201
  requirement: !ruby/object:Gem::Requirement
156
202
  requirements:
203
+ - - "~>"
204
+ - !ruby/object:Gem::Version
205
+ version: '12.1'
157
206
  - - ">="
158
207
  - !ruby/object:Gem::Version
159
- version: '0'
208
+ version: 12.1.1
160
209
  type: :development
161
210
  prerelease: false
162
211
  version_requirements: !ruby/object:Gem::Requirement
163
212
  requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '12.1'
164
216
  - - ">="
165
217
  - !ruby/object:Gem::Version
166
- version: '0'
218
+ version: 12.1.1
167
219
  - !ruby/object:Gem::Dependency
168
- name: simplecov
220
+ name: rubocop-packaging
169
221
  requirement: !ruby/object:Gem::Requirement
170
222
  requirements:
223
+ - - "~>"
224
+ - !ruby/object:Gem::Version
225
+ version: '0.5'
171
226
  - - ">="
172
227
  - !ruby/object:Gem::Version
173
- version: '0'
228
+ version: 0.5.2
174
229
  type: :development
175
230
  prerelease: false
176
231
  version_requirements: !ruby/object:Gem::Requirement
177
232
  requirements:
233
+ - - "~>"
234
+ - !ruby/object:Gem::Version
235
+ version: '0.5'
178
236
  - - ">="
179
237
  - !ruby/object:Gem::Version
180
- version: '0'
238
+ version: 0.5.2
181
239
  - !ruby/object:Gem::Dependency
182
- name: sqlite3
240
+ name: rubocop-rspec
183
241
  requirement: !ruby/object:Gem::Requirement
184
242
  requirements:
185
- - - "~>"
243
+ - - ">="
186
244
  - !ruby/object:Gem::Version
187
- version: '1'
245
+ version: '0'
188
246
  type: :development
189
247
  prerelease: false
190
248
  version_requirements: !ruby/object:Gem::Requirement
191
249
  requirements:
192
- - - "~>"
250
+ - - ">="
193
251
  - !ruby/object:Gem::Version
194
- version: '1'
252
+ version: '0'
195
253
  - !ruby/object:Gem::Dependency
196
- name: activerecord
254
+ name: standard
197
255
  requirement: !ruby/object:Gem::Requirement
198
256
  requirements:
199
257
  - - ">="
200
258
  - !ruby/object:Gem::Version
201
- version: '5'
202
- type: :runtime
259
+ version: '1.40'
260
+ type: :development
203
261
  prerelease: false
204
262
  version_requirements: !ruby/object:Gem::Requirement
205
263
  requirements:
206
264
  - - ">="
207
265
  - !ruby/object:Gem::Version
208
- version: '5'
266
+ version: '1.40'
209
267
  description: Replacement for broken Class.new(ActiveRecord::Base)
210
268
  email:
211
269
  - peter.boling@gmail.com
@@ -213,23 +271,30 @@ executables: []
213
271
  extensions: []
214
272
  extra_rdoc_files: []
215
273
  files:
274
+ - CHANGELOG.md
216
275
  - CODE_OF_CONDUCT.md
217
- - LICENSE
276
+ - CONTRIBUTING.md
277
+ - LICENSE.txt
218
278
  - README.md
279
+ - SECURITY.md
219
280
  - lib/anonymous_active_record.rb
220
281
  - lib/anonymous_active_record/factory.rb
221
282
  - lib/anonymous_active_record/generator.rb
222
283
  - lib/anonymous_active_record/version.rb
223
- - spec/anonymous_active_record_spec.rb
224
- - spec/db/database.yml
225
- - spec/spec_helper.rb
226
- homepage: https://github.com/pboling/anonymous_active_record
284
+ homepage: http://github.com/pboling/anonymous_active_record
227
285
  licenses:
228
286
  - MIT
229
- metadata: {}
287
+ metadata:
288
+ homepage_uri: https://railsbling.com/tags/anonymous_active_record/
289
+ source_code_uri: http://github.com/pboling/anonymous_active_record/tree/v1.0.9
290
+ changelog_uri: http://github.com/pboling/anonymous_active_record/blob/v1.0.9/CHANGELOG.md
291
+ bug_tracker_uri: http://github.com/pboling/anonymous_active_record/issues
292
+ documentation_uri: https://www.rubydoc.info/gems/anonymous_active_record/1.0.9
293
+ wiki_uri: http://github.com/pboling/anonymous_active_record/wiki
294
+ funding_uri: https://liberapay.com/pboling
295
+ rubygems_mfa_required: 'true'
230
296
  post_install_message:
231
- rdoc_options:
232
- - "--charset=UTF-8"
297
+ rdoc_options: []
233
298
  require_paths:
234
299
  - lib
235
300
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -243,11 +308,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
308
  - !ruby/object:Gem::Version
244
309
  version: '0'
245
310
  requirements: []
246
- rubygems_version: 3.2.3
311
+ rubygems_version: 3.5.18
247
312
  signing_key:
248
313
  specification_version: 4
249
314
  summary: Almost Anonymous ActiveRecord classes
250
- test_files:
251
- - spec/anonymous_active_record_spec.rb
252
- - spec/db/database.yml
253
- - spec/spec_helper.rb
315
+ test_files: []
metadata.gz.sig ADDED
Binary file
data/LICENSE DELETED
@@ -1,7 +0,0 @@
1
- Copyright 2017 Peter Boling & Bolt Threads
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.