kaya 0.0.11 → 0.0.12
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/kaya/background_jobs/workers/execution_performer.rb +59 -0
- data/lib/kaya/cucumber/task.rb +2 -41
- data/lib/kaya/execution.rb +1 -15
- data/lib/kaya/support/git.rb +0 -1
- data/lib/kaya/support/logs.rb +0 -5
- data/lib/kaya/support/notification.rb +0 -10
- data/lib/kaya/version.rb +1 -1
- data/lib/kaya/view/results/console.mote +5 -2
- data/lib/kaya.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d29907ccd295eb6282d151db7296cd801742ea59
|
4
|
+
data.tar.gz: 2620c3ea5a35f56a1c3715ea2fc453ff4d965755
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d3dca0cff9cf94737eb7267ce398e188010fea1fc799c558cc744538db7ddbb7ef7131cdd73b3e2e7f0097216f7af3cbac8220d23d5aaf7e79ca530097018cb
|
7
|
+
data.tar.gz: 09e4a1b26dd6022c8c79596a83b1edb212fe47874c378346fbdd6566e3ea3bd51c3ad3e85fb35fab05ace92a6e5d709e38c7985791b4bace4d422c1395a7507a
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'kaya'
|
2
|
+
|
3
|
+
module Kaya
|
4
|
+
module Workers
|
5
|
+
class ExecutionPerformer
|
6
|
+
include Sidekiq::Worker
|
7
|
+
def perform(result_id)
|
8
|
+
|
9
|
+
puts result_id
|
10
|
+
|
11
|
+
Kaya::Support::Configuration.get
|
12
|
+
Kaya::Database::MongoConnector.new Kaya::Support::Configuration.db_connection_data
|
13
|
+
|
14
|
+
result = Kaya::Results::Result.get(result_id)
|
15
|
+
|
16
|
+
p result
|
17
|
+
|
18
|
+
result.kaya_report_file_name= "kaya_report_#{result_id}.html"
|
19
|
+
|
20
|
+
begin
|
21
|
+
File.delete("#{Dir.pwd}/Gemfile.lock")
|
22
|
+
rescue
|
23
|
+
end
|
24
|
+
|
25
|
+
if !Kaya::Support::ChangeInspector.is_there_gemfile_lock?
|
26
|
+
bundle_output = Kaya::Support::Console.execute "bundle install"
|
27
|
+
$K_LOG.debug "[result:#{result.id}] Bundle install performed" if $K_LOG
|
28
|
+
elsif Kaya::Support::ChangeInspector.is_there_a_change?
|
29
|
+
bundle_output = Kaya::Support::Console.execute "bundle update"
|
30
|
+
$K_LOG.debug "[result:#{result.id}] Bundle update performed" if $K_LOG
|
31
|
+
end
|
32
|
+
if bundle_output
|
33
|
+
result.save_to_bundle_output bundle_output
|
34
|
+
raise "An error ocurred installing gem" if bundle_output.include? "Could not find"
|
35
|
+
end
|
36
|
+
|
37
|
+
# Adding _id=result.id to use inside execution the posiibility to add information to the result
|
38
|
+
result.kaya_command= "#{Kaya::Support::Configuration.headless?} cucumber #{result.command} -f pretty -f html -o kaya/temp/#{result.kaya_report_file_name} #{result.custom_params_values} _id=#{result.id} "
|
39
|
+
|
40
|
+
result.console_output_file_name= "kaya_co_#{result.id}.out"
|
41
|
+
|
42
|
+
result.save!
|
43
|
+
|
44
|
+
command = "#{result.kaya_command} 2>&1 | tee -a kaya/temp/#{result.console_output_file_name}"
|
45
|
+
|
46
|
+
$K_LOG.debug "[result:#{result.id}] Running in headless mode" if $K_LOG and Kaya::Support::Configuration.headless?
|
47
|
+
|
48
|
+
Dir.mkdir "#{Dir.pwd}/kaya/temp" unless Dir.exist? "#{Dir.pwd}/kaya/temp"
|
49
|
+
|
50
|
+
$K_LOG.debug "[result:#{result.id}] Creating process" if $K_LOG
|
51
|
+
result.pid= Kaya::Support::Processes.fork_this command
|
52
|
+
result.running!
|
53
|
+
result.save!
|
54
|
+
$K_LOG.debug "[result:#{result.id}] Process => #{result.pid}(PID) | command => saved | result as => running" if $K_LOG
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/kaya/cucumber/task.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'yaml'
|
1
|
+
# require 'yaml'
|
2
2
|
|
3
3
|
require 'tempfile'
|
4
4
|
|
@@ -9,47 +9,8 @@ module Kaya
|
|
9
9
|
|
10
10
|
def self.run result
|
11
11
|
|
12
|
-
|
12
|
+
Kaya::Workers::ExecutionPerformer.perform_async(result.id)
|
13
13
|
|
14
|
-
begin
|
15
|
-
File.delete("#{Dir.pwd}/Gemfile.lock")
|
16
|
-
rescue
|
17
|
-
end
|
18
|
-
|
19
|
-
if Kaya::Support::ChangeInspector.is_there_a_change? or not Kaya::Support::ChangeInspector.is_there_gemfile_lock?
|
20
|
-
bundle_output = Kaya::Support::Console.execute "bundle install"
|
21
|
-
$K_LOG.debug "[result:#{result.id}] Bundle install performed" if $K_LOG
|
22
|
-
result.save_to_bundle_output bundle_output
|
23
|
-
raise "An error ocurred installing gem" if bundle_output.include? "Could not find"
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
# Adding _id=result.id to use inside execution the posiibility to add information to the result
|
29
|
-
result.kaya_command= "#{Kaya::Support::Configuration.headless?} cucumber #{result.command} -f pretty -f html -o kaya/temp/#{result.kaya_report_file_name} #{result.custom_params_values} _id=#{result.id} "
|
30
|
-
|
31
|
-
result.console_output_file_name= "kaya_co_#{result.id}.out"
|
32
|
-
|
33
|
-
result.save!
|
34
|
-
|
35
|
-
command = "#{result.kaya_command} 2>&1 | tee -a kaya/temp/#{result.console_output_file_name}"
|
36
|
-
|
37
|
-
$K_LOG.debug "[result:#{result.id}] Running in headless mode" if $K_LOG and Kaya::Support::Configuration.headless?
|
38
|
-
|
39
|
-
Dir.mkdir "#{Dir.pwd}/kaya/temp" unless Dir.exist? "#{Dir.pwd}/kaya/temp"
|
40
|
-
|
41
|
-
$K_LOG.debug "[result:#{result.id}] Creating process" if $K_LOG
|
42
|
-
result.pid= Kaya::Support::Processes.fork_this command
|
43
|
-
result.running!
|
44
|
-
result.save!
|
45
|
-
$K_LOG.debug "[result:#{result.id}] Process => #{result.pid}(PID) | command => saved | result as => running" if $K_LOG
|
46
|
-
|
47
|
-
# Following actions are performed by background job
|
48
|
-
|
49
|
-
# result.append_result_to_console_output!
|
50
|
-
# result.save_report!
|
51
|
-
# result.save!
|
52
|
-
# result.append_result_to_console_output!
|
53
14
|
end # end self.run
|
54
15
|
|
55
16
|
end #end Task class
|
data/lib/kaya/execution.rb
CHANGED
@@ -16,6 +16,7 @@ module Kaya
|
|
16
16
|
$K_LOG.debug "Result created with id => #{result.id}" if $K_LOG
|
17
17
|
|
18
18
|
result_id = result.id
|
19
|
+
result.save!
|
19
20
|
|
20
21
|
if execution_request_data["type"] == "cucumber"
|
21
22
|
$K_LOG.debug "Execution type: Cucumber" if $K_LOG
|
@@ -23,21 +24,6 @@ module Kaya
|
|
23
24
|
|
24
25
|
$K_LOG.debug "Task started" if $K_LOG
|
25
26
|
|
26
|
-
|
27
|
-
# Performed by background job
|
28
|
-
# if result = Results::Result.get(result_id)
|
29
|
-
|
30
|
-
# result.append_result_to_console_output!
|
31
|
-
|
32
|
-
# result.save_report!
|
33
|
-
|
34
|
-
# result.get_summary!
|
35
|
-
|
36
|
-
# result.get_status!
|
37
|
-
|
38
|
-
# result = nil
|
39
|
-
# end
|
40
|
-
|
41
27
|
result_id
|
42
28
|
|
43
29
|
else # ANOTHER TYPE OF EXECUTION
|
data/lib/kaya/support/git.rb
CHANGED
data/lib/kaya/support/logs.rb
CHANGED
@@ -21,11 +21,6 @@ module Kaya
|
|
21
21
|
if File.exist?("#{path}")
|
22
22
|
FileUtils.cp(path, "#{path}~")
|
23
23
|
all_content = IO.read("#{path}~")
|
24
|
-
# content = if all_content.split("\n").size > 1000
|
25
|
-
# all_content.split("\n")[-1000..-1].join("<br>")
|
26
|
-
# else
|
27
|
-
# all_content.gsub("\n","<br>")
|
28
|
-
# end
|
29
24
|
content = all_content.gsub("\n","<br>")
|
30
25
|
File.delete("#{path}~")
|
31
26
|
else
|
@@ -92,23 +92,13 @@ module Kaya
|
|
92
92
|
send_email message_subject, body, path_to_file
|
93
93
|
end
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
95
|
def execution_stopped result, additional_text=nil
|
100
96
|
body = "Execution stopped \n#{additional_text}"
|
101
97
|
message_subject = "Execution stopped (#{result.id})"
|
102
98
|
send_email message_subject, body
|
103
99
|
end
|
104
|
-
|
105
100
|
end
|
106
101
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
102
|
class NoEmail
|
113
103
|
|
114
104
|
def initialize
|
data/lib/kaya/version.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
|
2
|
-
<?
|
2
|
+
<?
|
3
|
+
text = ""
|
4
|
+
text += result.bundle_output.split("\n").join("</p><p>") if result.bundle_output
|
5
|
+
text += result.console_output.split("\n").join("</p><p>") if result.console_output
|
3
6
|
if text.empty?
|
4
7
|
lines = []
|
5
8
|
begin
|
@@ -7,7 +10,7 @@ if text.empty?
|
|
7
10
|
lines << line
|
8
11
|
end
|
9
12
|
rescue
|
10
|
-
lines << "
|
13
|
+
lines << "Wait..."
|
11
14
|
end
|
12
15
|
text = lines.join("</small></p><p><small>")
|
13
16
|
end
|
data/lib/kaya.rb
CHANGED
@@ -89,6 +89,7 @@ require_relative "kaya/support/change_inspector"
|
|
89
89
|
|
90
90
|
# Background jobs
|
91
91
|
require_relative "kaya/background_jobs/workers/execution_checker"
|
92
|
+
require_relative "kaya/background_jobs/workers/execution_performer"
|
92
93
|
require_relative "kaya/background_jobs/workers/garbage_cleaner"
|
93
94
|
require_relative "kaya/background_jobs/sidekiq"
|
94
95
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaya
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -277,6 +277,7 @@ files:
|
|
277
277
|
- lib/kaya/API/suites.rb
|
278
278
|
- lib/kaya/background_jobs/sidekiq.rb
|
279
279
|
- lib/kaya/background_jobs/workers/execution_checker.rb
|
280
|
+
- lib/kaya/background_jobs/workers/execution_performer.rb
|
280
281
|
- lib/kaya/background_jobs/workers/garbage_cleaner.rb
|
281
282
|
- lib/kaya/commands/bye.rb
|
282
283
|
- lib/kaya/commands/help.rb
|