libis-workflow-mongoid 2.0.16 → 2.0.17
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/lib/libis/workflow/mongoid/run.rb +19 -5
- data/lib/libis/workflow/mongoid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36e37f56b5fe461493670fed2f6f1fe9824cb789
|
4
|
+
data.tar.gz: f4a05cf3858093988bc123dbd60ee43793af53d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c05c2a5633b832ff85164da27122a06b9e3cec6805873ba3e597207fa0e7b312b86139f96cdba89031c34cb8752c2513ecdf5804e83a490c76fa37411fec0767
|
7
|
+
data.tar.gz: 4e8abf24693b4623f0a459925fe8491cc2681b338e69a857e369e5921a5a85cb21064b9b1c0365b24ad7a3b63052fde9e277ea1393914d9c15ba5e8cc122d675
|
@@ -22,13 +22,27 @@ module Libis
|
|
22
22
|
index({job_id: 1, job_type: 1, start_date: 1}, {sparse:1, name: 'by_job'})
|
23
23
|
|
24
24
|
set_callback(:destroy, :before) do |document|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
document.rm_workdir
|
26
|
+
document.rm_log
|
27
|
+
end
|
28
|
+
|
29
|
+
def rm_log
|
30
|
+
log_file = self.log_filename
|
29
31
|
FileUtils.rm(log_file) if log_file && !log_file.blank? && File.exist?(log_file)
|
30
32
|
end
|
31
33
|
|
34
|
+
def rm_workdir
|
35
|
+
workdir = self.work_dir
|
36
|
+
FileUtils.rmtree workdir if workdir && !workdir.blank? && Dir.exist?(workdir)
|
37
|
+
end
|
38
|
+
|
39
|
+
def work_dir
|
40
|
+
# noinspection RubyResolve
|
41
|
+
dir = File.join(Libis::Workflow::Config.workdir, self.id)
|
42
|
+
FileUtils.mkpath dir unless Dir.exist?(dir)
|
43
|
+
dir
|
44
|
+
end
|
45
|
+
|
32
46
|
def run(action = :run)
|
33
47
|
self.tasks = []
|
34
48
|
super action
|
@@ -42,7 +56,7 @@ module Libis
|
|
42
56
|
logger = ::Logging::Repository.instance[self.name]
|
43
57
|
return logger if logger
|
44
58
|
unless ::Logging::Appenders[self.name]
|
45
|
-
self.log_filename ||= File.join(::Libis::Workflow::Mongoid::Config[:log_dir], "#{self.name}.log")
|
59
|
+
self.log_filename ||= File.join(::Libis::Workflow::Mongoid::Config[:log_dir], "#{self.name}-#{self.id}.log")
|
46
60
|
::Logging::Appenders::File.new(
|
47
61
|
self.name,
|
48
62
|
filename: self.log_filename,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Libis
|
2
2
|
module Workflow
|
3
3
|
module Mongoid
|
4
|
-
VERSION = '2.0.
|
4
|
+
VERSION = '2.0.17' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-workflow-mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libis-workflow
|