mutx 0.1.69 → 0.2.0

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.
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,50 @@
1
+ # encoding: utf-8
2
+ module Mutx
3
+ module Routes
4
+ module Api
5
+ module Results
6
+ class Routes < App
7
+ define do
8
+ on get do
9
+
10
+ on ":id/data" do |result_id|
11
+ query_string = Mutx::Support::QueryString.new req
12
+ output = Mutx::API::Result.data(result_id, query_string.raw)
13
+ res.write output.to_json
14
+ end
15
+
16
+ on ":id/status" do |result_id|
17
+ output = Mutx::API::Result.status(result_id)
18
+ res.write output.to_json
19
+ end
20
+
21
+ on ":id/output" do |result_id|
22
+ output = Mutx::API::Result.output(result_id)
23
+ res.write output.to_json
24
+ end
25
+
26
+ on "last_notified/:quantity" do |quantity|
27
+ output = Mutx::API::Result.last_notified quantity
28
+ res.write output
29
+ end
30
+
31
+ on ":id/reset" do |result_id|
32
+ result = Mutx::API::Execution.reset(result_id)
33
+ res.write result.to_json
34
+ end
35
+
36
+ on ":id" do |result_id|
37
+ res.write(Mutx::API::Result.info(result_id).to_json)
38
+ end
39
+
40
+ on root do
41
+ output = Mutx::API::Results.show()
42
+ res.write output.to_json
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+ module Mutx
3
+ module Routes
4
+ module Api
5
+ module Tasks
6
+ class Routes < App
7
+ define do
8
+ on get do
9
+
10
+ on ":id/results" do |task_id|
11
+ result = Mutx::API::Results.for_task_id(task_id)
12
+ res.write result.to_json
13
+ end
14
+
15
+ on ":task/run" do |task_name|
16
+ task_name.gsub!("%20"," ")
17
+ query_string = Mutx::Support::QueryString.new req
18
+ result = Mutx::API::Execution.start task_name, query_string.values
19
+ res.write result.to_json
20
+ end
21
+
22
+ on ":id/status" do |task_id|
23
+ output = Mutx::API::Task.status(task_id)
24
+ res.write output.to_json
25
+ end
26
+
27
+ on "running" do
28
+ output = Mutx::API::Tasks.list({running:true, type:"task"})
29
+ res.write output.to_json
30
+ end
31
+
32
+ on ":id" do |task_id|
33
+ output = Mutx::API::Task.info(task_id)
34
+ res.write output.to_json
35
+ end
36
+
37
+ on root do
38
+ output = Mutx::API::Tasks.list({type:"task"})
39
+ res.write output.to_json
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+ module Mutx
3
+ module Routes
4
+ module Api
5
+ module Tests
6
+ class Routes < App
7
+ define do
8
+ on get do
9
+
10
+ on ":task/run" do |task_name|
11
+ task_name.gsub!("%20"," ")
12
+ query_string = Mutx::Support::QueryString.new req
13
+ result = Mutx::API::Execution.start task_name, query_string.values
14
+ res.write result.to_json
15
+ end
16
+
17
+ on ":id/status" do |task_id|
18
+ output = Mutx::API::Task.status(task_id)
19
+ res.write output.to_json
20
+ end
21
+
22
+ on "running" do
23
+ output = Mutx::API::Tasks.list({running:true, type:"task"})
24
+ res.write output.to_json
25
+ end
26
+
27
+ on ":id" do |task_id|
28
+ output = Mutx::API::Task.info(task_id)
29
+ res.write output.to_json
30
+ end
31
+
32
+ on root do
33
+ output = Mutx::API::Tasks.list({type:"test"})
34
+ res.write output.to_json
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ module Mutx
4
+ module Routes
5
+ module Features
6
+ class Routes < App
7
+ define do
8
+
9
+ on get do
10
+
11
+ on root do
12
+ features = Mutx::Cucumber::Features.feature_files_names
13
+ res.write view('Features', features: features)
14
+ end
15
+
16
+ on 'file' do
17
+ res.write view('Feature', feature_path: query_string.values['path'])
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ module Mutx
4
+ module Routes
5
+ module Help
6
+ class Routes < App
7
+ define do
8
+
9
+ on get do
10
+
11
+ on ":page" do |page|
12
+ res.write view('Help', page: page)
13
+ end
14
+
15
+ on root do
16
+ res.redirect path_for(:help_page, page: 'main')
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ module Mutx
4
+ module Routes
5
+ module Logs
6
+ class Routes < App
7
+ define do
8
+
9
+ on get do
10
+ on root do
11
+ res.write view('Logs')
12
+ end
13
+
14
+ on ":log_name" do |log_name|
15
+ res.write view('Log', log_name: log_name)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ module Mutx
4
+ module Routes
5
+ module Message
6
+ class Routes < App
7
+ define do
8
+
9
+ on get do
10
+ on "task/:result_id" do |result_id|
11
+ res.write view('body', 'Task Message', query_string: query_string,
12
+ result_id: result_id)
13
+ end
14
+
15
+ on "test/:result_id" do |result_id|
16
+ res.write view('body', 'Test Message', query_string: query_string,
17
+ result_id: result_id)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ module Mutx
3
+ module Routes
4
+ module Repositories
5
+ class Routes < App
6
+ define do
7
+
8
+ on get do
9
+
10
+ on root do
11
+ repositories = Mutx::API::Repo.all.to_a
12
+ res.write view('Repositories', repositories: repositories)
13
+ end
14
+
15
+ # INVERTIR /log con /:result_id
16
+ on ":repository_id" do |repository_id|
17
+ repository = Mutx::API::Repo.get_data(repository_id)
18
+ res.write view('Repository', repository: repository)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+ module Mutx
3
+ module Routes
4
+ module Results
5
+ class Routes < App
6
+ define do
7
+
8
+ on get do
9
+
10
+ on root do
11
+ results = Mutx::API::Results.show()["results"]
12
+ res.write view('Results', results: results)
13
+ end
14
+
15
+ # INVERTIR /log con /:result_id
16
+ on ":result_id/log" do |result_id|
17
+ result = Mutx::Results::Result.get(result_id)
18
+ res.write view('Result Console', result: result)
19
+ end
20
+
21
+ # INVERTIR /log con /:result_id
22
+ on ":result_id/report" do |result_id|
23
+ result = Mutx::Results::Result.get(result_id)
24
+ res.redirect "/404/There%20is%20no%20result%20for%20id=#{result_id}" if result.nil?
25
+ result.mark_as_saw! if (result.finished? or result.stopped?)
26
+ if result.finished? and !result.stopped? and result.html_report.size > 0
27
+ res.write view('Result Report', result: result)
28
+ #else
29
+ # res.redirect "results/#{result_id}/log"
30
+ end
31
+ end
32
+
33
+ on ':result_id/reset' do |result_id|
34
+ result = Mutx::Results::Result.get result_id
35
+ task = Mutx::Tasks::Task.get_task_with result.task["name"]
36
+ if task.blocked_stop.eql? "on"
37
+ with_authentication do
38
+ value = Mutx::API::Execution.reset(result_id)
39
+ flash[:info] = value['message']
40
+ res.redirect path_for(:results_log, result_id: result_id)
41
+ end
42
+ else
43
+ value = Mutx::API::Execution.reset(result_id)
44
+ flash[:info] = value['message']
45
+ res.redirect path_for(:task_results_index, query_string: { task_name: result.task['name']})
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ module Mutx
3
+ module Routes
4
+ module TaskResults
5
+ class Routes < App
6
+ define do
7
+
8
+ on get do
9
+
10
+ on root do
11
+ tasks = Mutx::API::Tasks.list({})["tasks"]
12
+ task_name = query_string.values['task_name']
13
+ if task_name
14
+ tasks.select!{ |task|
15
+ task['name'] == task_name
16
+ }
17
+ end
18
+ res.write view('Task Results', tasks: tasks)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+
3
+ module Mutx
4
+ module Routes
5
+ module Tasks
6
+ class Routes < App
7
+ define do
8
+
9
+ on get do
10
+ on root do
11
+ list = Mutx::API::Tasks.list(type: 'task')['tasks'].sort_by!{ |task| task['name'].downcase }
12
+ tasks = []
13
+ list.each do |task|
14
+ res = Mutx::Database::MongoConnector.running_results_for_task_id(task['_id'])
15
+ tasks << task if res.empty?
16
+ tasks.unshift(task) if !res.empty?
17
+ end
18
+ res.write view('Tasks', tasks: tasks)
19
+ end
20
+
21
+ on ":task_name/status" do |task_name|
22
+ task = Mutx::Tasks::Task.get_task_with(task_name)
23
+ if task.blocked.eql? "on"
24
+ with_authentication do
25
+ status = task.switch!
26
+ flash[:success] = "The status of the Task change to #{status}"
27
+ res.redirect path_for(:tasks_index)
28
+ end
29
+ else
30
+ task.switch!
31
+ flash[:success] = "The status of the Task change to #{status}"
32
+ res.redirect path_for(:tasks_index)
33
+ end
34
+ end
35
+
36
+ on ':task_name/run' do |task_name|
37
+ result = Mutx::API::Execution.start(task_name, query_string.values)
38
+ Mutx::Support::Log.debug "result => #{result}"
39
+ if result["execution_id"]
40
+ flash[:success] = result['started_message']
41
+ else
42
+ flash[:error] = result['message']
43
+ end
44
+ res.redirect path_for(:tasks_show, task_name: task_name)
45
+ end
46
+
47
+ on ':task_name' do |task_name|
48
+ task = Mutx::Tasks::Task.get_task_with(task_name)
49
+ raise Mutx::Error::TaskNotFound.new("Could not find task with name #{task_name}") unless Mutx::Tasks.is_there_task_with? task_name
50
+ task_data = Mutx::API::Task.info_for_name(task_name)
51
+ Mutx::Support::Log.debug "task_name => #{task_name}"
52
+ if task.blocked.eql? "on"
53
+ with_authentication do
54
+ res.write view('Task', task: task_data['task'])
55
+ end
56
+ else
57
+ res.write view('Task', task: task_data['task'])
58
+ end
59
+ end
60
+
61
+
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,66 @@
1
+ # encoding: utf-8
2
+
3
+ module Mutx
4
+ module Routes
5
+ module Tests
6
+ class Routes < App
7
+ define do
8
+
9
+ on get do
10
+ on root do
11
+ list = Mutx::API::Tasks.list(type: 'test')['tasks'].sort_by!{ |test| test['name'].downcase }
12
+ tests = []
13
+ list.each do |test|
14
+ res = Mutx::Database::MongoConnector.running_results_for_task_id(test['_id'])
15
+ tests << test if res.empty?
16
+ tests.unshift(test) if !res.empty?
17
+ end
18
+ res.write view('Tests', tests: tests)
19
+ end
20
+
21
+ on ':test_name/run' do |test_name|
22
+ result = Mutx::API::Execution.start(test_name, query_string.values)
23
+ Mutx::Support::Log.debug "result => #{result}"
24
+ if result["execution_id"]
25
+ flash[:success] = result['started_message']
26
+ else
27
+ flash[:error] = result['message']
28
+ end
29
+ res.redirect path_for(:tests_show, test_name: test_name)
30
+ end
31
+
32
+ on ":test_name/status" do |test_name|
33
+ test = Mutx::Tasks::Task.get_task_with(test_name)
34
+ if test.blocked.eql? "on"
35
+ with_authentication do
36
+ status = test.switch!
37
+ flash[:success] = "The status of the Task change to #{status}"
38
+ res.redirect path_for(:tasks_index)
39
+ end
40
+ else
41
+ task.switch!
42
+ flash[:success] = "The status of the Task change to #{status}"
43
+ res.redirect path_for(:tasks_index)
44
+ end
45
+ end
46
+
47
+ on ":test_name" do |test_name|
48
+ test = Mutx::Tasks::Task.get_task_with test_name
49
+ raise Mutx::Error::TaskNotFound.new("Could not find test with name #{test_name}") unless Mutx::Tasks.is_there_task_with? test_name
50
+ test_data = Mutx::API::Task.info_for_name(test_name)
51
+ if test.blocked.eql? "on"
52
+ with_authentication do
53
+ Mutx::Support::Log.debug "test_name => #{test_name}"
54
+ res.write view("Test", test: test_data['task'])
55
+ end
56
+ else
57
+ res.write view('Test', test: test_data['task'])
58
+ end
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end