aranha-rails 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aranha/rails/engine.rb +5 -6
- data/lib/aranha/rails/manager.rb +2 -0
- data/lib/aranha/rails/patches/delayed_job.rb +7 -0
- data/lib/aranha/rails/process.rb +34 -0
- data/lib/aranha/rails/version.rb +1 -1
- data/lib/tasks/aranha.rake +1 -1
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbe5992eacaebe66f42310ee30ba8198d8f7533f8b7eccf6fb7cbe552884cb4a
|
4
|
+
data.tar.gz: 74be91626416ddf93d1d9702ef3e69bf91a91ea2f8bafb73cefd35745441d54c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a2ffc48a555639bfc1c9960378e700359ba14319b9727a423e8aa59b901b5945bece2e68f720d87bf0c1439965a2523edc89eb1abc7d04ab09fc017bbfa18eb
|
7
|
+
data.tar.gz: 854def0c575004ee01d630d69fe0975deeaa62d486b2ebfdc3ca775144cf88e3f3bcbd67d93eb6f85da11b203c6a0239cdde626a2d2fa8e460a3c82d9f144cea
|
data/lib/aranha/rails/engine.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_scaffold'
|
4
|
+
require 'eac_rails_delayed_job/engine'
|
4
5
|
|
5
6
|
module Aranha
|
6
7
|
module Rails
|
7
8
|
class Engine < ::Rails::Engine
|
8
|
-
|
9
|
+
include ::EacRailsUtils::EngineHelper
|
9
10
|
|
10
|
-
|
11
|
-
config.paths['db/migrate'].expanded.each do |expanded_path|
|
12
|
-
app.config.paths['db/migrate'] << expanded_path
|
13
|
-
end
|
14
|
-
end
|
11
|
+
isolate_namespace ::Aranha
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
15
|
+
|
16
|
+
require 'aranha/rails/patches/delayed_job'
|
data/lib/aranha/rails/manager.rb
CHANGED
@@ -9,10 +9,12 @@ module Aranha
|
|
9
9
|
include ::Singleton
|
10
10
|
|
11
11
|
def add_address(url, processor, extra_data = nil)
|
12
|
+
::Rails.logger.info("Adding \"#{url}\"")
|
12
13
|
a = ::Aranha::Address.find_or_initialize_by(url: ::Aranha::Address.sanitize_url(url))
|
13
14
|
a.processor = processor
|
14
15
|
a.extra_data = extra_data.to_yaml
|
15
16
|
a.save!
|
17
|
+
a.check_scheduling
|
16
18
|
end
|
17
19
|
|
18
20
|
def addresses_count
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aranha
|
4
|
+
module Rails
|
5
|
+
class Process
|
6
|
+
QUEUE = 'aranha'
|
7
|
+
QUEUES = [QUEUE].freeze
|
8
|
+
|
9
|
+
def run
|
10
|
+
run_init
|
11
|
+
run_jobs_workoff
|
12
|
+
run_close
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def run_close
|
18
|
+
::Aranha::Address.failed do |a|
|
19
|
+
::Rails.logger.info "Failed \"#{a.url}\": #{a.last_error}"
|
20
|
+
end
|
21
|
+
raise 'Some address failed' if ::Aranha::Address.failed.any?
|
22
|
+
end
|
23
|
+
|
24
|
+
def run_init
|
25
|
+
::Aranha::Manager.default.init
|
26
|
+
::Aranha::Address.all.each(&:init_scheduling)
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_jobs_workoff
|
30
|
+
::Delayed::Worker.new(exit_on_complete: true, queues: QUEUES).start
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/aranha/rails/version.rb
CHANGED
data/lib/tasks/aranha.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aranha-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_scaffold
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0.6'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: eac_rails_delayed_job
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.1'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.1'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: eac_rails_utils
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,6 +144,8 @@ files:
|
|
130
144
|
- lib/aranha/rails/engine.rb
|
131
145
|
- lib/aranha/rails/fixtures_download.rb
|
132
146
|
- lib/aranha/rails/manager.rb
|
147
|
+
- lib/aranha/rails/patches/delayed_job.rb
|
148
|
+
- lib/aranha/rails/process.rb
|
133
149
|
- lib/aranha/rails/version.rb
|
134
150
|
- lib/tasks/aranha.rake
|
135
151
|
homepage:
|
@@ -150,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
166
|
- !ruby/object:Gem::Version
|
151
167
|
version: '0'
|
152
168
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
169
|
+
rubygems_version: 3.1.6
|
154
170
|
signing_key:
|
155
171
|
specification_version: 4
|
156
172
|
summary: Put here de description.
|