mutx 0.1.25 → 0.1.26
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/generators/templates/cron.rb.tt +53 -3
- data/mutx.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e856163b512f027c00a5f1e005ae1837f4dd2319
|
4
|
+
data.tar.gz: d9f7dfca99da92ceb2cf57559ec71ebe4d508fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cedb4fe27800291ce61fb7834f1bffc157af1a9f796d940ef37bd5d40a1e1a9b7af16863378963df0019b370dac16aac4fb787a6edbd95d40438e2cf314cafd4
|
7
|
+
data.tar.gz: dcd49bf7ecb6d34ac8d8e3e882d765866931053dce7c0d85c71677996dad492f09cb9d82778dec8e3908eae96e2801fa098d6a3eed5e75082468c9109722a8d7
|
@@ -1,24 +1,74 @@
|
|
1
1
|
require 'mutx'
|
2
|
+
require 'chronic'
|
2
3
|
|
3
4
|
module Cron
|
4
5
|
class Tasks
|
5
6
|
|
6
7
|
def self.cron_jobs
|
8
|
+
@days = [:mo,:tu,:we,:th,:fr,:sa,:su]
|
7
9
|
cron_tasks_list = Mutx::Database::MongoConnector.cron_tasks
|
10
|
+
@none_day = true
|
11
|
+
@today = day_name #name of today
|
12
|
+
|
13
|
+
@now_time = Time.now.hour.to_s+":"+Time.now.min.to_s
|
8
14
|
|
9
15
|
cron_tasks_list.each do |task|
|
10
|
-
|
16
|
+
@days.detect{|day| @none_day = "task_with_day" if task[:"#{day}"]}
|
17
|
+
|
18
|
+
# If no day execution is seted, works as always
|
19
|
+
if (((!task[:cron_time].eql? "") && (!task[:cron_time].eql? "0")) &&
|
20
|
+
(((Time.now.utc - task[:last_exec_time].utc) + 1) >= (task[:cron_time].to_i * 60)) &&
|
21
|
+
(@none_day.eql? true))
|
22
|
+
|
11
23
|
query_string = {}
|
12
24
|
query_string = {"execution_name"=>"CRONNED-#{task[:cron_time]}-min"}
|
13
25
|
task_name = task[:name]
|
14
26
|
task_name.gsub!("%20"," ")
|
15
27
|
puts Mutx::API::Tasks.cron_update task
|
16
28
|
Mutx::API::Execution.start task_name, query_string
|
17
|
-
|
29
|
+
# If there is a day seted, and that day is today, and no execution time is seted
|
30
|
+
elsif (((!task[:cron_time].eql? "") && (!task[:cron_time].eql? "0")) &&
|
31
|
+
(((Time.now.utc - task[:last_exec_time].utc) + 1) >= (task[:cron_time].to_i * 60)) &&
|
32
|
+
(@none_day.eql? "task_with_day") && (task[:"#{@today}"].eql? "on") &&
|
33
|
+
(task[:start_time].empty?) && (task[:stop_time].empty?))
|
34
|
+
|
35
|
+
query_string = {}
|
36
|
+
query_string = {"execution_name"=>"CRONNED-#{task[:cron_time]}-min"}
|
37
|
+
task_name = task[:name]
|
38
|
+
task_name.gsub!("%20"," ")
|
39
|
+
puts Mutx::API::Tasks.cron_update task
|
40
|
+
Mutx::API::Execution.start task_name, query_string
|
41
|
+
|
42
|
+
# If there is a day seted, and that day is today, and execution range time is seted
|
43
|
+
elsif (((!task[:cron_time].eql? "") && (!task[:cron_time].eql? "0")) &&
|
44
|
+
(((Time.now.utc - task[:last_exec_time].utc) + 1) >= (task[:cron_time].to_i * 60)) &&
|
45
|
+
(@none_day.eql? "task_with_day") && (task[:"#{@today}"].eql? "on") &&
|
46
|
+
(@now_time.between? task[:start_time], task[:stop_time]))
|
47
|
+
|
48
|
+
query_string = {}
|
49
|
+
query_string = {"execution_name"=>"CRONNED-#{task[:cron_time]}-min"}
|
50
|
+
task_name = task[:name]
|
51
|
+
task_name.gsub!("%20"," ")
|
52
|
+
puts Mutx::API::Tasks.cron_update task
|
53
|
+
Mutx::API::Execution.start task_name, query_string
|
54
|
+
end#if
|
55
|
+
|
18
56
|
end
|
19
57
|
Mutx::Database::MongoConnector.force_close
|
20
58
|
end
|
59
|
+
|
60
|
+
|
61
|
+
def self.day_name()
|
62
|
+
num = Chronic.parse("today").wday
|
63
|
+
return "mo" if num.eql? 1
|
64
|
+
return "tu" if num.eql? 2
|
65
|
+
return "we" if num.eql? 3
|
66
|
+
return "th" if num.eql? 4
|
67
|
+
return "fr" if num.eql? 5
|
68
|
+
return "sa" if num.eql? 6
|
69
|
+
return "su" if num.eql? 7
|
70
|
+
end
|
21
71
|
end#class
|
22
72
|
end#module
|
23
73
|
|
24
|
-
Cron::Tasks.cron_jobs
|
74
|
+
Cron::Tasks.cron_jobs
|
data/mutx.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency 'thor'
|
24
24
|
spec.add_dependency 'cuba'
|
25
25
|
spec.add_dependency 'unicorn'
|
26
|
-
spec.add_dependency '
|
26
|
+
spec.add_dependency 'mongoid', '~> 5.1.0'
|
27
27
|
spec.add_dependency 'redis'
|
28
28
|
spec.add_dependency 'sidekiq'
|
29
29
|
spec.add_dependency 'bson_ext'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: mongoid
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 5.1.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 5.1.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: redis
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -360,7 +360,6 @@ files:
|
|
360
360
|
- lib/mutx/API/task.rb
|
361
361
|
- lib/mutx/API/tasks.rb
|
362
362
|
- lib/mutx/background_jobs/.DS_Store
|
363
|
-
- lib/mutx/background_jobs/sender_mail.rb
|
364
363
|
- lib/mutx/background_jobs/sidekiq.rb
|
365
364
|
- lib/mutx/background_jobs/workers/.DS_Store
|
366
365
|
- lib/mutx/background_jobs/workers/email_sender.rb
|
@@ -400,6 +399,7 @@ files:
|
|
400
399
|
- lib/mutx/support/log.rb
|
401
400
|
- lib/mutx/support/logo.rb
|
402
401
|
- lib/mutx/support/logs.rb
|
402
|
+
- lib/mutx/support/mail_sender.rb
|
403
403
|
- lib/mutx/support/notification.rb
|
404
404
|
- lib/mutx/support/processes.rb
|
405
405
|
- lib/mutx/support/query_string.rb
|