mutx 0.1.63 → 0.1.64
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/Gemfile.lock +2 -2
- data/lib/mutx/API/tasks.rb +5 -0
- data/lib/mutx/background_jobs/workers/mutx_cron.rb +5 -3
- data/lib/mutx/database/mongo_connector.rb +4 -0
- data/lib/mutx/routes.rb +39 -1
- data/lib/mutx/support/mail_sender.rb +1 -0
- data/lib/mutx/tasks/task.rb +8 -4
- data/lib/mutx/version.rb +1 -1
- data/lib/mutx/view/body.mote +7 -2
- data/lib/mutx/view/last_notified.mote +13 -0
- data/lib/mutx/view/message.mote +8 -0
- data/lib/mutx/view/tasks/task_item.mote +6 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b257730c4744554045a3ddfb825e14e9d7803c1
|
4
|
+
data.tar.gz: c89992c76350f4b3a3bae1090e2c8011cdc0d348
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 651690d6f668b7862f460dc19fa5946f06239f827143fbf0be9ba25f316aacab191b50b0910b14299d0feb3b1826b804a59d432b6fde228f00849b16883ae3c6
|
7
|
+
data.tar.gz: 350d922f8ee3a4b03d9a776d6afc189e2add57ba58a868d2685947693d3de6f4afffe34664a31e1b5924635e24bcbc3a4e058bfa9fe29bc7217f70f5391d541e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mutx (0.1.
|
4
|
+
mutx (0.1.64)
|
5
5
|
basica
|
6
6
|
bson_ext
|
7
7
|
byebug
|
@@ -95,7 +95,7 @@ GEM
|
|
95
95
|
raindrops (0.17.0)
|
96
96
|
rake (12.0.0)
|
97
97
|
redcarpet (3.4.0)
|
98
|
-
redis (3.3.
|
98
|
+
redis (3.3.3)
|
99
99
|
require_all (1.4.0)
|
100
100
|
rufus-scheduler (3.3.2)
|
101
101
|
tzinfo
|
data/lib/mutx/API/tasks.rb
CHANGED
@@ -29,6 +29,11 @@ module Mutx
|
|
29
29
|
data["information"] = nil if data["information"].nil?
|
30
30
|
data["last_exec_time"] = Time.now.utc
|
31
31
|
data["stop_bots"] = data["stop_bots"]
|
32
|
+
if data["task_status"] == "off"
|
33
|
+
data["task_status"] = "off"
|
34
|
+
else
|
35
|
+
data["task_status"] = "on"
|
36
|
+
end
|
32
37
|
data
|
33
38
|
end
|
34
39
|
|
@@ -13,6 +13,7 @@ module Mutx
|
|
13
13
|
recurrence { minutely(1) }
|
14
14
|
|
15
15
|
def perform
|
16
|
+
#def self.checker
|
16
17
|
Mutx::Database::MongoConnector.new Mutx::Support::Configuration.db_connection_data
|
17
18
|
running_task = []
|
18
19
|
#running_task = Mutx::Database::MongoConnector.running_now
|
@@ -20,7 +21,7 @@ module Mutx
|
|
20
21
|
puts "######### STARTING CRON ##########"
|
21
22
|
|
22
23
|
if running_task.eql? []
|
23
|
-
|
24
|
+
|
24
25
|
@days = [:mo,:tu,:we,:th,:fr,:sa,:su]
|
25
26
|
@today = day_name #name of today
|
26
27
|
|
@@ -30,7 +31,7 @@ module Mutx
|
|
30
31
|
|
31
32
|
puts "#{cron_tasks_list.size} cronned task searched"
|
32
33
|
|
33
|
-
cron_tasks_list.select{|line| cron_tasks << line if (((Time.now.utc - line[:last_exec_time].utc) + 1) >= (line[:cron_time].to_i * 60))}
|
34
|
+
cron_tasks_list.select{|line| cron_tasks << line if ( (((Time.now.utc - line[:last_exec_time].utc) + 1) >= (line[:cron_time].to_i * 60)) && (line[:task_status].eql? "on") )}
|
34
35
|
cron_tasks_list = []
|
35
36
|
cron_tasks_list = cron_tasks
|
36
37
|
puts "#{cron_tasks_list.size} POSSIBLE cronned task on time to run"
|
@@ -71,13 +72,14 @@ module Mutx
|
|
71
72
|
|
72
73
|
end#cron_task
|
73
74
|
|
74
|
-
|
75
|
+
Mutx::Database::MongoConnector.close
|
75
76
|
puts "######### ENDING CRON ##########"
|
76
77
|
else ## si hay algo corriendo deja pasar toda la ejecucion hasta que finalice
|
77
78
|
puts
|
78
79
|
puts "HAY EJECUCIONES EN RUNNING O STARTED, SE ESPERA A QUE TERMINEN..."
|
79
80
|
puts
|
80
81
|
puts "######### ENDING CRON ##########"
|
82
|
+
Mutx::Database::MongoConnector.close
|
81
83
|
end
|
82
84
|
|
83
85
|
end #perform
|
@@ -369,6 +369,10 @@ module Mutx
|
|
369
369
|
$results.update_one({"_id" => result_id}, {"$set" => {"file_attached" => "yes"}})
|
370
370
|
end
|
371
371
|
|
372
|
+
def self.update_status task_id, status
|
373
|
+
$tasks.update_one({"_id" => task_id}, {"$set" => {"task_status" => status}})
|
374
|
+
end
|
375
|
+
|
372
376
|
def self.active_tasks
|
373
377
|
self.all_tasks
|
374
378
|
end
|
data/lib/mutx/routes.rb
CHANGED
@@ -490,6 +490,44 @@ Cuba.define do
|
|
490
490
|
res.redirect path
|
491
491
|
end
|
492
492
|
|
493
|
+
on "task/status/:task_name" do |task_name|
|
494
|
+
task = Mutx::Tasks::Task.get_task_with task_name.gsub(/%20/, " ")
|
495
|
+
if task.blocked.eql? "on"
|
496
|
+
$result = basic_auth(env) do |user, pass|
|
497
|
+
user == "mutx" && pass == "mutxAdmin"
|
498
|
+
end
|
499
|
+
if $result.eql? true
|
500
|
+
query_string = Mutx::Support::QueryString.new req
|
501
|
+
task_name = task_name.gsub!("%20"," ") if task_name.include? "%20"
|
502
|
+
task = Mutx::Database::MongoConnector.task_data_for_name(task_name)
|
503
|
+
if task["task_status"].eql? "off"
|
504
|
+
status = "on"
|
505
|
+
else
|
506
|
+
status = "off"
|
507
|
+
end
|
508
|
+
Mutx::Database::MongoConnector.update_status(task["_id"], status)
|
509
|
+
res.redirect "/tasks"
|
510
|
+
else
|
511
|
+
on default do
|
512
|
+
res.status = 401
|
513
|
+
res.headers["WWW-Authenticate"] = 'Basic realm="MyApp"'
|
514
|
+
res.write "Access Denied, Mutx don't let you STOP/START this execution without authorization"
|
515
|
+
end
|
516
|
+
end
|
517
|
+
else
|
518
|
+
query_string = Mutx::Support::QueryString.new req
|
519
|
+
task_name = task_name.gsub!("%20"," ") if task_name.include? "%20"
|
520
|
+
task = Mutx::Database::MongoConnector.task_data_for_name(task_name)
|
521
|
+
if task["task_status"].eql? "off"
|
522
|
+
status = "on"
|
523
|
+
else
|
524
|
+
status = "off"
|
525
|
+
end
|
526
|
+
Mutx::Database::MongoConnector.update_status(task["_id"], status)
|
527
|
+
res.redirect "/tasks"
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
493
531
|
|
494
532
|
on "message/task/:result_id" do |result_id|
|
495
533
|
query_string = Mutx::Support::QueryString.new req
|
@@ -860,7 +898,7 @@ Cuba.define do
|
|
860
898
|
|
861
899
|
end
|
862
900
|
|
863
|
-
##Mutx::Database::MongoConnector.
|
901
|
+
##Mutx::Database::MongoConnector.close
|
864
902
|
|
865
903
|
rescue => e
|
866
904
|
Mutx::Support::Log.error "Cuba: #{e} #{e.backtrace}" if Mutx::Support::Log
|
data/lib/mutx/tasks/task.rb
CHANGED
@@ -44,7 +44,8 @@ module Mutx
|
|
44
44
|
:su,
|
45
45
|
:start_time,
|
46
46
|
:stop_time,
|
47
|
-
:stop_bots
|
47
|
+
:stop_bots,
|
48
|
+
:task_status
|
48
49
|
|
49
50
|
REGEX_VALID_VALUES = ["failed","passed","none"]
|
50
51
|
NOTIFY_VALID_VALUES = ["any","passed","failed"]
|
@@ -93,6 +94,7 @@ module Mutx
|
|
93
94
|
@stop_time = task_data["stop_time"]
|
94
95
|
@notify_on = task_data["notify_on"] || "any"
|
95
96
|
@stop_bots = task_data["stop_bots"]
|
97
|
+
@task_status = task_data["task_status"] || "off"
|
96
98
|
else
|
97
99
|
Mutx::Support::Log.error "Creting task object. Argument is not a hash" if Mutx::Support::Log
|
98
100
|
raise "Task data not defined correctly. Expecting info about task"
|
@@ -159,7 +161,8 @@ module Mutx
|
|
159
161
|
"stop_time" => data["stop_time"],
|
160
162
|
"value_for_regex" => data["value_for_regex"],
|
161
163
|
"notify_on" => data["notify_on"],
|
162
|
-
"stop_bots" => data["stop_bots"]
|
164
|
+
"stop_bots" => data["stop_bots"],
|
165
|
+
"task_status" => data["task_status"]
|
163
166
|
}
|
164
167
|
self.new(task_data)
|
165
168
|
end
|
@@ -300,7 +303,8 @@ module Mutx
|
|
300
303
|
"stop_time" => stop_time,
|
301
304
|
"value_for_regex" => value_for_regex,
|
302
305
|
"notify_on" => notify_on,
|
303
|
-
"stop_bots" => stop_bots
|
306
|
+
"stop_bots" => stop_bots,
|
307
|
+
"task_status" => task_status
|
304
308
|
}
|
305
309
|
end
|
306
310
|
|
@@ -367,4 +371,4 @@ module Mutx
|
|
367
371
|
end
|
368
372
|
|
369
373
|
end
|
370
|
-
end
|
374
|
+
end
|
data/lib/mutx/version.rb
CHANGED
data/lib/mutx/view/body.mote
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
# encoding: utf-8
|
3
3
|
query_string = args[:query_string]
|
4
4
|
|
5
|
+
msg = if query_string.msg
|
6
|
+
message_file_path = File.read("#{Mutx::View.path}/message.mote")
|
7
|
+
Mote.parse(message_file_path, self, [:query_string]).call(query_string: query_string)
|
8
|
+
end
|
9
|
+
|
5
10
|
clean = query_string.clean || false
|
6
11
|
|
7
12
|
message = section =~ /message/i ? " onload=\"javascript:startTimer();\"" : nil
|
@@ -54,14 +59,14 @@
|
|
54
59
|
|
55
60
|
{{navigation_bar}}
|
56
61
|
|
57
|
-
|
62
|
+
{{msg}}
|
58
63
|
|
59
64
|
<div class='container'>
|
60
65
|
<br>
|
61
66
|
{{git_information}}
|
62
67
|
</div>
|
63
68
|
<div class='container'>
|
64
|
-
|
69
|
+
|
65
70
|
<p>{{content}}</p>
|
66
71
|
|
67
72
|
{{footer}}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?
|
2
|
+
|
3
|
+
output = Mutx::API::Result.last_notified
|
4
|
+
|
5
|
+
?>
|
6
|
+
|
7
|
+
<div class="well">
|
8
|
+
<div style='width: 100%; display: table;'>
|
9
|
+
<div style='display: table-row'>
|
10
|
+
<div style='width: 600px; display: table-cell;'>{{output}}</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div style="padding: 20px; z-index: 9999; position: absolute; top: 20px; right: 20px;">
|
2
|
+
<div class="alert alert-info alert-dismissible fade in" role="alert">
|
3
|
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
4
|
+
<span aria-hidden="true"> × </span>
|
5
|
+
</button>
|
6
|
+
<strong>{{query_string.msg[0..30]}}</strong>
|
7
|
+
</div>
|
8
|
+
</div>
|
@@ -35,6 +35,11 @@ color = Mutx::View.color(status)
|
|
35
35
|
</h3>
|
36
36
|
</div>
|
37
37
|
<div class="panel-body">
|
38
|
+
% if (task["task_status"].eql? "off")
|
39
|
+
<a href="task/status/{{task["name"].gsub(' ','%20')}}" title= "Click to allow task to be cronned" class="label label-danger" aria-hidden="true"> <i <span class="glyphicon glyphicon-off"></span> OFF </i></a>
|
40
|
+
% elsif (task["task_status"].eql? "on")
|
41
|
+
<a href="task/status/{{task["name"].gsub(' ','%20')}}" title= "Click to stop task and cannot be cronned" class="label label-success" aria-hidden="true"> <i <span class="glyphicon glyphicon-play-circle"></span> ON </i></a>
|
42
|
+
% end
|
38
43
|
<a href='/{{task["type"]}}s/{{task["name"].gsub(' ','%20')}}' class='label label-success'>
|
39
44
|
Open</a>
|
40
45
|
<a href='/results/task/{{task["name"].gsub(' ','%20')}}' class='label label-info'>
|
@@ -69,4 +74,4 @@ color = Mutx::View.color(status)
|
|
69
74
|
width: auto;
|
70
75
|
padding: 10px;
|
71
76
|
}
|
72
|
-
</style>
|
77
|
+
</style>
|
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.64
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -493,9 +493,11 @@ files:
|
|
493
493
|
- lib/mutx/view/help/page.mote
|
494
494
|
- lib/mutx/view/help/search_result.mote
|
495
495
|
- lib/mutx/view/javascript.mote
|
496
|
+
- lib/mutx/view/last_notified.mote
|
496
497
|
- lib/mutx/view/list_repos.mote
|
497
498
|
- lib/mutx/view/logs/log.mote
|
498
499
|
- lib/mutx/view/logs/logs.mote
|
500
|
+
- lib/mutx/view/message.mote
|
499
501
|
- lib/mutx/view/modals.mote
|
500
502
|
- lib/mutx/view/navigation_bar.mote
|
501
503
|
- lib/mutx/view/not_found.mote
|