henry-container 0.1.75 → 0.1.76
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/henry/container/version.rb +1 -1
- data/lib/henry/container.rb +1 -0
- data/lib/henry/environment.rb +16 -2
- data/lib/henry/execution_service.rb +36 -0
- data/lib/henry/task/cucumber_task.rb +7 -7
- data/lib/henry/task/rake_task.rb +2 -2
- data/lib/henry/task/rspec_task.rb +7 -7
- data/lib/henry/task.rb +2 -0
- metadata +3 -3
- data/tt.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 485d02fc0e6b00e2c0709864531d62d8200e939b
|
4
|
+
data.tar.gz: b742c2a83e50cf7664ef30775ec2810c9d4f6ee3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4756483e0a82b74f95e85e295756efbf71d11f90ec749c21f98281e1e8804ad7a5769180850eee8e0c909521c4ed7c5ee545c3179e1ef5d9c01a63883177d0d
|
7
|
+
data.tar.gz: 1d39f13585bbc8d6d2f7cd559cb762949817994c3be7cc806a31d20ea9ea7c552816f5f1b85601ef6090e9347e09e9b2de14c266e9f157ffafca2dd56d2f1ec2
|
data/lib/henry/container.rb
CHANGED
data/lib/henry/environment.rb
CHANGED
@@ -3,6 +3,8 @@ require 'fileutils'
|
|
3
3
|
require 'json'
|
4
4
|
require 'colorize'
|
5
5
|
|
6
|
+
require 'henry/config'
|
7
|
+
require 'henry/execution'
|
6
8
|
require 'henry/input'
|
7
9
|
require 'henry/logger'
|
8
10
|
require 'henry/logger_service'
|
@@ -29,9 +31,9 @@ module Henry
|
|
29
31
|
@@params ||= Input.import!.params
|
30
32
|
end
|
31
33
|
|
32
|
-
# Gets the Task Logger instance
|
34
|
+
# Gets the Task Logger instance via DBr.
|
33
35
|
#
|
34
|
-
# @return [Logger] the Task Logger
|
36
|
+
# @return [Logger] the Task Logger.
|
35
37
|
def self.logger
|
36
38
|
if ENV['DRB_LOGGER_URI']
|
37
39
|
return @@logger ||= DRbObject.new_with_uri(ENV['DRB_LOGGER_URI'])
|
@@ -39,6 +41,18 @@ module Henry
|
|
39
41
|
|
40
42
|
return @@logger ||= Logger.new
|
41
43
|
end
|
44
|
+
|
45
|
+
# Gets the Task Execution instance via DBr.
|
46
|
+
#
|
47
|
+
# @return [Execution] the Task Execution instance.
|
48
|
+
def self.execution
|
49
|
+
return @@execution ||= DRbObject.new_with_uri(ENV['DRB_EXECUTION_URI'])
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.warning!(message = nil)
|
53
|
+
self.execution.code = 'WARNING'
|
54
|
+
self.execution.message = message || 'WARNING'
|
55
|
+
end
|
42
56
|
|
43
57
|
# Copies the file from the given path to the default export directory
|
44
58
|
#
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Henry
|
2
|
+
|
3
|
+
class ExecutionService
|
4
|
+
|
5
|
+
# Uri where the service will be listening.
|
6
|
+
DRB_URI = 'druby://localhost'
|
7
|
+
|
8
|
+
# Range of ports to be used.
|
9
|
+
DRB_PORTS = (8800..9000)
|
10
|
+
|
11
|
+
# Starts the result service sharing the given result.
|
12
|
+
#
|
13
|
+
# @param [Execution] execution the Execution to be shared.
|
14
|
+
def self.start(execution)
|
15
|
+
10.times do
|
16
|
+
begin
|
17
|
+
drb_uri = "#{DRB_URI}:#{rand(DRB_PORTS)}"
|
18
|
+
DRb.start_service(drb_uri, execution)
|
19
|
+
ENV['DRB_EXECUTION_URI'] = drb_uri
|
20
|
+
rescue Errno::EADDRINUSE
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
|
27
|
+
# Stops the result service.
|
28
|
+
def self.stop
|
29
|
+
DRb.stop_service
|
30
|
+
rescue
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -79,7 +79,7 @@ module Henry
|
|
79
79
|
# @param [Hash] extended_options set of extended options.
|
80
80
|
# @return [String]
|
81
81
|
def custom_options(extended_options={})
|
82
|
-
"#{self.format_options} #{self.tags_options(extended_options)} #{self.report_options} #{self.rerun_options} #{self.misc_options}"
|
82
|
+
"#{self.format_options} #{self.tags_options(extended_options)} #{self.report_options(extended_options)} #{self.rerun_options} #{self.misc_options}"
|
83
83
|
end
|
84
84
|
|
85
85
|
# Returns the miscellaneous cucumber_opts.
|
@@ -123,7 +123,7 @@ module Henry
|
|
123
123
|
# Returns the cucumber_opts related with report paaths and formats.
|
124
124
|
#
|
125
125
|
# @return [String]
|
126
|
-
def report_options
|
126
|
+
def report_options(extended_options={})
|
127
127
|
self.generated_reports = []
|
128
128
|
self.report_recipients = []
|
129
129
|
|
@@ -132,7 +132,7 @@ module Henry
|
|
132
132
|
self.data.reports.collect do |report_options|
|
133
133
|
report_options['name'] ||= "${DATE}_${TASK_NAME}.#{report_options['format']}"
|
134
134
|
|
135
|
-
self.generated_reports << self.report_file_path(report_options['format'], report_options['name'])
|
135
|
+
self.generated_reports << self.report_file_path(report_options['format'], report_options['name'], extended_options)
|
136
136
|
self.report_recipients += (report_options['recipients'] || [])
|
137
137
|
|
138
138
|
FileUtils.mkdir_p(self.reports_dir(report_options['format']))
|
@@ -166,16 +166,16 @@ module Henry
|
|
166
166
|
# @param [String] format the rspec formatter name.
|
167
167
|
# @param [String] file_name the report file name template.
|
168
168
|
# @return [String] the report file path.
|
169
|
-
def report_file_path(format, file_name)
|
170
|
-
"#{self.reports_dir(format)}/#{self.report_file_name(file_name)}"
|
169
|
+
def report_file_path(format, file_name, extended_options={})
|
170
|
+
"#{self.reports_dir(format)}/#{self.report_file_name(file_name,extended_options)}"
|
171
171
|
end
|
172
172
|
|
173
173
|
# Interpolates and returns the report file name.
|
174
174
|
#
|
175
175
|
# @param [String] file_name the report file name.
|
176
176
|
# @returns [String] the report file name.
|
177
|
-
def report_file_name(file_name)
|
178
|
-
file_name.gsub(/\${[A-Z_]+}/, '${TASK_NAME}' => self.name, '${DATE}' => DateTime.now.strftime(TIME_FORMAT)).gsub(' ', '_')
|
177
|
+
def report_file_name(file_name,extended_options={})
|
178
|
+
file_name.gsub(/\${[A-Z_]+}/, '${TASK_NAME}' => self.name, '${DATE}' => DateTime.now.strftime(TIME_FORMAT), '${TAGS}' => ((self.data.options['tags']||[])+(extended_options['tags']||[])).join(' ')).gsub(' ', '_')
|
179
179
|
end
|
180
180
|
|
181
181
|
# Interpolates and returns the reports directory for the given format.
|
data/lib/henry/task/rake_task.rb
CHANGED
@@ -23,8 +23,8 @@ module Henry
|
|
23
23
|
begin
|
24
24
|
Rake.application[self.application_name].invoke
|
25
25
|
|
26
|
-
self.execution.code
|
27
|
-
self.execution.message
|
26
|
+
self.execution.code ||= 'OK'
|
27
|
+
self.execution.message ||= 'OK'
|
28
28
|
self.execution.output = File.open(self.out_path, 'r').read
|
29
29
|
self.execution.log = self.logger.log_as_hash
|
30
30
|
|
@@ -75,7 +75,7 @@ module Henry
|
|
75
75
|
#
|
76
76
|
# @return [String]
|
77
77
|
def custom_options(extended_options={})
|
78
|
-
"#{self.format_options} #{self.tags_options(extended_options)} #{self.report_options}"
|
78
|
+
"#{self.format_options} #{self.tags_options(extended_options)} #{self.report_options(extended_options)}"
|
79
79
|
end
|
80
80
|
|
81
81
|
# Returns the default rspec_opts.
|
@@ -107,7 +107,7 @@ module Henry
|
|
107
107
|
# Returns the rspec_opts related with report paaths and formats.
|
108
108
|
#
|
109
109
|
# @return [String]
|
110
|
-
def report_options
|
110
|
+
def report_options(extended_options={})
|
111
111
|
self.generated_reports = []
|
112
112
|
self.report_recipients = []
|
113
113
|
|
@@ -116,7 +116,7 @@ module Henry
|
|
116
116
|
self.data.reports.collect do |report_options|
|
117
117
|
report_options['name'] ||= "${DATE}_${TASK_NAME}.#{report_options['format']}"
|
118
118
|
|
119
|
-
self.generated_reports << self.report_file_path(report_options['format'], report_options['name'])
|
119
|
+
self.generated_reports << self.report_file_path(report_options['format'], report_options['name'], extended_options)
|
120
120
|
self.report_recipients += (report_options['recipients'] || [])
|
121
121
|
|
122
122
|
FileUtils.mkdir_p(self.reports_dir(report_options['format']))
|
@@ -130,16 +130,16 @@ module Henry
|
|
130
130
|
# @param [String] format the rspec formatter name.
|
131
131
|
# @param [String] file_name the report file name template.
|
132
132
|
# @return [String] the report file path.
|
133
|
-
def report_file_path(format, file_name)
|
134
|
-
"#{self.reports_dir(format)}/#{self.report_file_name(file_name)}"
|
133
|
+
def report_file_path(format, file_name, extended_options={})
|
134
|
+
"#{self.reports_dir(format)}/#{self.report_file_name(file_name,extended_options)}"
|
135
135
|
end
|
136
136
|
|
137
137
|
# Interpolates and returns the report file name.
|
138
138
|
#
|
139
139
|
# @param [String] file_name the report file name.
|
140
140
|
# @returns [String] the report file name.
|
141
|
-
def report_file_name(file_name)
|
142
|
-
file_name.gsub(/\${[A-Z_]+}/, '${TASK_NAME}' => self.name, '${DATE}' => DateTime.now.strftime(TIME_FORMAT)).gsub(' ', '_')
|
141
|
+
def report_file_name(file_name,extended_options={})
|
142
|
+
file_name.gsub(/\${[A-Z_]+}/, '${TASK_NAME}' => self.name, '${DATE}' => DateTime.now.strftime(TIME_FORMAT), '${TAGS}' => ((self.data.options['tags']||[])+(extended_options['tags']||[])).join(' ')).gsub(' ', '_')
|
143
143
|
end
|
144
144
|
|
145
145
|
# Interpolates and returns the reports directory for the given format.
|
data/lib/henry/task.rb
CHANGED
@@ -30,11 +30,13 @@ module Henry
|
|
30
30
|
# Code to be run just before the execution
|
31
31
|
def before_execute
|
32
32
|
LoggerService.start(self.logger)
|
33
|
+
ExecutionService.start(self.execution)
|
33
34
|
end
|
34
35
|
|
35
36
|
# Code to be run justafter the execution
|
36
37
|
def after_execute
|
37
38
|
LoggerService.stop
|
39
|
+
ExecutionService.stop
|
38
40
|
end
|
39
41
|
|
40
42
|
# Returns the json ready hash report of the task execution.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: henry-container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.76
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Decurnex
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/henry/email_client.rb
|
162
162
|
- lib/henry/environment.rb
|
163
163
|
- lib/henry/execution.rb
|
164
|
+
- lib/henry/execution_service.rb
|
164
165
|
- lib/henry/input.rb
|
165
166
|
- lib/henry/logger.rb
|
166
167
|
- lib/henry/logger_service.rb
|
@@ -174,7 +175,6 @@ files:
|
|
174
175
|
- spec/support/files/email.file
|
175
176
|
- spec/support/spec_helper.rb
|
176
177
|
- templates/errors/json_parse_error.json
|
177
|
-
- tt.rb
|
178
178
|
homepage: http://henry.despegar.it
|
179
179
|
licenses: []
|
180
180
|
metadata: {}
|