vigilion-rails 2.0.0 → 2.1.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 +4 -4
- data/app/jobs/vigilion_rails/application_job.rb +9 -0
- data/app/jobs/vigilion_rails/vigilion_scan_job.rb +10 -0
- data/lib/vigilion-rails/configuration.rb +1 -0
- data/lib/vigilion-rails/version.rb +1 -1
- data/lib/vigilion-rails.rb +7 -1
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/config/application.rb +0 -4
- data/spec/dummy/config/initializers/vigilion.rb +4 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +10018 -0
- data/spec/jobs/vigilion_rails/vigilion_scan_job_spec.rb +26 -0
- data/spec/lib/integrations/local_integration_spec.rb +2 -2
- data/spec/lib/vigilion_rails_spec.rb +35 -1
- data/spec/vigilion_rails_helper.rb +2 -0
- metadata +34 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e28eecf1be1c320c56bc57e6e0080378e382c5c3127e8c284c5d88e6104874f
|
4
|
+
data.tar.gz: cb9397a3587a938946028cb22de9ec7bdd902721a18d4db62bfa7e51ad89bf66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a8e14038c7b7662d85eced0feb075f12586ab1e0e5da24bad96e9922acfd3dbe8ccf38d5c9439dbd8de60832864da3d2eb04faec608b1fa97a863ed19be4808
|
7
|
+
data.tar.gz: e66a916139d8e823ba930f488565cd34a73bea263b0d4108c3f1a8b5b11c59a89609d0d2f4649ea0be1545e906999dd23311e9b07d431e831d36e67259e48a47
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module VigilionRails
|
2
|
+
class ApplicationJob < ActiveJob::Base
|
3
|
+
# Automatically retry jobs that encountered a deadlock
|
4
|
+
# retry_on ActiveRecord::Deadlocked
|
5
|
+
|
6
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
7
|
+
# discard_on ActiveJob::DeserializationError
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module VigilionRails
|
2
|
+
class VigilionScanJob < ApplicationJob
|
3
|
+
queue_as :default
|
4
|
+
|
5
|
+
def perform(integration_class, class_name, id, key, column)
|
6
|
+
file = class_name.constantize.find(id)
|
7
|
+
integration_class.constantize.new.scan key, file, column.to_sym
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/vigilion-rails.rb
CHANGED
@@ -4,6 +4,7 @@ require "vigilion-rails/integrations/local_integration"
|
|
4
4
|
require "vigilion-rails/configuration"
|
5
5
|
|
6
6
|
module VigilionRails
|
7
|
+
PENDING_STATUS = 'pending'
|
7
8
|
|
8
9
|
module ActiveRecord
|
9
10
|
def scan_file column, options={}
|
@@ -20,7 +21,12 @@ module VigilionRails
|
|
20
21
|
|
21
22
|
self.class.find(id).on_scan_#{column} status: Vigilion::Configuration.loopback_response
|
22
23
|
else
|
23
|
-
|
24
|
+
if Vigilion::Configuration.active_job
|
25
|
+
::VigilionRails::VigilionScanJob.set(wait: 60).perform_later(#{integration_class}.to_s, self.class.name, id, key, '#{column}')
|
26
|
+
else
|
27
|
+
#{integration_class}.new.scan key, self, :#{column}
|
28
|
+
end
|
29
|
+
self.class.find(id).send('on_scan_#{column}', status: PENDING_STATUS)
|
24
30
|
end
|
25
31
|
@#{column}_old_url = #{column}.url
|
26
32
|
return true
|
@@ -24,9 +24,5 @@ module Dummy
|
|
24
24
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
25
25
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
26
26
|
# config.i18n.default_locale = :de
|
27
|
-
|
28
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
29
|
-
config.active_record.raise_in_transactional_callbacks = true
|
30
27
|
end
|
31
28
|
end
|
32
|
-
|
Binary file
|