jobler 0.0.11 → 0.0.12
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 +5 -5
- data/Rakefile +1 -1
- data/app/joblers/jobler/models/destroyer_jobler.rb +3 -3
- data/app/models/jobler/job.rb +2 -1
- data/lib/jobler/base_jobler.rb +2 -2
- data/lib/jobler/job_runner.rb +3 -3
- data/lib/jobler/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b799fadf62229d053e33b4f073fecc0962e944d9e2dee1dc8ae9f213c4a425ba
|
4
|
+
data.tar.gz: d7a89ad05effc901eb99b11b944450091f63b4ed7aca467f58f1203118e19e56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ae5ea9a10281c55fcb793679dcd0b46a879938a333b9839b285013521021077ee6eeb510f2c5cd6a475151083e3a703230c71dd8bb91843e0f49e422b66cb35
|
7
|
+
data.tar.gz: dea066d7849a36caf18f2a6755481efb06159ca805326fef94e20d09c9fa047bab121c692f652cfb4c15b16ab43eded86e827b6e318f516d1909e3dd373501ef
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include("lib/**/*.rb")
|
15
15
|
end
|
16
16
|
|
17
|
-
APP_RAKEFILE = File.expand_path("
|
17
|
+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
18
18
|
load "rails/tasks/engine.rake"
|
19
19
|
|
20
20
|
load "rails/tasks/statistics.rake"
|
@@ -45,11 +45,11 @@ private
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def model
|
48
|
-
@
|
48
|
+
@model ||= model_class.find(args.fetch(:model_id))
|
49
49
|
end
|
50
50
|
|
51
51
|
def relationships
|
52
|
-
@
|
52
|
+
@relationships ||= begin
|
53
53
|
result = []
|
54
54
|
|
55
55
|
model_class.reflections.each_value do |reflection|
|
@@ -60,6 +60,6 @@ private
|
|
60
60
|
end
|
61
61
|
|
62
62
|
result
|
63
|
-
end
|
63
|
+
end
|
64
64
|
end
|
65
65
|
end
|
data/app/models/jobler/job.rb
CHANGED
@@ -6,7 +6,7 @@ class Jobler::Job < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
|
|
6
6
|
before_validation :set_slug
|
7
7
|
|
8
8
|
def jobler
|
9
|
-
@
|
9
|
+
@jobler ||= jobler_type.constantize.new(args: YAML.load(parameters), job: self) # rubocop:disable Security/YAMLLoad
|
10
10
|
end
|
11
11
|
|
12
12
|
def completed?
|
@@ -19,6 +19,7 @@ class Jobler::Job < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
|
|
19
19
|
|
20
20
|
def to_param
|
21
21
|
raise "No slug" unless slug?
|
22
|
+
|
22
23
|
slug
|
23
24
|
end
|
24
25
|
|
data/lib/jobler/base_jobler.rb
CHANGED
@@ -52,7 +52,7 @@ class Jobler::BaseJobler
|
|
52
52
|
end
|
53
53
|
|
54
54
|
if update
|
55
|
-
job.
|
55
|
+
job.update!(progress: new_progress)
|
56
56
|
@_current_progress = new_progress
|
57
57
|
end
|
58
58
|
end
|
@@ -74,7 +74,7 @@ class Jobler::BaseJobler
|
|
74
74
|
controller.request = request
|
75
75
|
controller.response = ActionDispatch::Response.new
|
76
76
|
|
77
|
-
render_result = controller.render(template_path,
|
77
|
+
render_result = controller.render(template_path, layout: false, locals: {jobler: self}.merge(locals))
|
78
78
|
|
79
79
|
if render_result.is_a?(String)
|
80
80
|
# Rails 5 behaviour
|
data/lib/jobler/job_runner.rb
CHANGED
@@ -3,16 +3,16 @@ class Jobler::JobRunner < ActiveJob::Base # rubocop:disable Rails/ApplicationJob
|
|
3
3
|
|
4
4
|
def perform(job_id)
|
5
5
|
@job = Jobler::Job.find(job_id)
|
6
|
-
@job.
|
6
|
+
@job.update!(started_at: Time.zone.now, state: "started")
|
7
7
|
|
8
8
|
begin
|
9
9
|
with_locale do
|
10
10
|
@job.jobler.execute!
|
11
11
|
end
|
12
12
|
|
13
|
-
@job.
|
13
|
+
@job.update!(ended_at: Time.zone.now, progress: 1.0, state: "completed")
|
14
14
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
15
|
-
@job.
|
15
|
+
@job.update!(
|
16
16
|
ended_at: Time.zone.now,
|
17
17
|
error_message: e.message,
|
18
18
|
error_type: e.class.name,
|
data/lib/jobler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jobler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.0.0
|
27
27
|
description: Generate pages or files in the background
|
28
28
|
email:
|
29
29
|
- kaspernj@gmail.com
|
@@ -85,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
|
89
|
-
rubygems_version: 2.6.13
|
88
|
+
rubygems_version: 3.0.6
|
90
89
|
signing_key:
|
91
90
|
specification_version: 4
|
92
91
|
summary: Generate pages or files in the background
|