vigilion-rails 2.0.0 → 2.1.0

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: 0bf77784d940566822b109c78453d6e5243ac2e56b494b4d312adf1111dc9849
4
- data.tar.gz: 977d2425983190e51677445c79575ffa6b8f7617f6144f88664b2d769ace052a
3
+ metadata.gz: 0e28eecf1be1c320c56bc57e6e0080378e382c5c3127e8c284c5d88e6104874f
4
+ data.tar.gz: cb9397a3587a938946028cb22de9ec7bdd902721a18d4db62bfa7e51ad89bf66
5
5
  SHA512:
6
- metadata.gz: 4e328f50bb9f3189817baa85a3b4613b5f14234c8549cdf74ceb9c2f8da2fec7693a902f52d941c15f448b1e9329921c31b74bd6cd152a16d66ba2c8f0791f78
7
- data.tar.gz: 7c8ba6df3708e9f075da925ca93b33510d2cc3876f8948568cc0fcf1967a5694ef0b3ab4e55ce98c6b29dc524c9a7f160288324c642287c644bac4860309b0c0
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
@@ -7,6 +7,7 @@ module VigilionRails
7
7
  config.integration = :url
8
8
  config.loopback = Rails.env.development? || Rails.env.test?
9
9
  config.loopback_response = 'clean'
10
+ config.active_job = false
10
11
  end
11
12
  end
12
13
  end
@@ -1,3 +1,3 @@
1
1
  module VigilionRails
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -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
- #{integration_class}.new.scan key, self, :#{column}
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
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -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
-
@@ -0,0 +1,4 @@
1
+ Vigilion.configure do |config|
2
+ config.access_key_id = 'test'
3
+ config.secret_access_key = 'test'
4
+ end
Binary file