mutx 0.1.69 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/documentation/repos.md +21 -24
  4. data/lib/generators/task_rack.rb +8 -2
  5. data/lib/generators/templates/config.ru.tt +1 -1
  6. data/lib/mutx/API/execution.rb +8 -44
  7. data/lib/mutx/API/repo.rb +7 -10
  8. data/lib/mutx/background_jobs/workers/executor.rb +44 -38
  9. data/lib/mutx/commands/install.rb +1 -1
  10. data/lib/mutx/commands/start.rb +1 -1
  11. data/lib/mutx/custom/execution.rb +1 -1
  12. data/lib/mutx/database/mongo_connector.rb +19 -22
  13. data/lib/mutx/execution.rb +1 -0
  14. data/lib/mutx/lib/authentication.rb +23 -0
  15. data/lib/mutx/lib/helpers.rb +52 -0
  16. data/lib/mutx/lib/middlewares/database_middleware.rb +16 -0
  17. data/lib/mutx/lib/middlewares/flash_middleware.rb +31 -0
  18. data/lib/mutx/lib/middlewares/logger_middleware.rb +13 -0
  19. data/lib/mutx/lib/monkey_patch.rb +28 -0
  20. data/lib/mutx/lib/paths.rb +80 -0
  21. data/lib/mutx/platforms/ruby.rb +8 -0
  22. data/lib/mutx/public/css/bootstrap.min.css +7 -0
  23. data/lib/mutx/public/css/font-awesome.min.css +4 -0
  24. data/lib/mutx/public/css/jquery.json-viewer.css +44 -0
  25. data/{favicon.ico → lib/mutx/public/img/favicon.ico} +0 -0
  26. data/lib/mutx/public/js/bootstrap.min.js +6 -0
  27. data/lib/mutx/public/js/jquery.json-viewer.js +148 -0
  28. data/lib/mutx/public/js/jquery.min.js +6 -0
  29. data/lib/mutx/{view/javascript.mote → public/js/mutx.js} +0 -5
  30. data/lib/mutx/public/js/notify.min.js +1 -0
  31. data/lib/mutx/results/result.rb +60 -68
  32. data/lib/mutx/results/results.rb +4 -0
  33. data/lib/mutx/routes.rb +85 -883
  34. data/lib/mutx/routes/admin_routes.rb +16 -0
  35. data/lib/mutx/routes/admin_routes/custom_params_routes.rb +97 -0
  36. data/lib/mutx/routes/admin_routes/repositories_routes.rb +35 -0
  37. data/lib/mutx/routes/admin_routes/tasks_routes.rb +110 -0
  38. data/lib/mutx/routes/api_routes.rb +49 -0
  39. data/lib/mutx/routes/api_routes/custom_params_routes.rb +41 -0
  40. data/lib/mutx/routes/api_routes/input_routes.rb +48 -0
  41. data/lib/mutx/routes/api_routes/repos_routes.rb +74 -0
  42. data/lib/mutx/routes/api_routes/results_routes.rb +50 -0
  43. data/lib/mutx/routes/api_routes/tasks_routes.rb +47 -0
  44. data/lib/mutx/routes/api_routes/tests_routes.rb +42 -0
  45. data/lib/mutx/routes/features_routes.rb +24 -0
  46. data/lib/mutx/routes/help_routes.rb +23 -0
  47. data/lib/mutx/routes/logs_routes.rb +22 -0
  48. data/lib/mutx/routes/message_routes.rb +24 -0
  49. data/lib/mutx/routes/repositories_routes.rb +25 -0
  50. data/lib/mutx/routes/results_routes.rb +53 -0
  51. data/lib/mutx/routes/task_results_routes.rb +25 -0
  52. data/lib/mutx/routes/tasks_routes.rb +67 -0
  53. data/lib/mutx/routes/tests_routes.rb +66 -0
  54. data/lib/mutx/support/change_inspector.rb +3 -3
  55. data/lib/mutx/support/files_cleanner.rb +12 -3
  56. data/lib/mutx/support/git.rb +11 -2
  57. data/lib/mutx/support/processes.rb +2 -2
  58. data/lib/mutx/support/project_type.rb +12 -0
  59. data/lib/mutx/tasks/task.rb +8 -2
  60. data/lib/mutx/version.rb +1 -1
  61. data/lib/mutx/view/{custom/params/delete_form.mote → admin/custom-params/_delete_form.mote} +2 -4
  62. data/lib/mutx/view/{custom/params/create_edit_form.mote → admin/custom-params/_form.mote} +5 -9
  63. data/lib/mutx/view/{custom/params/custom_param_task_deleting_box.mote → admin/custom-params/_task_deleting_box.mote} +1 -2
  64. data/lib/mutx/view/{custom/params → admin/custom-params}/delete.mote +1 -3
  65. data/lib/mutx/view/{custom/params → admin/custom-params}/edit.mote +1 -5
  66. data/lib/mutx/view/{custom/params/list.mote → admin/custom-params/index.mote} +8 -13
  67. data/lib/mutx/view/{custom/params → admin/custom-params}/new.mote +1 -5
  68. data/lib/mutx/view/{custom/params/custom_param_selection_box.mote → admin/custom-params/selection_box.mote} +2 -3
  69. data/lib/mutx/view/{list_repos.mote → admin/repositories/index.mote} +2 -6
  70. data/lib/mutx/view/{repos.mote → admin/repositories/new.mote} +2 -6
  71. data/lib/mutx/view/{tasks/admin/delete_form.mote → admin/tasks/_delete_form.mote} +2 -12
  72. data/lib/mutx/view/{tasks/admin/create_edit_form.mote → admin/tasks/_form.mote} +6 -9
  73. data/lib/mutx/view/{tasks/admin → admin/tasks}/delete.mote +1 -3
  74. data/lib/mutx/view/{tasks/admin → admin/tasks}/edit.mote +1 -4
  75. data/lib/mutx/view/{tasks/admin/list.mote → admin/tasks/index.mote} +5 -10
  76. data/lib/mutx/view/{tasks/admin → admin/tasks}/new.mote +1 -5
  77. data/lib/mutx/view/{tasks/admin/view.mote → admin/tasks/show.mote} +1 -3
  78. data/lib/mutx/view/body.mote +13 -51
  79. data/lib/mutx/view/{custom/params.mote → custom-params/_custom_params.mote} +3 -4
  80. data/lib/mutx/view/{custom/params → custom-params/types}/json.mote +0 -0
  81. data/lib/mutx/view/{custom/params → custom-params/types}/select_list.mote +0 -0
  82. data/lib/mutx/view/{custom/params → custom-params/types}/text.mote +0 -0
  83. data/lib/mutx/view/error_handler.mote +4 -54
  84. data/lib/mutx/view/features/{feature.mote → file.mote} +0 -0
  85. data/lib/mutx/view/features/index.mote +9 -0
  86. data/lib/mutx/view/git_information.mote +2 -8
  87. data/lib/mutx/view/help/{main.mote → _main.mote} +0 -0
  88. data/lib/mutx/view/help/{page.mote → _page.mote} +0 -0
  89. data/lib/mutx/view/help/{search_result.mote → _search_result.mote} +0 -0
  90. data/lib/mutx/view/help/index.mote +38 -0
  91. data/lib/mutx/view/layout/flash.mote +7 -0
  92. data/lib/mutx/view/{footer.mote → layout/footer.mote} +1 -1
  93. data/lib/mutx/view/layout/javascript.mote +6 -0
  94. data/lib/mutx/view/{modals.mote → layout/modals.mote} +0 -0
  95. data/lib/mutx/view/layout/navigation_bar.mote +88 -0
  96. data/lib/mutx/view/{styles.mote → layout/styles.mote} +10 -0
  97. data/lib/mutx/view/logs/{logs.mote → index.mote} +1 -1
  98. data/lib/mutx/view/logs/show.mote +3 -0
  99. data/lib/mutx/view/repositories/_repository.mote +7 -0
  100. data/lib/mutx/view/repositories/index.mote +23 -0
  101. data/lib/mutx/view/repositories/show.mote +21 -0
  102. data/lib/mutx/view/results/{detailed_info.mote → _result.mote} +5 -5
  103. data/lib/mutx/view/results/console.mote +63 -106
  104. data/lib/mutx/view/results/{all.mote → index.mote} +18 -24
  105. data/lib/mutx/view/sections.rb +36 -24
  106. data/lib/mutx/view/task_results/_result.mote +57 -0
  107. data/lib/mutx/view/{results/result.mote → task_results/_result_item.mote} +6 -5
  108. data/lib/mutx/view/task_results/index.mote +35 -0
  109. data/lib/mutx/view/tasks/_task.mote +90 -0
  110. data/lib/mutx/view/tasks/index.mote +61 -0
  111. data/lib/mutx/view/tasks/show.mote +167 -0
  112. data/lib/mutx/view/tests/_test.mote +90 -0
  113. data/lib/mutx/view/tests/index.mote +59 -0
  114. data/lib/mutx/view/tests/show.mote +172 -0
  115. data/lib/mutx/view/view.rb +172 -10
  116. metadata +89 -50
  117. data/lib/mutx/database/middleware.rb +0 -18
  118. data/lib/mutx/view/features.mote +0 -57
  119. data/lib/mutx/view/features/features_list.mote +0 -10
  120. data/lib/mutx/view/help.mote +0 -75
  121. data/lib/mutx/view/logs/log.mote +0 -3
  122. data/lib/mutx/view/message.mote +0 -8
  123. data/lib/mutx/view/navigation_bar.mote +0 -67
  124. data/lib/mutx/view/results/results.mote +0 -112
  125. data/lib/mutx/view/tasks/message.mote +0 -37
  126. data/lib/mutx/view/tasks/task.mote +0 -167
  127. data/lib/mutx/view/tasks/task_item.mote +0 -77
  128. data/lib/mutx/view/tasks/tasks.mote +0 -74
@@ -0,0 +1,59 @@
1
+ % if tests.empty?
2
+ <br>
3
+ <br>
4
+ <div id='well'>
5
+ <h3>No {{section}} defined</h3>
6
+ </div>
7
+ <br>
8
+ <br>
9
+ % else
10
+
11
+ <div class="panel panel-default">
12
+ <div class="panel-heading">
13
+ <h4>{{section.capitalize}}</h4>
14
+ </div>
15
+ <table class="table table-striped table-hover">
16
+ <tbody>
17
+ % tests.each do |test|
18
+ <tr>
19
+ {{ partial('tests/_test', test: test) }}
20
+ </tr>
21
+ % end
22
+ </tbody>
23
+ </table>
24
+ </div>
25
+ <div class="panel panel-default">
26
+ <div class="panel-body">
27
+ {{Mutx::View.icon_for("info")}}: Information about task<br>
28
+ {{Mutx::View.icon_for("cron")}}: Cronned task<br>
29
+ {{Mutx::View.icon_for("lock")}}: Protected<br>
30
+ {{Mutx::View.icon_for("notification")}}: Send notification<br>
31
+ {{Mutx::View.icon_for("attachment")}}: Last execution sent attachment<br>
32
+ {{Mutx::View.icon_for("results")}}: Results for task<br>
33
+ {{Mutx::View.icon_for("off")}}: Task is off<br>
34
+ {{Mutx::View.icon_for("on")}}: Task is on<br>
35
+ </div>
36
+ </div>
37
+ % end
38
+
39
+ <style>
40
+ #well {
41
+ aling: right;
42
+ height: 50px;
43
+ background: #F5F5F5;
44
+ width: 600px;
45
+ font-size: 20px;
46
+ #font-style: oblique;
47
+ color: #696969;
48
+ text-align: center;
49
+ padding: 0 20px;
50
+ margin: 20px;
51
+ display: flex;
52
+ justify-content: center;
53
+ /* align horizontal */
54
+ align-items: center;
55
+ /* align vertical */
56
+ margin-right: auto;
57
+ margin-left: auto;
58
+ }
59
+ </style>
@@ -0,0 +1,172 @@
1
+ <?
2
+
3
+ running_results = Mutx::Results.running_results_for_task_id test["_id"]
4
+ max_number_of_execs_reached = running_results.size == test["max_execs"]
5
+
6
+ status = if running_results.size>0
7
+ "running"
8
+ else
9
+ "ready"
10
+ end
11
+
12
+ color = Mutx::View.color(status)
13
+
14
+ ?>
15
+ <div class='starter-template'>
16
+ <div class='panel panel-{{color}}'>
17
+ <div class='panel-heading' data-toggle='collapse' data-target="#{{ test['name'].gsub(' ','') }}">
18
+ <h4 class='panel-title'>
19
+ {{ test['name'] }}
20
+ </h4>
21
+ </div>
22
+
23
+ <div class='panel-body collapse in' id="{{ test['name'].gsub(' ','') }}">
24
+ <ul class='list-group'>
25
+
26
+ <!-- Si el test está en running se muestran las ejecuciones -->
27
+ % if running_results.size > 0
28
+ <li class='list-group-item'>
29
+ &nbsp;&nbsp;&nbsp;Running {{ running_results.size }} tests
30
+ % if max_number_of_execs_reached
31
+ <small>
32
+ (Maximum no. of execution reached)
33
+ </small>
34
+ % end
35
+ <div class='panel-body'>
36
+ <div class='list-group'>
37
+ % running_results.each do |result|
38
+ <a class='list-group-item' onclick="goClean('{{ path_for(:results_log, result_id: result["_id"]) }}');">
39
+ {{Mutx::Support::TimeHelper.formatted_time_for(Mutx::Results::Result.get(result["_id"]).started_at)}}&nbsp;
40
+ <small>
41
+ {{result["execution_name"]}}
42
+ </small>&nbsp;
43
+ {{Mutx::View.icon_for_running result}}
44
+ </a>
45
+ % end
46
+ </div>
47
+ </div>
48
+ </li>
49
+ % end
50
+ % unless max_number_of_execs_reached
51
+ <li class='list-group-item'>
52
+ % task_type = (test["type"] == "test") ? "tests" : "tasks"
53
+ % form_url = "/#{task_type}/#{test["name"]}/run"
54
+ <form name='run' id='{{ test["name"] }}' method='GET' action='{{ path_for(:tests_run, test_name: test["name"]) }}'>
55
+
56
+ % unless test["custom_params"].empty?
57
+ {{ partial('custom-params/_custom_params', custom_params: test["custom_params"]) }}
58
+ % end
59
+ <br>
60
+ <div class='container' style='width: inherit'>
61
+ <button type='submit' class='btn btn-success' value='Execute'/>Execute&nbsp;
62
+ {{Mutx::View.icon_for('run')}}
63
+ </button>
64
+ <input type='text' name='execution_name' class='customParam' title='This value could be used to identify the result execution from other execution of this test. E.g: You could use the release your are going to test' placeholder='Identify your execution' value='{{Mutx::Support::Configuration.auto_execution_id}}' style='height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px; font-weight:normal;' />
65
+ <button type='button' class='btn btn-default' aria-label='Left Align' data-toggle='modal' data-target='#myModal' onclick='javascript:starterLink("{{test['name']}}","{{test['type']}}");'>
66
+ {{Mutx::View.icon_for('share')}}
67
+ Share
68
+ </button>
69
+ <br>
70
+ <br>
71
+ </div>
72
+ </form>
73
+ </li>
74
+ % end
75
+ <br>
76
+ <li class="list-group-item">
77
+ <!-- cron info -->
78
+ % if test["cronneable"]=="on"
79
+ <br>
80
+ <div class="panel panel-default">
81
+ <div class="panel-heading">
82
+ {{Mutx::View.icon_for('repeat')}}&nbsp;
83
+ Cron information
84
+ </div>
85
+ <div class="panel-body">
86
+ <p class="small">
87
+ Run every {{test["cron_time"]}} minutes
88
+ {{Mutx::View.from_to(test)}}
89
+ {{Mutx::View.run_on(test)}}
90
+ </p>
91
+ </div>
92
+ </div>
93
+ % end
94
+ <!-- end cron info -->
95
+
96
+ <!-- notification info -->
97
+ % if test["notifications"]=="on"
98
+ <div class="panel panel-default">
99
+ <div class="panel-heading">
100
+ {{Mutx::View.icon_for('notification')}}&nbsp;
101
+ Notifications
102
+ </div>
103
+ <div class="panel-body">
104
+ <p class="small">
105
+ Notificates on {{test["notify_on"]}}
106
+ </p>
107
+ <p class="small">
108
+ To: {{test["mail"]}}
109
+ </p>
110
+ <p class="small">
111
+ Subject: {{test["subject"]}}
112
+ </p>
113
+ </div>
114
+ </div>
115
+
116
+ % end
117
+ <!-- end notification info -->
118
+
119
+ <!-- information -->
120
+ % if test["information"]
121
+ <div class="panel panel-default">
122
+ <div class="panel-heading">
123
+ {{Mutx::View.icon_for('info')}}&nbsp;
124
+ Information about {{test['name']}}
125
+ </div>
126
+ <div class="panel-body">
127
+ <p class="small" style="color:red">
128
+ {{test["information"]}}
129
+ </p>
130
+ </div>
131
+ </div>
132
+ % end
133
+ <!-- end information -->
134
+
135
+ % results_list = Mutx::Results.all_results_for test["_id"]
136
+ % if results_list and ! results_list.empty?
137
+ <div class="panel panel-default">
138
+ <div class="panel-heading">
139
+ Results for {{test["name"]}}
140
+ </div>
141
+ <table class="table table-striped table-hover"">
142
+ <thead>
143
+ <tr>
144
+ <th>When started</th>
145
+ <th>Label</th>
146
+ <th>Time Elapsed</th>
147
+ <th style="text-align: center;">Viewed</th>
148
+ <th style="text-align: center;">Notified</th>
149
+ <th style="text-align: center;">File Attached</th>
150
+ <th>Console</th>
151
+ <th>Status</th>
152
+ </tr>
153
+ </thead>
154
+ % results_list[0..9].each do |result_data|
155
+ {{ partial('task_results/_result_item', result: result_data) }}
156
+ % end
157
+ <tr>
158
+ <th>
159
+ <a href='{{ path_for(:task_results_index, query_string: { task_name: test["name"] }) }}' class='btn btn-default'>
160
+ {{Mutx::View.icon_for('results')}}
161
+ See all results
162
+ </a>
163
+ </th>
164
+ <tr>
165
+ </table>
166
+ </div>
167
+ % end
168
+ </li>
169
+ </ul>
170
+ </div>
171
+ </div>
172
+ </div>
@@ -6,6 +6,127 @@ module Mutx
6
6
  File.expand_path('../', __FILE__)
7
7
  end
8
8
 
9
+ def self.icon_for_result_status result
10
+ return "<i class=\"fa fa-cog fa-spin fa-1x fa-fw margin-bottom\" style=\"color:green\"></i>Running" if ["running","started"].include? result["status"]
11
+ value = result["result_value"] || result["status"]
12
+ gliphy, text, color = case value.gsub(/(?:\s|-|_)/,"").downcase
13
+ when /time/
14
+ ["hourglass","Time out", "red"]
15
+ when /finish/
16
+ ["ok","Finished","gray"]
17
+ when /stopped/
18
+ ["ban-circle","Stopped", "red"]
19
+ when /passed/
20
+ ["thumbs-up","Passed","green"]
21
+ when /failed/
22
+ ["thumbs-down","Failed","red"]
23
+ else
24
+ ["fire","Unknown","light-gray"]
25
+ end
26
+ "<span class=\"glyphicon glyphicon-#{gliphy}\" aria-hidden=\"true\" style=\"color:#{color}\"></span>&nbsp;<span style=\"color:#{color}\">#{text}</span>"
27
+ end
28
+
29
+ def self.icon_for_running result=nil, size=1
30
+ size = 2 if size == "big"
31
+ size = 1 if size == "small"
32
+ link = " onclick=\"goClean('/results/{{result['_id']}}/log/');\"" if result
33
+ "<i class=\"fa fa-cog fa-spin fa-#{size}x fa-fw margin-bottom\" #{link}></i>"
34
+ end
35
+
36
+ # Returns an gliphy icon by given word
37
+ # It maps words with icon
38
+ # @param [String] what = a word
39
+ # @return [String] the icon html with color, text and alt attribute
40
+ def self.icon_for what
41
+ gliphy, color, text, alt = case what.gsub(/(?:\s|-)/,"").downcase
42
+
43
+ when /attach/
44
+ ["paperclip",nil,nil,"Attachment"]
45
+
46
+ when /back/
47
+ ["circle-arrow-left",nil,nil,"Go Back"]
48
+
49
+ when /console/
50
+ ["log-in","black",nil,"console output"]
51
+
52
+ when /cron/
53
+ return "<span class=\"fa fa-clock-o\" aria-hidden=\"true\" alt=\"This test start automatically every minutes\"></span>"
54
+
55
+ when /edit/
56
+ ["edit","gray",nil,"Edit"]
57
+
58
+ when /forward/
59
+ ["circle-arrow-right",nil,nil,"Forward"]
60
+
61
+ when /feature/
62
+ ["file",nil,nil,"Features"]
63
+
64
+ when /info/
65
+ ["info-sign",nil,nil,"Information"]
66
+
67
+ when /left/
68
+ ["chevron-left",nil,nil,nil]
69
+
70
+ when /lock/
71
+ return "<span class=\"fa fa-lock\" aria-hidden=\"true\" style=\"color:red\" alt=\"Only admin can run this\"></span>"
72
+
73
+ when /notification/
74
+ ["envelope",nil,nil,"Notification"]
75
+
76
+ when /^on$/
77
+ ["off","green",nil,"On"]
78
+
79
+ when /^off$/
80
+ ["off","red",nil,"Off"]
81
+
82
+ when /repo/
83
+ ["hdd",nil,nil,"repo"]
84
+
85
+ when /right/
86
+ ["chevron-right",nil,nil,nil]
87
+
88
+ when /result/
89
+ ["th-list",nil,nil,"Results"]
90
+
91
+ when /search/
92
+ ["search",nil,nil,"Search"]
93
+
94
+ when /stop/
95
+ ["stop",nil,nil,"Search"]
96
+
97
+ when /task/
98
+ ["tasks",nil,nil,"tasks"]
99
+
100
+ when /test/
101
+ ["th-list",nil,nil,"test"]
102
+
103
+ when /viewed/
104
+ ["eye-open","blue",nil,"Viewed"]
105
+
106
+ when /unviewed/
107
+ ["eye-close",nil,nil,"Unviewed"]
108
+
109
+ when /(?:run|execute|send)/
110
+ ["send",nil,nil,"#{what}"]
111
+
112
+ when /(?:share|execute)/
113
+ ["share",nil,nil,"#{what}"]
114
+
115
+ when /(?:cicle|repeat)/
116
+ ["repeat",nil,nil,"#{what}"]
117
+
118
+ when /(?:book|doc|help)/
119
+ ["book",nil,nil,"#{what}"]
120
+
121
+ when /(?:admin|conf|setup)/
122
+ ["cog",nil,nil,"#{what}"]
123
+
124
+ else
125
+ ["fire","yellow",nil,"Undefined icon for #{what}"]
126
+ end
127
+ "<span class=\"glyphicon glyphicon-#{gliphy}\" aria-hidden=\"true\" style=\"color:#{color}\" alt=\"#{alt}\"></span>&nbsp;#{text}"
128
+ end
129
+
9
130
  def self.label_color_for result
10
131
  if result["status"]
11
132
  label_color = color result["status"]
@@ -58,16 +179,26 @@ module Mutx
58
179
  self.label_color_for result if result
59
180
  end
60
181
 
61
- def self.formatted_for seconds
62
- hours = seconds/ 3600
63
- seconds = seconds% 3600
64
- minutes = seconds/ 60
65
- seconds = seconds % 60
66
- elapsed = ""
67
- elapsed += "#{hours} h " if hours > 0
68
- elapsed += " #{minutes} m " if minutes > 0
69
- elapsed += "#{seconds} s" if seconds
70
- "#{elapsed}"
182
+ def self.formatted_for seconds=nil
183
+ begin
184
+ return "0 seconds" if seconds.nil? or !seconds.is_a? Fixnum
185
+ elapsed = ""
186
+ hours = minutes = 0
187
+ if seconds > 3600
188
+ hours = seconds / 3600
189
+ seconds = seconds % 3600
190
+ end
191
+ if seconds > 60
192
+ minutes = seconds / 60
193
+ seconds = seconds % 60
194
+ end
195
+ elapsed += "#{hours} h " if hours > 0
196
+ elapsed += " #{minutes} m " if minutes > 0
197
+ elapsed += "#{seconds} s" if seconds
198
+ "#{elapsed}"
199
+ rescue => e
200
+ "0 s"
201
+ end
71
202
  end
72
203
 
73
204
  def self.result_started_at result_id
@@ -75,6 +206,37 @@ module Mutx
75
206
  self.formatted_for result["started_at"] if result
76
207
  end
77
208
 
209
+ def self.run_on task
210
+ run_on = []
211
+ run_on << 'Sunday' if task["su"]=="on"
212
+ run_on << 'Monday' if task["mo"]=="on"
213
+ run_on << 'Tuesday' if task["tu"]=="on"
214
+ run_on << 'Wednesday' if task["we"]=="on"
215
+ run_on << 'Thursday' if task["th"]=="on"
216
+ run_on << 'Friday' if task["fr"]=="on"
217
+ run_on << 'Saturday' if task["sa"]=="on"
218
+
219
+ run_on << "everyday" if run_on.empty?
220
+
221
+ html = ""
222
+ unless run_on.empty?
223
+ html += "<p class=\"small\">on:&nbsp;"
224
+ run_on.each do |day|
225
+ html += "<span class='label label-primary'>#{day}&nbsp;</span>&nbsp;"
226
+ end
227
+ end
228
+ html
229
+ end
230
+
231
+ def self.from_to task
232
+ if task["start_time"]!= "" and task["stop_time"]!= ""
233
+ from_to = "from " + task["start_time"] + " to " + task["stop_time"]
234
+ end
235
+
236
+ "<p class=\"small\">#{from_to}</p>" if from_to
237
+
238
+ end
239
+
78
240
  def self.round_plus number
79
241
  return "10000+" if number > 10000
80
242
  return "#{number/100}00+" if number > 1000
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.69
4
+ version: 0.2.0
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-02-05 00:00:00.000000000 Z
11
+ date: 2017-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -371,7 +371,6 @@ files:
371
371
  - documentation/repos.md
372
372
  - documentation/results.md
373
373
  - documentation/start.md
374
- - favicon.ico
375
374
  - img/mutx_logo.png
376
375
  - img/mutx_logo.svg
377
376
  - lib/.DS_Store
@@ -429,15 +428,50 @@ files:
429
428
  - lib/mutx/custom/execution.rb
430
429
  - lib/mutx/custom/params.rb
431
430
  - lib/mutx/database/.DS_Store
432
- - lib/mutx/database/middleware.rb
433
431
  - lib/mutx/database/mongo_connection.rb
434
432
  - lib/mutx/database/mongo_connector.rb
435
433
  - lib/mutx/error/errors.rb
436
434
  - lib/mutx/execution.rb
435
+ - lib/mutx/lib/authentication.rb
436
+ - lib/mutx/lib/helpers.rb
437
+ - lib/mutx/lib/middlewares/database_middleware.rb
438
+ - lib/mutx/lib/middlewares/flash_middleware.rb
439
+ - lib/mutx/lib/middlewares/logger_middleware.rb
440
+ - lib/mutx/lib/monkey_patch.rb
441
+ - lib/mutx/lib/paths.rb
437
442
  - lib/mutx/platforms/ruby.rb
443
+ - lib/mutx/public/css/bootstrap.min.css
444
+ - lib/mutx/public/css/font-awesome.min.css
445
+ - lib/mutx/public/css/jquery.json-viewer.css
446
+ - lib/mutx/public/img/favicon.ico
447
+ - lib/mutx/public/js/bootstrap.min.js
448
+ - lib/mutx/public/js/jquery.json-viewer.js
449
+ - lib/mutx/public/js/jquery.min.js
450
+ - lib/mutx/public/js/mutx.js
451
+ - lib/mutx/public/js/notify.min.js
438
452
  - lib/mutx/results/result.rb
439
453
  - lib/mutx/results/results.rb
440
454
  - lib/mutx/routes.rb
455
+ - lib/mutx/routes/admin_routes.rb
456
+ - lib/mutx/routes/admin_routes/custom_params_routes.rb
457
+ - lib/mutx/routes/admin_routes/repositories_routes.rb
458
+ - lib/mutx/routes/admin_routes/tasks_routes.rb
459
+ - lib/mutx/routes/api_routes.rb
460
+ - lib/mutx/routes/api_routes/custom_params_routes.rb
461
+ - lib/mutx/routes/api_routes/input_routes.rb
462
+ - lib/mutx/routes/api_routes/repos_routes.rb
463
+ - lib/mutx/routes/api_routes/results_routes.rb
464
+ - lib/mutx/routes/api_routes/tasks_routes.rb
465
+ - lib/mutx/routes/api_routes/tests_routes.rb
466
+ - lib/mutx/routes/features_routes.rb
467
+ - lib/mutx/routes/help_routes.rb
468
+ - lib/mutx/routes/logs_routes.rb
469
+ - lib/mutx/routes/message_routes.rb
470
+ - lib/mutx/routes/repositories_routes.rb
471
+ - lib/mutx/routes/results_routes.rb
472
+ - lib/mutx/routes/task_results_routes.rb
473
+ - lib/mutx/routes/tasks_routes.rb
474
+ - lib/mutx/routes/tests_routes.rb
441
475
  - lib/mutx/support/change_inspector.rb
442
476
  - lib/mutx/support/clean.rb
443
477
  - lib/mutx/support/configuration.rb
@@ -453,6 +487,7 @@ files:
453
487
  - lib/mutx/support/mail_sender.rb
454
488
  - lib/mutx/support/notification.rb
455
489
  - lib/mutx/support/processes.rb
490
+ - lib/mutx/support/project_type.rb
456
491
  - lib/mutx/support/query_string.rb
457
492
  - lib/mutx/support/request.rb
458
493
  - lib/mutx/support/risk.rb
@@ -467,62 +502,66 @@ files:
467
502
  - lib/mutx/tasks/tasks.rb
468
503
  - lib/mutx/version.rb
469
504
  - lib/mutx/view/.DS_Store
505
+ - lib/mutx/view/admin/custom-params/_delete_form.mote
506
+ - lib/mutx/view/admin/custom-params/_form.mote
507
+ - lib/mutx/view/admin/custom-params/_task_deleting_box.mote
508
+ - lib/mutx/view/admin/custom-params/delete.mote
509
+ - lib/mutx/view/admin/custom-params/edit.mote
510
+ - lib/mutx/view/admin/custom-params/index.mote
511
+ - lib/mutx/view/admin/custom-params/new.mote
512
+ - lib/mutx/view/admin/custom-params/selection_box.mote
513
+ - lib/mutx/view/admin/repositories/index.mote
514
+ - lib/mutx/view/admin/repositories/new.mote
515
+ - lib/mutx/view/admin/tasks/_delete_form.mote
516
+ - lib/mutx/view/admin/tasks/_form.mote
517
+ - lib/mutx/view/admin/tasks/delete.mote
518
+ - lib/mutx/view/admin/tasks/edit.mote
519
+ - lib/mutx/view/admin/tasks/index.mote
520
+ - lib/mutx/view/admin/tasks/new.mote
521
+ - lib/mutx/view/admin/tasks/show.mote
470
522
  - lib/mutx/view/body.mote
471
- - lib/mutx/view/custom/params.mote
472
- - lib/mutx/view/custom/params/create_edit_form.mote
473
- - lib/mutx/view/custom/params/custom_param_selection_box.mote
474
- - lib/mutx/view/custom/params/custom_param_task_deleting_box.mote
475
- - lib/mutx/view/custom/params/delete.mote
476
- - lib/mutx/view/custom/params/delete_form.mote
477
- - lib/mutx/view/custom/params/edit.mote
478
- - lib/mutx/view/custom/params/json.mote
479
- - lib/mutx/view/custom/params/list.mote
480
- - lib/mutx/view/custom/params/new.mote
481
- - lib/mutx/view/custom/params/select_list.mote
482
- - lib/mutx/view/custom/params/text.mote
523
+ - lib/mutx/view/custom-params/_custom_params.mote
524
+ - lib/mutx/view/custom-params/types/json.mote
525
+ - lib/mutx/view/custom-params/types/select_list.mote
526
+ - lib/mutx/view/custom-params/types/text.mote
483
527
  - lib/mutx/view/error_handler.mote
484
- - lib/mutx/view/features.mote
485
- - lib/mutx/view/features/feature.mote
486
- - lib/mutx/view/features/features_list.mote
487
- - lib/mutx/view/footer.mote
528
+ - lib/mutx/view/features/file.mote
529
+ - lib/mutx/view/features/index.mote
488
530
  - lib/mutx/view/git_information.mote
489
- - lib/mutx/view/help.mote
490
- - lib/mutx/view/help/main.mote
491
- - lib/mutx/view/help/page.mote
492
- - lib/mutx/view/help/search_result.mote
493
- - lib/mutx/view/javascript.mote
531
+ - lib/mutx/view/help/_main.mote
532
+ - lib/mutx/view/help/_page.mote
533
+ - lib/mutx/view/help/_search_result.mote
534
+ - lib/mutx/view/help/index.mote
494
535
  - lib/mutx/view/last_notified.mote
495
- - lib/mutx/view/list_repos.mote
496
- - lib/mutx/view/logs/log.mote
497
- - lib/mutx/view/logs/logs.mote
498
- - lib/mutx/view/message.mote
499
- - lib/mutx/view/modals.mote
500
- - lib/mutx/view/navigation_bar.mote
536
+ - lib/mutx/view/layout/flash.mote
537
+ - lib/mutx/view/layout/footer.mote
538
+ - lib/mutx/view/layout/javascript.mote
539
+ - lib/mutx/view/layout/modals.mote
540
+ - lib/mutx/view/layout/navigation_bar.mote
541
+ - lib/mutx/view/layout/styles.mote
542
+ - lib/mutx/view/logs/index.mote
543
+ - lib/mutx/view/logs/show.mote
501
544
  - lib/mutx/view/not_found.mote
502
545
  - lib/mutx/view/parser.rb
503
- - lib/mutx/view/repos.mote
504
- - lib/mutx/view/results/all.mote
546
+ - lib/mutx/view/repositories/_repository.mote
547
+ - lib/mutx/view/repositories/index.mote
548
+ - lib/mutx/view/repositories/show.mote
549
+ - lib/mutx/view/results/_result.mote
505
550
  - lib/mutx/view/results/console.mote
506
- - lib/mutx/view/results/detailed_info.mote
551
+ - lib/mutx/view/results/index.mote
507
552
  - lib/mutx/view/results/report.mote
508
- - lib/mutx/view/results/result.mote
509
- - lib/mutx/view/results/results.mote
510
553
  - lib/mutx/view/screenshot.mote
511
554
  - lib/mutx/view/sections.rb
512
- - lib/mutx/view/styles.mote
555
+ - lib/mutx/view/task_results/_result.mote
556
+ - lib/mutx/view/task_results/_result_item.mote
557
+ - lib/mutx/view/task_results/index.mote
513
558
  - lib/mutx/view/tasks/.DS_Store
514
- - lib/mutx/view/tasks/admin/.DS_Store
515
- - lib/mutx/view/tasks/admin/create_edit_form.mote
516
- - lib/mutx/view/tasks/admin/delete.mote
517
- - lib/mutx/view/tasks/admin/delete_form.mote
518
- - lib/mutx/view/tasks/admin/edit.mote
519
- - lib/mutx/view/tasks/admin/list.mote
520
- - lib/mutx/view/tasks/admin/new.mote
521
- - lib/mutx/view/tasks/admin/view.mote
522
- - lib/mutx/view/tasks/message.mote
523
- - lib/mutx/view/tasks/task.mote
524
- - lib/mutx/view/tasks/task_item.mote
525
- - lib/mutx/view/tasks/tasks.mote
559
+ - lib/mutx/view/tasks/_task.mote
560
+ - lib/mutx/view/tasks/index.mote
561
+ - lib/mutx/view/tasks/show.mote
562
+ - lib/mutx/view/tests/_test.mote
563
+ - lib/mutx/view/tests/index.mote
564
+ - lib/mutx/view/tests/show.mote
526
565
  - lib/mutx/view/view.rb
527
566
  - mutx.gemspec
528
567
  homepage: https://github.com/romanrod/mutx
@@ -545,7 +584,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
545
584
  version: '0'
546
585
  requirements: []
547
586
  rubyforge_project:
548
- rubygems_version: 2.5.2
587
+ rubygems_version: 2.4.8
549
588
  signing_key:
550
589
  specification_version: 4
551
590
  summary: Mutx lets you expose executions easily