libis-workflow-mongoid 2.0.1 → 2.0.2

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
  SHA1:
3
- metadata.gz: 475b4ffca7f1f3fb2db8a8657ffed71d15d7abcd
4
- data.tar.gz: fcbef1f20aa86feea36d5a19fd7de4d8731b1673
3
+ metadata.gz: 0a259d21bb114e3b4397ecb6c1152769d9960965
4
+ data.tar.gz: c75a90afe74196dd1ab779cd37fc7012f2b04c0b
5
5
  SHA512:
6
- metadata.gz: ca8260f6aabe378a5f2f15e46bddb588b9bcd5da0a40339eccb62f27b04e37629e216f854f76a4dc5ddfce9b644731f76fca4e1f1f0c1119b48ff2f2f760aba7
7
- data.tar.gz: eec596db0b15252f4ef48911b4c8d2b03ae49324812b660925440a2a21786e7c49fb71179b76e279232383626025fbcdf8ae02c025ba483ff3560b4ec35a02cb
6
+ metadata.gz: c3318624c4f63e725150382369c9bc29fedb501996cb37113cb7d57729090d024f81bf54bf5cdcd086b47e43d0c42e350b6d66342148024b77eeaca298debdae
7
+ data.tar.gz: 8f2b4c72528be421539f498166943cdcd5f228d7f6799b8889f4bbd9e58265bfe591c8f5ed16f68f55d98b19671ebabdac72f9e62646a6dc2b0a4bd0f9732d4d
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
-
2
- [![Build Status](https://travis-ci.org/libis/workflow-mongoid.svg?branch=master)](https://travis-ci.org/libis/workflow-mongoid)
3
- [![Coverage Status](https://coveralls.io/repos/libis/workflow-mongoid/badge.png)](https://coveralls.io/r/libis/workflow-monoid)
1
+ [![Gem Version](https://badge.fury.io/rb/libis-workflow-mongoid.svg)](http://badge.fury.io/rb/libis-workflow-mongoid)
2
+ [![Build Status](https://travis-ci.org/Kris-LIBIS/workflow-mongoid.svg?branch=master)](https://travis-ci.org/Kris-LIBIS/workflow-mongoid)
3
+ [![Coverage Status](https://coveralls.io/repos/Kris-LIBIS/workflow-mongoid/badge.png)](https://coveralls.io/r/Kris-LIBIS/workflow-mongoid)
4
+ [![Dependency Status](https://gemnasium.com/Kris-LIBIS/workflow-mongoid.svg)](https://gemnasium.com/Kris-LIBIS/workflow-mongoid)
4
5
 
5
6
  workflow-mongoid
6
7
  ================
@@ -19,6 +19,7 @@ module Libis
19
19
  field :input, type: Hash, default: -> { Hash.new }
20
20
  field :run_object, type: String
21
21
  field :log_to_file, type: Boolean, default: false
22
+ field :log_each_run, type: Boolean, default: false
22
23
  field :log_level, type: String, default: 'DEBUG'
23
24
  field :log_age, type: String, default: 'daily'
24
25
  field :log_keep, type: Integer, default: 5
@@ -37,7 +38,7 @@ module Libis
37
38
  ::Logging::Appenders::RollingFile.new(
38
39
  self.name,
39
40
  filename: File.join(::Libis::Workflow::Mongoid::Config[:log_dir], "#{self.name}{.%Y%m%d}.log"),
40
- layout: Config.get_log_formatter,
41
+ layout: ::Libis::Workflow::Mongoid::Config.get_log_formatter,
41
42
  truncate: true,
42
43
  age: self.log_age,
43
44
  keep: self.log_keep,
@@ -45,11 +46,22 @@ module Libis
45
46
  level: self.log_level
46
47
  )
47
48
  end
48
- logger = Config.logger(self.name, self.name)
49
+ logger = ::Libis::Workflow::Mongoid::Config.logger(self.name, self.name)
49
50
  logger.additive = false
50
51
  logger
51
52
  end
52
53
 
54
+ # noinspection RubyStringKeysInHashInspection
55
+ def execute(opts = {})
56
+ if self.log_each_run
57
+ opts[:run_config] = {
58
+ 'log_to_file=' => true,
59
+ 'log_level=' => self.log_level
60
+ }
61
+ end
62
+ super opts
63
+ end
64
+
53
65
  # def create_run_object
54
66
  # # noinspection RubyResolve
55
67
  # self.runs.build
@@ -18,6 +18,7 @@ module Libis
18
18
 
19
19
  field :start_date, type: Time, default: -> { Time.now }
20
20
  field :log_to_file, type: Boolean, default: false
21
+ field :log_level, type: String, default: 'DEBUG'
21
22
 
22
23
  set_callback(:destroy, :before) do |document|
23
24
  wd = document.work_dir
@@ -37,18 +38,20 @@ module Libis
37
38
  end
38
39
 
39
40
  def logger
40
- return ::Libis::Workflow::Mongoid::Config.logger unless self.log_to_file
41
+ unless self.log_to_file
42
+ return self.job.logger
43
+ end
41
44
  logger = ::Logging::Repository[self.name]
42
45
  return logger if logger
43
46
  unless ::Logging::Appenders[self.name]
44
47
  ::Logging::Appenders::File.new(
45
48
  self.name,
46
49
  filename: File.join(::Libis::Workflow::Mongoid::Config[:log_dir], "#{self.name}.log"),
47
- layout: Config.get_log_formatter,
50
+ layout: ::Libis::Workflow::Mongoid::Config.get_log_formatter,
48
51
  level: self.log_level
49
52
  )
50
53
  end
51
- logger = Config.logger(self.name, self.name)
54
+ logger = ::Libis::Workflow::Mongoid::Config.logger(self.name, self.name)
52
55
  logger.additive = false
53
56
  logger
54
57
  end
@@ -3,7 +3,7 @@
3
3
  module Libis
4
4
  module Workflow
5
5
  module Mongoid
6
- VERSION = '2.0.1' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
6
+ VERSION = '2.0.2' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
7
7
  end
8
8
  end
9
9
  end
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
  require 'libis-workflow'
3
- require_relative 'dynamic'
4
3
 
5
4
  module Libis
6
5
  module Workflow
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
  require 'libis-workflow'
3
- require_relative 'dynamic'
4
3
 
5
4
  module Libis
6
5
  module Workflow
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.1
4
+ version: 2.0.2
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-03-07 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libis-workflow