rails_ops 1.1.24 → 1.1.28
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 +4 -4
- data/.github/workflows/rubocop.yml +17 -0
- data/.github/workflows/ruby.yml +37 -7
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -0
- data/Appraisals +19 -0
- data/CHANGELOG.md +25 -2
- data/LICENSE +1 -1
- data/README.md +106 -13
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/gemfiles/rails_5.1.gemfile +7 -0
- data/gemfiles/rails_5.2.gemfile +7 -0
- data/gemfiles/rails_6.0.gemfile +7 -0
- data/gemfiles/rails_6.1.gemfile +7 -0
- data/gemfiles/rails_7.0.gemfile +7 -0
- data/lib/generators/operation/USAGE +21 -0
- data/lib/generators/operation/operation_generator.rb +64 -0
- data/lib/generators/operation/templates/controller.erb +56 -0
- data/lib/generators/operation/templates/create.erb +15 -0
- data/lib/generators/operation/templates/destroy.erb +13 -0
- data/lib/generators/operation/templates/load.erb +13 -0
- data/lib/generators/operation/templates/update.erb +16 -0
- data/lib/generators/operation/templates/view.erb +0 -0
- data/lib/rails_ops/mixins/model/authorization.rb +1 -3
- data/lib/rails_ops/model_mixins/sti_fixes.rb +2 -6
- data/lib/rails_ops/model_mixins/virtual_attributes/virtual_column_wrapper.rb +4 -0
- data/lib/rails_ops.rb +1 -13
- data/rails_ops.gemspec +10 -6
- data/test/dummy/app/models/flower.rb +7 -0
- data/test/dummy/config/application.rb +10 -10
- data/test/dummy/db/schema.rb +4 -0
- data/test/unit/rails_ops/generators/operation_generator_test.rb +254 -0
- data/test/unit/rails_ops/operation/model/create_test.rb +16 -0
- data/test/unit/rails_ops/operation/model/update_test.rb +71 -0
- metadata +56 -11
- data/lib/rails_ops/model_casting.rb +0 -17
- data/lib/rails_ops/patches/active_type_patch.rb +0 -52
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_ops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: appraisal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,20 @@ dependencies:
|
|
108
122
|
- - '='
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: 0.47.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: sprockets-rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: active_type
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,22 +212,37 @@ dependencies:
|
|
184
212
|
- - "<="
|
185
213
|
- !ruby/object:Gem::Version
|
186
214
|
version: '3.1'
|
187
|
-
description:
|
188
|
-
email:
|
215
|
+
description:
|
216
|
+
email:
|
189
217
|
executables: []
|
190
218
|
extensions: []
|
191
219
|
extra_rdoc_files: []
|
192
220
|
files:
|
221
|
+
- ".github/workflows/rubocop.yml"
|
193
222
|
- ".github/workflows/ruby.yml"
|
194
223
|
- ".gitignore"
|
195
224
|
- ".releaser_config"
|
196
225
|
- ".rubocop.yml"
|
226
|
+
- Appraisals
|
197
227
|
- CHANGELOG.md
|
198
228
|
- Gemfile
|
199
229
|
- LICENSE
|
200
230
|
- README.md
|
201
231
|
- Rakefile
|
202
232
|
- VERSION
|
233
|
+
- gemfiles/rails_5.1.gemfile
|
234
|
+
- gemfiles/rails_5.2.gemfile
|
235
|
+
- gemfiles/rails_6.0.gemfile
|
236
|
+
- gemfiles/rails_6.1.gemfile
|
237
|
+
- gemfiles/rails_7.0.gemfile
|
238
|
+
- lib/generators/operation/USAGE
|
239
|
+
- lib/generators/operation/operation_generator.rb
|
240
|
+
- lib/generators/operation/templates/controller.erb
|
241
|
+
- lib/generators/operation/templates/create.erb
|
242
|
+
- lib/generators/operation/templates/destroy.erb
|
243
|
+
- lib/generators/operation/templates/load.erb
|
244
|
+
- lib/generators/operation/templates/update.erb
|
245
|
+
- lib/generators/operation/templates/view.erb
|
203
246
|
- lib/rails_ops.rb
|
204
247
|
- lib/rails_ops/authorization_backend/abstract.rb
|
205
248
|
- lib/rails_ops/authorization_backend/can_can_can.rb
|
@@ -225,7 +268,6 @@ files:
|
|
225
268
|
- lib/rails_ops/mixins/routes.rb
|
226
269
|
- lib/rails_ops/mixins/schema_validation.rb
|
227
270
|
- lib/rails_ops/mixins/sub_ops.rb
|
228
|
-
- lib/rails_ops/model_casting.rb
|
229
271
|
- lib/rails_ops/model_mixins.rb
|
230
272
|
- lib/rails_ops/model_mixins/ar_extension.rb
|
231
273
|
- lib/rails_ops/model_mixins/parent_op.rb
|
@@ -240,7 +282,6 @@ files:
|
|
240
282
|
- lib/rails_ops/operation/model/destroy.rb
|
241
283
|
- lib/rails_ops/operation/model/load.rb
|
242
284
|
- lib/rails_ops/operation/model/update.rb
|
243
|
-
- lib/rails_ops/patches/active_type_patch.rb
|
244
285
|
- lib/rails_ops/profiler.rb
|
245
286
|
- lib/rails_ops/profiler/node.rb
|
246
287
|
- lib/rails_ops/railtie.rb
|
@@ -269,6 +310,7 @@ files:
|
|
269
310
|
- test/dummy/app/models/cat.rb
|
270
311
|
- test/dummy/app/models/concerns/.keep
|
271
312
|
- test/dummy/app/models/dog.rb
|
313
|
+
- test/dummy/app/models/flower.rb
|
272
314
|
- test/dummy/app/models/group.rb
|
273
315
|
- test/dummy/app/models/nightingale.rb
|
274
316
|
- test/dummy/app/models/phoenix.rb
|
@@ -317,6 +359,7 @@ files:
|
|
317
359
|
- test/dummy/public/favicon.ico
|
318
360
|
- test/dummy/tmp/.keep
|
319
361
|
- test/test_helper.rb
|
362
|
+
- test/unit/rails_ops/generators/operation_generator_test.rb
|
320
363
|
- test/unit/rails_ops/mixins/model/nesting.rb
|
321
364
|
- test/unit/rails_ops/mixins/policies_test.rb
|
322
365
|
- test/unit/rails_ops/operation/model/create_test.rb
|
@@ -327,10 +370,10 @@ files:
|
|
327
370
|
- test/unit/rails_ops/operation/update_auth_test.rb
|
328
371
|
- test/unit/rails_ops/operation/update_lazy_auth_test.rb
|
329
372
|
- test/unit/rails_ops/operation_test.rb
|
330
|
-
homepage:
|
373
|
+
homepage:
|
331
374
|
licenses: []
|
332
375
|
metadata: {}
|
333
|
-
post_install_message:
|
376
|
+
post_install_message:
|
334
377
|
rdoc_options: []
|
335
378
|
require_paths:
|
336
379
|
- lib
|
@@ -345,8 +388,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
388
|
- !ruby/object:Gem::Version
|
346
389
|
version: '0'
|
347
390
|
requirements: []
|
348
|
-
rubygems_version: 3.2
|
349
|
-
signing_key:
|
391
|
+
rubygems_version: 3.1.2
|
392
|
+
signing_key:
|
350
393
|
specification_version: 4
|
351
394
|
summary: An operations service layer for rails projects.
|
352
395
|
test_files:
|
@@ -372,6 +415,7 @@ test_files:
|
|
372
415
|
- test/dummy/app/models/cat.rb
|
373
416
|
- test/dummy/app/models/concerns/.keep
|
374
417
|
- test/dummy/app/models/dog.rb
|
418
|
+
- test/dummy/app/models/flower.rb
|
375
419
|
- test/dummy/app/models/group.rb
|
376
420
|
- test/dummy/app/models/nightingale.rb
|
377
421
|
- test/dummy/app/models/phoenix.rb
|
@@ -420,6 +464,7 @@ test_files:
|
|
420
464
|
- test/dummy/public/favicon.ico
|
421
465
|
- test/dummy/tmp/.keep
|
422
466
|
- test/test_helper.rb
|
467
|
+
- test/unit/rails_ops/generators/operation_generator_test.rb
|
423
468
|
- test/unit/rails_ops/mixins/model/nesting.rb
|
424
469
|
- test/unit/rails_ops/mixins/policies_test.rb
|
425
470
|
- test/unit/rails_ops/operation/model/create_test.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module RailsOps::ModelCasting
|
2
|
-
def self.cast(model)
|
3
|
-
if model.class.respond_to?(:extended_record_base_class)
|
4
|
-
return ActiveType.cast(model, model.class.extended_record_base_class)
|
5
|
-
else
|
6
|
-
return model
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.original_class_for(model_class)
|
11
|
-
if model_class.respond_to?(:extended_record_base_class)
|
12
|
-
return model_class.extended_record_base_class
|
13
|
-
else
|
14
|
-
return model_class
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# Internal reference: #25564
|
2
|
-
module ActiveType
|
3
|
-
class TypeCaster
|
4
|
-
def type_cast_from_user(value)
|
5
|
-
# For some reason, Rails defines additional type casting logic
|
6
|
-
# outside the classes that have that responsibility.
|
7
|
-
case @type
|
8
|
-
when :integer
|
9
|
-
if value == ''
|
10
|
-
nil
|
11
|
-
else
|
12
|
-
native_type_cast_from_user(value)
|
13
|
-
end
|
14
|
-
when :timestamp, :datetime
|
15
|
-
time = native_type_cast_from_user(value)
|
16
|
-
if time && ActiveRecord::Base.time_zone_aware_attributes
|
17
|
-
time = ActiveSupport::TimeWithZone.new(nil, Time.zone, time)
|
18
|
-
end
|
19
|
-
time
|
20
|
-
when Integer.class
|
21
|
-
if value == ''
|
22
|
-
nil
|
23
|
-
else
|
24
|
-
value.to_i
|
25
|
-
end
|
26
|
-
else
|
27
|
-
native_type_cast_from_user(value)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
module NativeCasters
|
32
|
-
class DelegateToType
|
33
|
-
def initialize(type, connection)
|
34
|
-
# The specified type (e.g. "string") may not necessary match the
|
35
|
-
# native type ("varchar") expected by the connection adapter.
|
36
|
-
# PostgreSQL is one of these. Perform a translation if the adapter
|
37
|
-
# supports it (but don't turn a mysql boolean into a tinyint).
|
38
|
-
if !type.nil? && !(type == :boolean) && type.respond_to?(:to_sym) && connection.respond_to?(:native_database_types)
|
39
|
-
native_type = connection.native_database_types[type.try(:to_sym)]
|
40
|
-
if native_type && native_type[:name]
|
41
|
-
type = native_type[:name]
|
42
|
-
else
|
43
|
-
# unknown type, we just dont cast
|
44
|
-
type = nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
@active_record_type = connection.lookup_cast_type(type)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|