web47core 0.8.5 → 0.9.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b16d9b0b72656026fc126f56d58ca8b1a8e99843feeec96e6892ac139bb4870e
|
4
|
+
data.tar.gz: 624d9b7f27b76d83a1962bb9bed017c766c61323ba507626ed8c56baaf2a9166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d835b86f996ed2b6d3871f9a3a57e1226f2603592990ec42104a769350ab896c9dec7de884cd3ccca6f7cd1bda8164d64447da910c690c6a75d711c925a4319c
|
7
|
+
data.tar.gz: 05da6cc82d68d43c244933dcd10db0ce6be3bb5f915b57325b35cff8d6c89e8f5121e1debb0f626b7312efd3d9ac107872eb3a512e1e03be7226c0971b8d72d9
|
@@ -5,7 +5,7 @@ module Cron
|
|
5
5
|
# Value object for a cron tab entry
|
6
6
|
#
|
7
7
|
class JobTab < Tab
|
8
|
-
FRAMEWORK_CLASSES = %w[
|
8
|
+
FRAMEWORK_CLASSES = %w[job trim_collection command server tab job_tab].freeze unless defined? FRAMEWORK_CLASSES
|
9
9
|
#
|
10
10
|
# Validations
|
11
11
|
#
|
@@ -36,7 +36,7 @@ module Cron
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def job_names
|
39
|
-
@job_names ||=
|
39
|
+
@job_names ||= all_jobs.collect do |job|
|
40
40
|
job_name = job.to_s
|
41
41
|
next if FRAMEWORK_CLASSES.include?(job_name) || job_name.end_with?('Test') || job_name.start_with?('Base')
|
42
42
|
|
@@ -46,6 +46,14 @@ module Cron
|
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
+
def all_jobs
|
50
|
+
(list_jobs("#{__dir__}/*.rb") + list_jobs(Rails.root.join('app/jobs/cron/*.rb'))).compact.uniq
|
51
|
+
end
|
52
|
+
|
53
|
+
def list_jobs(directory)
|
54
|
+
Dir[directory].collect { |file| file.split('/cron/').last.split('.rb').first }
|
55
|
+
end
|
56
|
+
|
49
57
|
def configure_cron_tab(tab, type)
|
50
58
|
case type
|
51
59
|
when :always
|
data/lib/app/jobs/cron/tab.rb
CHANGED
@@ -11,6 +11,8 @@ module Cron
|
|
11
11
|
# Constants
|
12
12
|
#
|
13
13
|
WILDCARD = '*' unless defined? WILDCARD
|
14
|
+
COMMA_DELIM = ',' unless defined? COMMA_DELIM
|
15
|
+
SLASH_DEMO = '/' unless defined? SLASH_DEMO
|
14
16
|
TIME_UNITS = %i[min hour wday mday month].freeze unless defined? TIME_UNITS
|
15
17
|
#
|
16
18
|
# Fields
|
@@ -45,7 +47,7 @@ module Cron
|
|
45
47
|
# For completion of class, but must be implemented by child class
|
46
48
|
#
|
47
49
|
def run
|
48
|
-
set last_run_at: Time.now.utc
|
50
|
+
set({ last_run_at: Time.now.utc })
|
49
51
|
end
|
50
52
|
|
51
53
|
private
|
@@ -69,11 +71,11 @@ module Cron
|
|
69
71
|
when Integer
|
70
72
|
range.include?(value)
|
71
73
|
else
|
72
|
-
if value.include?(
|
73
|
-
(numerator, divisor) = value.split(
|
74
|
+
if value.include?(SLASH_DEMO)
|
75
|
+
(numerator, divisor) = value.split(SLASH_DEMO)
|
74
76
|
range.include?(divisor.to_i) && numerator.eql?(WILDCARD)
|
75
|
-
elsif value.include?(
|
76
|
-
options = value.split(
|
77
|
+
elsif value.include?(COMMA_DELIM)
|
78
|
+
options = value.split(COMMA_DELIM)
|
77
79
|
options.collect { |o| range.include?(o.to_i) }.all?
|
78
80
|
else
|
79
81
|
range.include?(value.to_i)
|
@@ -96,11 +98,11 @@ module Cron
|
|
96
98
|
when Integer
|
97
99
|
time.send(unit).eql?(target)
|
98
100
|
else
|
99
|
-
if target.include?(
|
100
|
-
divisor = target.split(
|
101
|
+
if target.include?(SLASH_DEMO)
|
102
|
+
divisor = target.split(SLASH_DEMO).last.to_i
|
101
103
|
(time.send(unit) % divisor).zero?
|
102
|
-
elsif target.include?(
|
103
|
-
options = target.split(
|
104
|
+
elsif target.include?(COMMA_DELIM)
|
105
|
+
options = target.split(COMMA_DELIM)
|
104
106
|
options.collect { |o| time.send(unit.eql?(o.to_i)) }.any?
|
105
107
|
else
|
106
108
|
time.send(unit).eql?(target.to_i)
|
@@ -12,18 +12,6 @@ module Cron
|
|
12
12
|
AuditLog.all
|
13
13
|
end
|
14
14
|
|
15
|
-
#
|
16
|
-
# Check which audit logs we wanted deleted
|
17
|
-
#
|
18
|
-
# Should be older than 90 days and either not a user model audit log or the model associated with
|
19
|
-
# the UserModelAuditLog has been deleted
|
20
|
-
#
|
21
|
-
def archive?(item)
|
22
|
-
super && (!item.is_a?(UserModelAuditLog) || item.model.blank?)
|
23
|
-
rescue StandardError
|
24
|
-
super
|
25
|
-
end
|
26
|
-
|
27
15
|
#
|
28
16
|
# Allowed time the amount of time allowed to exists before deleting
|
29
17
|
#
|
@@ -68,6 +68,8 @@ module CoreSystemConfiguration
|
|
68
68
|
field :switchboard_stack_id, type: String
|
69
69
|
field :switchboard_stack_api_token, type: String
|
70
70
|
field :switchboard_last_sync_at, type: Time
|
71
|
+
# Audit Logs TTL
|
72
|
+
field :user_model_audit_log_ttl, type: Integer, default: 365
|
71
73
|
#
|
72
74
|
# Validations
|
73
75
|
#
|
data/lib/web47core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web47core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schroeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|