bulk_dependency_eraser 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31e61c4af0756f5f3cb2f75ee9d3247e238fd83386fd8bdeace5bd60ebf17655
4
- data.tar.gz: c3edbcc3cdfa4d56d398616780ba81ae254cf9224f9371fa60dbfbbc25b2b343
3
+ metadata.gz: 80c6e41e13092670b6f67fc6cdb8d117c0222b0d2ce7c0043e1f12dcf01c1273
4
+ data.tar.gz: 9b93602042b1863caa6a1eac272547d76559e7ba62e97e29831c5d171050eafe
5
5
  SHA512:
6
- metadata.gz: '09c8931ca0720cf4a40639df42d1376745d32915167f2b78e43400280761249458e582bb872b8a4b5106d6c580ad82c88a26f2270a0227e457d045fe9490d388'
7
- data.tar.gz: fa6224f8af00e73b0114666728547c4e64fdd2976c4026411d621ef411ffbc1bf484275e93076f8942d1ae99834600da794efa9590eab4827e1c55bcd1978912
6
+ metadata.gz: 26e795e7ecf8727eacf36267502454478922430dc86424f6ef0483bb195a09dc1c52c47067c0a87d70f9235173715a975422548ebd50da7fb1cf70ccbc7f0721
7
+ data.tar.gz: e6722b7ca1fd1c58f1b4a9d619af965eddb440c159bc2b9fd6efd436c2e927fd6e58679bb25f71438d24987aea8726ceb69a5ee081654e6cb8fbf4336d9c7dce
@@ -90,6 +90,10 @@ module BulkDependencyEraser
90
90
 
91
91
  def build
92
92
  begin
93
+ if opts_c.verbose
94
+ puts "Starting build for #{@query.is_a?(ActiveRecord::Relation) ? @query.klass.name : @query.name}"
95
+ end
96
+
93
97
  deletion_query_parser(@query)
94
98
 
95
99
  uniqify_errors!
@@ -159,9 +163,9 @@ module BulkDependencyEraser
159
163
 
160
164
  if opts_c.verbose
161
165
  if association_parent
162
- puts "Building #{klass_name}"
166
+ puts "Building #{association_parent}, association of #{klass_name}"
163
167
  else
164
- puts "Building #{association_parent}, assocation of #{klass_name}"
168
+ puts "Building #{klass_name}"
165
169
  end
166
170
  end
167
171
 
@@ -185,6 +189,7 @@ module BulkDependencyEraser
185
189
  # prevent infinite recursion here.
186
190
  # - Remove any IDs that have been processed before
187
191
  query_ids = query_ids - deletion_list[klass_name]
192
+
188
193
  # If ids are nil, let's find that error
189
194
  if query_ids.none? #|| query_ids.nil?
190
195
  # quick cleanup, if turns out was an empty class
@@ -262,9 +267,24 @@ module BulkDependencyEraser
262
267
  reflection = parent_class.reflect_on_association(association_name)
263
268
  reflection_type = reflection.class.name
264
269
 
265
- if self.class::DEPENDENCY_DESTROY_IGNORE_REFLECTION_TYPES.include?(reflection_type)
266
- report_error("Dependency detected on #{parent_class.name}'s '#{association_name}' - association doesn't support dependency")
267
- return
270
+ is_polymorphic = reflection.options[:polymorphic]
271
+ unless is_polymorphic
272
+ klass = reflection.klass
273
+
274
+ if ignore_table_name_and_dependencies.include?(klass.table_name)
275
+ # Not parsing, table and dependencies ignorable
276
+ return
277
+ end
278
+
279
+ if ignore_klass_name_and_dependencies.include?(klass.name)
280
+ # Not parsing, table and dependencies ignorable
281
+ return
282
+ end
283
+
284
+ if self.class::DEPENDENCY_DESTROY_IGNORE_REFLECTION_TYPES.include?(reflection_type)
285
+ report_error("Dependency detected on #{parent_class.name}'s '#{association_name}' - association doesn't support dependency")
286
+ return
287
+ end
268
288
  end
269
289
 
270
290
  case reflection_type
@@ -1,3 +1,6 @@
1
+ require 'active_support'
2
+ require 'active_support/core_ext/module/delegation'
3
+
1
4
  module BulkDependencyEraser
2
5
  class Manager < Base
3
6
  DEFAULT_OPTS = {
@@ -39,6 +42,8 @@ module BulkDependencyEraser
39
42
  puts "Builder execution SUCCESSFUL" if opts_c.verbose
40
43
  end
41
44
 
45
+ @built = true
46
+
42
47
  return builder_execution
43
48
  end
44
49
 
@@ -1,3 +1,3 @@
1
1
  module BulkDependencyEraser
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.2.2".freeze
3
3
  end
@@ -2,4 +2,5 @@ require_relative 'bulk_dependency_eraser/base'
2
2
  require_relative 'bulk_dependency_eraser/builder'
3
3
  require_relative 'bulk_dependency_eraser/deleter'
4
4
  require_relative 'bulk_dependency_eraser/nullifier'
5
- require_relative 'bulk_dependency_eraser/manager'
5
+ require_relative 'bulk_dependency_eraser/manager'
6
+ require_relative 'bulk_dependency_eraser/version'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulk_dependency_eraser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - benjamin.dana.software.dev@gmail.com