kaya 0.0.1

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 (112) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +26 -0
  3. data/CHANGELOG +52 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/NOTAS +19 -0
  7. data/README.md +279 -0
  8. data/Rakefile +1 -0
  9. data/bin/kaya +4 -0
  10. data/documentation/api.md +47 -0
  11. data/documentation/api_execution_data.md +47 -0
  12. data/documentation/configuration.md +13 -0
  13. data/documentation/custom_parameters.md +117 -0
  14. data/documentation/document_kaya.md +122 -0
  15. data/documentation/link.md +12 -0
  16. data/documentation/results.md +119 -0
  17. data/documentation/start.md +19 -0
  18. data/documentation/suites.md +60 -0
  19. data/documentation/test_suite_information.md +9 -0
  20. data/kaya.gemspec +42 -0
  21. data/lib/generators/task_rack.rb +160 -0
  22. data/lib/generators/templates/Gemfile.tt +2 -0
  23. data/lib/generators/templates/config.ru.tt +2 -0
  24. data/lib/generators/templates/kaya_conf.tt +49 -0
  25. data/lib/generators/templates/kaya_log.tt +0 -0
  26. data/lib/generators/templates/sidekiq_log.tt +0 -0
  27. data/lib/generators/templates/tasks.kaya.tt +10 -0
  28. data/lib/generators/templates/unicorn.rb.tt +21 -0
  29. data/lib/kaya/API/error.rb +17 -0
  30. data/lib/kaya/API/execution.rb +141 -0
  31. data/lib/kaya/API/result.rb +49 -0
  32. data/lib/kaya/API/results.rb +31 -0
  33. data/lib/kaya/API/suite.rb +42 -0
  34. data/lib/kaya/API/suites.rb +36 -0
  35. data/lib/kaya/background_jobs/sidekiq.rb +35 -0
  36. data/lib/kaya/background_jobs/workers/execution_checker.rb +20 -0
  37. data/lib/kaya/background_jobs/workers/garbage_cleaner.rb +31 -0
  38. data/lib/kaya/commands/bye.rb +12 -0
  39. data/lib/kaya/commands/help.rb +13 -0
  40. data/lib/kaya/commands/install.rb +27 -0
  41. data/lib/kaya/commands/reset.rb +39 -0
  42. data/lib/kaya/commands/reset_suites.rb +40 -0
  43. data/lib/kaya/commands/restart.rb +9 -0
  44. data/lib/kaya/commands/start.rb +104 -0
  45. data/lib/kaya/commands/stop.rb +53 -0
  46. data/lib/kaya/cuba.rb +287 -0
  47. data/lib/kaya/cucumber/features.rb +15 -0
  48. data/lib/kaya/cucumber/task.rb +64 -0
  49. data/lib/kaya/custom/execution_data.rb +50 -0
  50. data/lib/kaya/custom/params.rb +34 -0
  51. data/lib/kaya/database/mongo_connector.rb +285 -0
  52. data/lib/kaya/error/errors.rb +55 -0
  53. data/lib/kaya/execution.rb +57 -0
  54. data/lib/kaya/results/result.rb +493 -0
  55. data/lib/kaya/results/results.rb +47 -0
  56. data/lib/kaya/suites/custom/params.rb +151 -0
  57. data/lib/kaya/suites/suite.rb +177 -0
  58. data/lib/kaya/suites/suites.rb +130 -0
  59. data/lib/kaya/support/clean.rb +12 -0
  60. data/lib/kaya/support/configuration.rb +254 -0
  61. data/lib/kaya/support/console.rb +11 -0
  62. data/lib/kaya/support/documentation.rb +34 -0
  63. data/lib/kaya/support/error_handler_helper.rb +24 -0
  64. data/lib/kaya/support/files_cleanner.rb +136 -0
  65. data/lib/kaya/support/git.rb +161 -0
  66. data/lib/kaya/support/if_config.rb +14 -0
  67. data/lib/kaya/support/logo.rb +23 -0
  68. data/lib/kaya/support/logs.rb +37 -0
  69. data/lib/kaya/support/notification.rb +127 -0
  70. data/lib/kaya/support/processes.rb +96 -0
  71. data/lib/kaya/support/query_string.rb +22 -0
  72. data/lib/kaya/support/request.rb +32 -0
  73. data/lib/kaya/support/risk.rb +9 -0
  74. data/lib/kaya/support/time_helper.rb +11 -0
  75. data/lib/kaya/support/update.rb +65 -0
  76. data/lib/kaya/version.rb +3 -0
  77. data/lib/kaya/view/body.mote +60 -0
  78. data/lib/kaya/view/custom/params/select_list.mote +14 -0
  79. data/lib/kaya/view/custom/params/text.mote +9 -0
  80. data/lib/kaya/view/custom/params.mote +9 -0
  81. data/lib/kaya/view/error_handler.mote +40 -0
  82. data/lib/kaya/view/features/feature.mote +14 -0
  83. data/lib/kaya/view/features/features_list.mote +10 -0
  84. data/lib/kaya/view/features.mote +57 -0
  85. data/lib/kaya/view/footer.mote +10 -0
  86. data/lib/kaya/view/git_information.mote +21 -0
  87. data/lib/kaya/view/help/main.mote +21 -0
  88. data/lib/kaya/view/help/page.mote +2 -0
  89. data/lib/kaya/view/help/search_result.mote +29 -0
  90. data/lib/kaya/view/help.mote +72 -0
  91. data/lib/kaya/view/javascript.mote +96 -0
  92. data/lib/kaya/view/logs/log.mote +3 -0
  93. data/lib/kaya/view/modals.mote +31 -0
  94. data/lib/kaya/view/navigation_bar.mote +48 -0
  95. data/lib/kaya/view/not_found.mote +40 -0
  96. data/lib/kaya/view/parser.rb +79 -0
  97. data/lib/kaya/view/results/all.mote +59 -0
  98. data/lib/kaya/view/results/console.mote +106 -0
  99. data/lib/kaya/view/results/detailed_info.mote +112 -0
  100. data/lib/kaya/view/results/report.mote +1 -0
  101. data/lib/kaya/view/results/result.mote +23 -0
  102. data/lib/kaya/view/results/results.mote +52 -0
  103. data/lib/kaya/view/screenshot.mote +42 -0
  104. data/lib/kaya/view/sections.rb +25 -0
  105. data/lib/kaya/view/styles.mote +58 -0
  106. data/lib/kaya/view/suites/suite.mote +73 -0
  107. data/lib/kaya/view/suites/suites.mote +9 -0
  108. data/lib/kaya/view/view.rb +72 -0
  109. data/lib/kaya.rb +175 -0
  110. data/test/features/install.feature +18 -0
  111. data/test/features/support/env.rb +3 -0
  112. metadata +395 -0
@@ -0,0 +1,122 @@
1
+ How to make documentation for Kaya?
2
+ ==============
3
+
4
+ Kaya documentation is loaded to your local mongodb during the command `prepare` from all .md files located inside /kaya/documentation/
5
+ and /kaya/ folders.
6
+ Then it's made available in [/kaya/help/main](/kaya/help/main "Help") where you can see all documents and perform searches through them.
7
+
8
+ Where do i put the documents?
9
+ ---------------------
10
+
11
+ You can push them to the kaya git project inside /kaya/documentation/ folder, /kaya/ folder it's also functional but it's discouraged.
12
+
13
+ What type of file do i use?
14
+ ---------------------
15
+
16
+ You can only use Markdown (.md) files.
17
+
18
+ How do i name it?
19
+ ---------------------
20
+
21
+ The name should describe the content of the document, beware that this name its going to be the title of the document in the [/kaya/help/main](/kaya/help/main "Help") page so take that into consideration.
22
+ Also all the name should be all in undercase, and words should be separated by "_" wich are replaced by spaces afterwards.
23
+
24
+ An example of this:
25
+
26
+ Name of the file:
27
+
28
+ this_is_an_example.md
29
+
30
+ The the title will be like this:
31
+
32
+ This is an example
33
+
34
+ How do i format de content of the file?
35
+ ---------------------
36
+
37
+ All files in kaya project shuld be formated like this
38
+
39
+ Main title
40
+ ==============
41
+
42
+ Body of the file
43
+
44
+ - Main title: it describes the content of the file, it is also the description dispayed here [/kaya/help/main](/kaya/help/main "Help")
45
+
46
+ - Body of the file: here you can place all the content you want, see ´How do i format de body?´ for more info.
47
+
48
+
49
+ How do i format de body?
50
+ ---------------------
51
+
52
+ You can use most of Markdown rules.
53
+ Also you can use some basic HTML, but it's strongly discouraged.
54
+
55
+ Here are some examples:
56
+
57
+ Main title
58
+ ==============
59
+
60
+ Secondary titles
61
+ ---------------------
62
+
63
+ Normal text.
64
+
65
+ > This is a quote.
66
+
67
+ *This is italicized*
68
+
69
+ **This is bold**
70
+
71
+ ***This is italicized and bold***
72
+
73
+ `this is higlighted`
74
+
75
+ - this
76
+ - is a
77
+ - list
78
+
79
+ This is a link: [Despegar](http://www.despegar.com/)
80
+
81
+ You can make relative links too: [/kaya/help/main](/kaya/help/main "Help")
82
+
83
+ This is a block.
84
+
85
+ This is a ruler:
86
+
87
+ ---------------------------------------
88
+
89
+
90
+ They are displayed as follows:
91
+
92
+ Main title
93
+ ==============
94
+
95
+ Secondary titles
96
+ ---------------------
97
+
98
+ Normal text.
99
+
100
+ > This is a quote.
101
+
102
+ *This is italicized*
103
+
104
+ **This is bold**
105
+
106
+ ***This is italicized and bold***
107
+
108
+ `this is higlighted`
109
+
110
+ - this
111
+ - is a
112
+ - list
113
+
114
+ This is a link: [Despegar](http://www.despegar.com/)
115
+
116
+ You can make relative links too: [/kaya/help/main](/kaya/help/main "Help")
117
+
118
+ This is a block
119
+
120
+ This is a ruler:
121
+
122
+ ----------------------------------------
@@ -0,0 +1,12 @@
1
+ Share a link to execute a test suite
2
+ ==============
3
+
4
+ Pressing this button:
5
+
6
+ <form>
7
+ <button type="button" class="btn btn-default" aria-label="Left Align" ><span class="glyphicon glyphicon-star" aria-hidden="true">Link</span></button>
8
+ </form>
9
+
10
+ you will see a message with the url that starts the test suite execution with the configured custom params and execution name
11
+ This could be helpful when a story is in development process and your test is ready to be executed, so you can create a test suite related to the history,
12
+ set custom params, execution name and then share the link to de developer which is responsible about the history implementation
@@ -0,0 +1,119 @@
1
+ Results and details about them.
2
+ ==============
3
+
4
+ Each Test Suite execution creates a result. You can see them in Results section.
5
+ You will see each Test Suite box with its results. If a Test Suite has more than three results, you'll see a green button that says `All results` for this test suite to see all results for that test suite
6
+ A result line looks like:
7
+
8
+ <div class="panel panel-primary">
9
+ <div class="panel-heading" data-toggle="collapse" data-target="#at_world">
10
+ <h3 class="panel-title">
11
+ Regression Tests
12
+ <div class="pull-right">28 Results</div>
13
+ </h3>
14
+ <div></div>
15
+ </div>
16
+ <div class="panel-body collapse in" id="at_world">
17
+ <div title="Command: -t @multi "></div>
18
+ <div title="Command: -t @multi "></div>
19
+ <div title="Command: -t @multi "></div>
20
+ <table class="table">
21
+ <thead>
22
+ <tr>
23
+ <th style="font-weight: bold;">When</th>
24
+ <th style="font-weight: bold;">Label</th>
25
+ <th style="font-weight: bold;">Duration (sec)</th>
26
+ <th style="font-weight: bold; text-align: center;">Unviewed</th>
27
+ <th style="font-weight: bold;">Console</th>
28
+ <th style="font-weight: bold;">Status</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <tr class="small">
33
+ <th>01/04/2015 12:16:10</th>
34
+ <th>01APR15-1216</th>
35
+ <th> 5 m 2 s</th>
36
+ <th style="text-align: center;">
37
+ No
38
+ </th>
39
+ <th>
40
+ <a class="label label-default">
41
+ Console Log
42
+ </a>
43
+ </th>
44
+ <th>
45
+ <a href="#" class="label label-danger">Stopped (inactivity timeout reached)</a>
46
+ </th>
47
+ </tr>
48
+ <tr class="small">
49
+ <th>19/03/2015 16:00:30</th>
50
+ <th>19MAR15-1600</th>
51
+ <th>11 s</th>
52
+ <th style="text-align: center;">
53
+ No
54
+ </th>
55
+ <th>
56
+ <a class="label label-default">
57
+ Console Log
58
+ </a>
59
+ </th>
60
+ <th>
61
+ <a href="#" class="label label-success">1 scenario (1 passed) - 1 step (1 passed)</a>
62
+ </th>
63
+ </tr>
64
+ <tr class="small">
65
+ <th>19/03/2015 15:17:16</th>
66
+ <th>19MAR15-1517</th>
67
+ <th> 4 m 21 s</th>
68
+ <th style="text-align: center;">
69
+ No
70
+ </th>
71
+ <th>
72
+ <a class="label label-default">
73
+ Console Log
74
+ </a>
75
+ </th>
76
+ <th>
77
+ <a href="#" class="label label-success">1 scenario (1 passed) - 1 step (1 passed)</a>
78
+ </th>
79
+ </tr>
80
+ </tbody>
81
+ </table>
82
+ <div class="text-center">
83
+ <a class="btn btn-info">
84
+ Go to suite
85
+ </a>
86
+ <a href="/kaya/results/suite/multi" class="btn btn-default">
87
+ &nbsp;&nbsp;All results for this suite&nbsp;
88
+ <span class="label label-info label-as-badge">
89
+ 3
90
+ </span>
91
+ </a>
92
+ </div>
93
+ </div>
94
+ </div>
95
+
96
+ ---------------------------------------
97
+
98
+
99
+ You can click on this button to see the console output of the execution
100
+
101
+ <a class="btn btn-info">Console Log</a>
102
+
103
+ ---------------------------------------
104
+
105
+ When the execution is still running this label will be shown
106
+
107
+ <span class="label label-success">Running</span>
108
+
109
+ ---------------------------------------
110
+
111
+ You can click on summary description like this to see the cucumber report.
112
+
113
+ <span class="label label-success">4 scenarios (4 passed) - 20 steps (20 passed)</span>
114
+
115
+ ---------------------------------------
116
+
117
+ When an execution is stopped you'll see this in All Results section you'll see all execution results for all test suites. You can find a specific result by typing a keyword or selecting a status and pressing Search
118
+
119
+ <span class="label label-danger">Suite execution stopped!</span>
@@ -0,0 +1,19 @@
1
+ What is Kaya?
2
+ ==============
3
+ *Basically it's about runnnig tests easily.*
4
+
5
+ With Kaya, you don't have to install or configure nothing.
6
+ Just enter on your favourite web browser the url where Kaya is running for your test automation project,
7
+ go to Suites and start the execution you need to run.
8
+
9
+ How to run tests?
10
+ ==============
11
+
12
+ You can run tests in Test Suites section. You'll find test suites listed. Each test suite involves many test (or not).
13
+ If you want to know more about a test suite you can mouse over the information icon which could have info about it
14
+ Each test suite saves its execution results in a database so you do not have to care about report because Kaya do that for you and store all reports as a history.
15
+ You also can provide some parameters to the execution. This values are called Custom Parameters and you can set them up as your execution needs.
16
+
17
+ Only test?
18
+ ==============
19
+ Well, why not use this to run any code?
@@ -0,0 +1,60 @@
1
+ How to use Test Suites in Kaya?
2
+ ==============
3
+
4
+ You can find test suites on Test Suites section.
5
+ Kaya will retrieve all profiles masked as runnable defined on cucumber.yml
6
+ Each Test Suite can be executed by pressing Run button. The execution result could be identified after the execution by adding a label before pressing Run button
7
+ For example, an identifier could be a release product version like r2.3.44. So you will be able to identify quickly the execution result later
8
+ You can provide some parameters to the execution by using [Custom Parameters](/kaya/help/custom_parameters "Custom Parameters")
9
+
10
+ A Test Suite looks like:
11
+ ---------------------
12
+
13
+ <div class="panel panel-primary">
14
+ <div class="panel-heading" data-toggle="collapse" data-target="#multi">
15
+ <h4 class="panel-title">multi</h4>
16
+ </div>
17
+ <div class="panel-body collapse in" id="multi">
18
+ <ul class="list-group">
19
+ <li class="list-group-item">Command: -t @multi</li>
20
+ <li class="list-group-item">Last result:&nbsp;<a href="#" class="label label-danger" >Stopped (inactivity timeout reached)</a></li>
21
+ <li class="list-group-item">Started on:&nbsp;24/05/47218 02:27:33</li>
22
+ <li class="list-group-item">
23
+ <form name="run" id="multi" method="get" action="#">
24
+ <h4 title="This parameters will be passed to the test suite execution">&nbsp;&nbsp;&nbsp;Custom Parameters</h4>
25
+ <div class="container" style="width: inherit">
26
+ <li class="list-group-item" style="position:relative; with=100%">
27
+ <div class="form-group-sm">
28
+ <label class="col-sm-2 control-label" for="formGroupInputSmall">environment</label>
29
+ <select id="environment" name="environment" class="customParam" 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;">
30
+ <option value="RC">RC</option>
31
+ <option value="BETA">BETA</option>
32
+ <option value="PROD">PROD</option>
33
+ </select>
34
+ <input type="text" id="otro0" name="otro" value="Enter otro" onfocus="if (this.value==&quot;Enter otro&quot;) this.value=&quot;&quot;;" placeholder="" style="display: none; 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;"></div>
35
+ <div class="form-group-sm">
36
+ <label class="col-sm-2 control-label" for="formGroupInputSmall">my param A</label>
37
+ <textarea class="customParam" type="text" name="blabla" placeholder="" 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; max-width: 70%; max-height: 500px; min-height: 34px; min-width: 212px; font-weight:normal;"></textarea>
38
+ </div>
39
+ <div class="form-group-sm">
40
+ <label class="col-sm-2 control-label" for="formGroupInputSmall">my param B</label>
41
+ <textarea class="customParam" type="text" name="etc" placeholder="" 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; max-width: 70%; max-height: 500px; min-height: 34px; min-width: 212px; font-weight:normal;"></textarea>
42
+ </div>
43
+ <div class="form-group-sm">
44
+ <label class="col-sm-2 control-label" for="formGroupInputSmall">my Param C</label>
45
+ <textarea class="customParam" type="text" name="country" placeholder="" 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; max-width: 70%; max-height: 500px; min-height: 34px; min-width: 212px; font-weight:normal;"></textarea>
46
+ </div>
47
+ </li>
48
+ </div>
49
+ <br><br>
50
+ <input type="submit" class="btn btn-success" value="Execute Suite">&nbsp;
51
+ <input type="text" name="execution_name" class="customParam" title="This value could be used to identify the result execution from other execution of this suite. E.g: You could use the release your are going to test" placeholder="Identify your execution" value="01APR15-1356" 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;">
52
+ <button type="button" class="btn btn-default" aria-label="Left Align" data-toggle="modal" data-target="#myModal" onclick="javascript:starter_link(&quot;multi&quot;);">
53
+ <span class="glyphicon glyphicon-star" aria-hidden="true">Link</span>
54
+ </button>
55
+ </form>
56
+ </li>
57
+ </ul>
58
+ <a href="#" class="btn btn-default pull-center">All results(28)</a>
59
+ </div>
60
+ </div>
@@ -0,0 +1,9 @@
1
+ How to provide information about a test suite?
2
+ ==============
3
+
4
+ You can provide some information about a test suite by adding info value to each suite you need
5
+
6
+ #cucumber.yml
7
+ regression: -t @regression info=[This is to execute a regression tests suite]
8
+
9
+ This value `info=[Explaining text]` will show the icon <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> where you can mouse over and read the text
data/kaya.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kaya/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "kaya"
8
+ spec.version = Kaya::VERSION
9
+ spec.authors = ["Roman Rodriguez"]
10
+ spec.email = ["roman.g.rodriguez@gmail.com"]
11
+ spec.summary = %q{Exposes Cucumber suites in a web service to make them run}
12
+ spec.description = %q{You can run your cucumber suites easily, save and see the execution results}
13
+ spec.homepage = "http://qqq.akjsdh"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.0.0"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'thor'
23
+ spec.add_dependency 'cuba'
24
+ spec.add_dependency 'unicorn'
25
+ spec.add_dependency 'mongodb'
26
+ spec.add_dependency 'redis'
27
+ spec.add_dependency 'sidekiq'
28
+ spec.add_dependency 'bson_ext'
29
+ spec.add_dependency 'syntax'
30
+ spec.add_dependency 'colorize'
31
+ spec.add_dependency 'github-markup'
32
+ spec.add_dependency 'redcarpet'
33
+ spec.add_dependency 'byebug'
34
+ spec.add_dependency 'gmail'
35
+ spec.add_dependency 'mote'
36
+
37
+
38
+
39
+ spec.add_development_dependency "bundler", "~> 1.5"
40
+ spec.add_development_dependency "rake"
41
+ spec.add_development_dependency "cucumber"
42
+ end
@@ -0,0 +1,160 @@
1
+ class TaskRack < Thor::Group
2
+
3
+ include Thor::Actions
4
+
5
+ desc "Generates files needed by Kaya"
6
+
7
+ # ===============================
8
+ # Evaluates prerequisites
9
+ #
10
+ #
11
+
12
+ def check_for_mongo_existance
13
+ begin
14
+ mongo = Kaya::Support::Console.execute "mongo --version"
15
+ mongo_version = mongo.scan(/(\d+\.\d+\.\d+)/).flatten.first
16
+ rescue
17
+ raise "
18
+ MONGODB NOT INSTALLED. INSTALL MONGODB BEFORE USING KAYA
19
+ to install MongoDB go to: http://docs.mongodb.org/manual/installation/
20
+ " if mongo_version.nil?
21
+ end
22
+ puts "MongoDB version installed => #{mongo_version} => OK"
23
+ end
24
+
25
+
26
+ def check_redis_existance
27
+ redis = Kaya::Support::Console.execute "redis-server -v"
28
+ raise "
29
+ REDIS SERVER IS NOT INSTALLED ON YOUR SYSTEM.
30
+ INSTALL REDIS SERVER BEFORE USING KAYA
31
+ to install Redis go to:
32
+ " unless redis =~ /Redis server v=\d+\.\d+\.\d+/
33
+ end
34
+
35
+
36
+ def choose_working_branch
37
+
38
+ # Gets the list of branches
39
+ branch_list=Kaya::Support::Git.branch_list
40
+
41
+ begin
42
+ system "clear"
43
+ Kaya::Support::Logo.show
44
+ puts "
45
+ You have to choose one of the following branches to tell Kaya where to work with:"
46
+ # Print the options
47
+ branch_list.each_with_index do |branch_name, index|
48
+ puts "\t(#{index + 1}) - #{branch_name}"
49
+ end
50
+ print "\n\t Your option:"; option = STDIN.gets
51
+
52
+ #Converted to Fixnum
53
+ option = option.gsub!("\n","").to_i
54
+
55
+ end until (1..branch_list.size).include? option
56
+
57
+
58
+ selected_branch_name = branch_list[option-1]
59
+ puts "
60
+ Lets work on '#{selected_branch_name}'
61
+
62
+ "
63
+
64
+
65
+ Kaya::Support::Git.checkout_to(selected_branch_name)
66
+ end
67
+
68
+ # ==============================
69
+ # Start install task
70
+ #
71
+ #
72
+ #
73
+ def self.source_root
74
+ File.dirname(__FILE__) + "/templates/"
75
+ end
76
+
77
+ def creates_kaya_folder
78
+ empty_directory "kaya"
79
+ end
80
+
81
+ def creates_kaya_temp_folder
82
+ empty_directory "kaya/temp"
83
+ end
84
+
85
+ def copy_server_file
86
+ unless File.exist? "#{Dir.pwd}/kaya/config.ru"
87
+ template "config.ru.tt", "#{Dir.pwd}/kaya/config.ru"
88
+
89
+ else
90
+
91
+ if yes?("\n It seems that you already have a config.ru file. DO YOU WANT TO REPLACE IT? (yes/no)", color = :green)
92
+ template "config.ru.tt", "#{Dir.pwd}/kaya/config.ru"
93
+ else
94
+ raise "The existing config.ru file must be replaced with config.ru file from Kaya"
95
+ end
96
+ end
97
+ end
98
+
99
+
100
+ def copy_kaya_conf
101
+ template "kaya_conf.tt", "#{Dir.pwd}/kaya/kaya_conf" unless File.exist? "#{Dir.pwd}/kaya/kaya_conf"
102
+ end
103
+
104
+ def copy_kaya_log_file
105
+ template "kaya_log.tt", "#{Dir.pwd}/kaya/kaya_log" unless File.exist? "#{Dir.pwd}/kaya/kaya_log"
106
+ end
107
+
108
+ def copy_sidekiq_log_file
109
+ template "sidekiq_log.tt", "#{Dir.pwd}/kaya/sidekiq_log" unless File.exist? "#{Dir.pwd}/kaya/sidekiq_log"
110
+ end
111
+
112
+ def copy_unicorn_config_file
113
+ unless File.exist? "#{Dir.pwd}/kaya/unicorn.rb"
114
+ template "unicorn.rb.tt", "#{Dir.pwd}/kaya/unicorn.rb"
115
+ @unicorn_created = true
116
+ end
117
+ end
118
+
119
+ def update_gitignore
120
+ path = "#{Dir.pwd}/.gitignore"
121
+ if File.exist? path
122
+ f = File.open(path, "a+")
123
+ content = ""
124
+ f.each_line{|line| content += line}
125
+ f.write "\n" unless content[-1] == "\n"
126
+ # ['*.kaya','kaya_conf','*.html','unicorn.rb', 'config.ru','Gemfile.lock', 'kaya_pids','sidekiq_pids', 'sidekiq_log'].each do |file_name|
127
+ # f.write "#{file_name}\n" unless content.include? "#{file_name}"
128
+ # end
129
+
130
+ f.write "kaya/\n" unless content.include? "kaya/"
131
+ f.write "kaya/*\n" unless content.include? "kaya/*"
132
+
133
+
134
+ f.close
135
+ end
136
+ end
137
+
138
+ def update_gemfile
139
+ path = "#{Dir.pwd}/Gemfile"
140
+ if File.exist? path
141
+ f = File.open(path, "a+")
142
+ content = ""
143
+ f.each_line{|line| content += line}
144
+ f.write "\n" unless content[-1] == "\n"
145
+ ["gem 'kaya'"].each do |file_name|
146
+ f.write "#{file_name}\n" unless content.include? "#{file_name}"
147
+ end
148
+ else
149
+ # Only cucumber projects are allowed to use Kaya (by now)
150
+ raise "There is no Gemfile. Is this a Cucumber Ruby Project?"
151
+ end
152
+
153
+ end
154
+
155
+ def push_changes
156
+ Kaya::Support::Git.git_add_commit "Kaya: Commit after install command execution"
157
+ Kaya::Support::Git.git_push_origin_to_actual_branch
158
+ end
159
+
160
+ end
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+
@@ -0,0 +1,2 @@
1
+ require 'kaya'
2
+ run Cuba
@@ -0,0 +1,49 @@
1
+ {
2
+
3
+ "USE_GIT" : true,
4
+
5
+ "HOSTNAME" : "your-host-name",
6
+
7
+ "APP_PORT" : 8080,
8
+
9
+ "DATABASE" : {
10
+
11
+ "TYPE" : "mongodb",
12
+ "HOST" :"localhost",
13
+ "PORT" : 27017,
14
+ "USERNAME" : null,
15
+ "PASSWORD" : null},
16
+
17
+ "PROJECT_NAME" : "Awesome Project",
18
+
19
+ "PROJECT_URL" : "http://your.project.url",
20
+
21
+ "INACTIVITY_TIMEOUT" : 60,
22
+
23
+ "KILL_INACTIVE_EXECUTIONS_AFTER" : 300,
24
+
25
+ "FORMAT_DATETIME" : "%d/%m/%Y %H:%M:%S",
26
+
27
+ "REFRESH_TIME" : 10,
28
+
29
+ "NOTIFICATION" : {
30
+ "USE_GMAIL" : false,
31
+ "USERNAME" : null,
32
+ "PASSWORD" : null,
33
+ "RECIPIENTS" : "your@email.com",
34
+ "ATTACH_REPORT" : false
35
+ },
36
+
37
+ "FOOTER" : "Tests by a great and funny team",
38
+
39
+ "AUTO_EXECUTION_ID" : {
40
+ "datetime" : true,
41
+ "format" : "%d%^b%y-%H%M",
42
+ "default" : null
43
+ },
44
+
45
+ "HEADLESS" : {
46
+ "active" : false,
47
+ "resolution" : "1024x768",
48
+ "size":"24"}
49
+ }
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ {
2
+ "kaya":{
3
+ "tasks":{
4
+ "task_name":{
5
+ "command":"echo 'this is the command you can perform by calling task_name on your get request'"
6
+ }
7
+ },
8
+ "update_command":""
9
+ }
10
+ }
@@ -0,0 +1,21 @@
1
+ worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
2
+
3
+ timeout 600
4
+
5
+ preload_app true
6
+
7
+ before_fork do |server, worker|
8
+ Signal.trap 'TERM' do
9
+ puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
10
+ Process.kill 'QUIT', Process.pid
11
+ end
12
+
13
+ defined?(ActiveRecord::Base) and
14
+ ActiveRecord::Base.connection.disconnect!
15
+ end
16
+
17
+ after_fork do |server, worker|
18
+ Signal.trap 'TERM' do
19
+ puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ module Kaya
2
+ module API
3
+ class Error
4
+
5
+ # @param [QueryString Object] args =
6
+ # :msg
7
+ # :request
8
+ def self.show(args)
9
+ response = {
10
+ "message" => args.msg,
11
+ "request" => args.request
12
+ }
13
+ response
14
+ end
15
+ end
16
+ end
17
+ end