henry-container 0.0.28 → 0.0.35
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/lib/henry/container/version.rb +1 -1
- data/lib/henry/container.rb +7 -3
- data/lib/henry/environment.rb +16 -0
- data/lib/henry/execution.rb +26 -0
- data/lib/henry/input.rb +49 -0
- data/lib/henry/task/cucumber_task.rb +24 -31
- data/lib/henry/task/rspec_task.rb +24 -35
- data/lib/henry/task.rb +32 -4
- data/lib/henry.rb +2 -0
- metadata +5 -24
- data/.yardoc/checksums +0 -6
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/doc/Henry/Container.html +0 -325
- data/doc/Henry/Task/CucumberTask.html +0 -299
- data/doc/Henry/Task/RspecTask.html +0 -299
- data/doc/Henry/Task.html +0 -551
- data/doc/Henry.html +0 -128
- data/doc/_index.html +0 -153
- data/doc/class_list.html +0 -53
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -328
- data/doc/file_list.html +0 -52
- data/doc/frames.html +0 -28
- data/doc/index.html +0 -153
- data/doc/js/app.js +0 -214
- data/doc/js/full_list.js +0 -173
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -124
- data/doc/top-level-namespace.html +0 -112
data/.gitignore
CHANGED
data/lib/henry/container.rb
CHANGED
@@ -11,7 +11,9 @@ module Henry
|
|
11
11
|
# Henry Container
|
12
12
|
class Container
|
13
13
|
|
14
|
-
#
|
14
|
+
# Initialize the Container with the given options
|
15
|
+
#
|
16
|
+
# @param [Hash] the execution given options.
|
15
17
|
def initialize(opts)
|
16
18
|
@opts = opts
|
17
19
|
end
|
@@ -20,8 +22,10 @@ module Henry
|
|
20
22
|
def execute
|
21
23
|
self.before_execution
|
22
24
|
|
23
|
-
self.tasks.each do |task|
|
24
|
-
|
25
|
+
self.tasks.select {|task| task.enabled?}.each do |task|
|
26
|
+
task.configure(self.task_params(task.name))
|
27
|
+
task.execute
|
28
|
+
self.tasks_results << task.report
|
25
29
|
end
|
26
30
|
|
27
31
|
self.update_results
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'henry/input'
|
2
|
+
|
3
|
+
module Henry
|
4
|
+
|
5
|
+
# Henry Environmet.
|
6
|
+
# To be used as proxy to access the Task execution params from the tests
|
7
|
+
class Environment
|
8
|
+
|
9
|
+
# Imports and returs the Task execution parameters.
|
10
|
+
#
|
11
|
+
# @return [Hash] the Task execution parameters
|
12
|
+
def self.params
|
13
|
+
@@params ||= Input.import!.params
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Henry
|
2
|
+
|
3
|
+
# Henry Execution
|
4
|
+
class Execution
|
5
|
+
|
6
|
+
# Accessors for task_name, code, message, output and backtrace.
|
7
|
+
attr_accessor :task_name, :code, :message, :output, :backtrace
|
8
|
+
|
9
|
+
# Returns the json ready hash report of the Task Execution
|
10
|
+
#
|
11
|
+
# @return [Hash]
|
12
|
+
def report
|
13
|
+
{
|
14
|
+
name: self.task_name,
|
15
|
+
code: self.code,
|
16
|
+
message: self.message,
|
17
|
+
returnedData: {
|
18
|
+
output: self.output,
|
19
|
+
backtrace: self.backtrace
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/henry/input.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
module Henry
|
2
|
+
|
3
|
+
# Henry Input
|
4
|
+
class Input
|
5
|
+
attr_reader :params
|
6
|
+
|
7
|
+
# ENV key where the Input will be exported to/imported from.
|
8
|
+
EXPORT_KEY = 'HENRY_INPUT'
|
9
|
+
|
10
|
+
# Initialize the Input with the given params or empty.
|
11
|
+
#
|
12
|
+
# @param params [Hash] the Input params.
|
13
|
+
def initialize(params={})
|
14
|
+
@params = params
|
15
|
+
end
|
16
|
+
|
17
|
+
# Initialize and export the Input to the target ENV namespace.
|
18
|
+
#
|
19
|
+
# @param params [Hash] the Input params to be exported.
|
20
|
+
# @return [Input]
|
21
|
+
def self.export!(params)
|
22
|
+
self.new(params).export!
|
23
|
+
end
|
24
|
+
|
25
|
+
# Exports the Input to the target ENV namespace.
|
26
|
+
#
|
27
|
+
# @return [Input]
|
28
|
+
def export!
|
29
|
+
ENV[EXPORT_KEY] = JSON.dump(@params)
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initialize and import the Input from the target ENV namespece.
|
34
|
+
#
|
35
|
+
# @return [Input]
|
36
|
+
def self.import!
|
37
|
+
self.new.import!
|
38
|
+
end
|
39
|
+
|
40
|
+
# Imports the Input from the target ENV namespace.
|
41
|
+
#
|
42
|
+
# @return [Input]
|
43
|
+
def import!
|
44
|
+
@params = JSON.parse(ENV[EXPORT_KEY])
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -7,46 +7,39 @@ module Henry
|
|
7
7
|
|
8
8
|
# The Henry Task implementation for Cucumber
|
9
9
|
class CucumberTask < Task
|
10
|
-
|
11
|
-
# Makes available the cucumber rake task.
|
12
|
-
Cucumber::Rake::Task.new do |t|
|
13
|
-
t.cucumber_opts = %w{--out cucumber.out}
|
14
|
-
t.fork = false
|
15
|
-
end
|
16
10
|
|
17
11
|
# Executes the CucumberTask and returns its results.
|
18
12
|
#
|
19
13
|
# @return [Hash] the CucumberTask results.
|
20
|
-
def execute
|
14
|
+
def execute
|
21
15
|
begin
|
22
|
-
File.open('cucumber.out', 'w') { |f| }
|
23
|
-
|
24
|
-
#tail_pid = Process.spawn('tail -f cucumber.out')
|
25
|
-
|
26
16
|
Rake.application['cucumber'].invoke
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
name: self.name,
|
32
|
-
code: 'OK',
|
33
|
-
message: 'OK',
|
34
|
-
returnedData: {
|
35
|
-
output: File.open('cucumber.out', 'r').read
|
36
|
-
}
|
37
|
-
}
|
17
|
+
|
18
|
+
self.execution.code = 'OK'
|
19
|
+
self.execution.message = 'OK'
|
20
|
+
self.execution.output = File.open('cucumber.out', 'r').read
|
38
21
|
rescue Exception => e
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
returnedData: {
|
44
|
-
output: File.open('cucumber.out', 'r').read,
|
45
|
-
backtrace: e.message
|
46
|
-
}
|
47
|
-
}
|
22
|
+
self.execution.code = 'ERROR'
|
23
|
+
self.execution.message = 'ERROR'
|
24
|
+
self.execution.output = File.open('cucumber.out', 'r').read
|
25
|
+
self.execution.backtrace = e.message
|
48
26
|
end
|
49
27
|
end
|
28
|
+
|
29
|
+
# Configures the Task.
|
30
|
+
#
|
31
|
+
# @param [Hash] params the task params.
|
32
|
+
def configure(params)
|
33
|
+
File.open('cucumber.out', 'w') { |f| }
|
34
|
+
|
35
|
+
# Makes available the cucumber rake task.
|
36
|
+
Cucumber::Rake::Task.new do |t|
|
37
|
+
t.cucumber_opts = %w{--out cucumber.out}
|
38
|
+
t.fork = false
|
39
|
+
end
|
40
|
+
|
41
|
+
self.export_params(params)
|
42
|
+
end
|
50
43
|
|
51
44
|
end
|
52
45
|
|
@@ -8,48 +8,37 @@ module Henry
|
|
8
8
|
# The Henry Task implementation for Rspec
|
9
9
|
class RspecTask < Task
|
10
10
|
|
11
|
-
# Executes the
|
12
|
-
|
13
|
-
# @return [Hash] the CucumberTask results.
|
14
|
-
def execute(params)
|
11
|
+
# Executes the Task and returns its results.
|
12
|
+
def execute
|
15
13
|
begin
|
16
|
-
File.open('rspec.out', 'w') { |f| }
|
17
|
-
|
18
|
-
# tail_pid = Process.spawn('tail -f rspec.out')
|
19
|
-
|
20
|
-
# Makes available the spec rake task.
|
21
|
-
RSpec::Core::RakeTask.new do |t|
|
22
|
-
t.pattern = self.data.options['pattern'] || '*'
|
23
|
-
t.rspec_opts = '--out rspec.out'
|
24
|
-
end
|
25
|
-
|
26
|
-
ENV['HENRY_INPUT'] = JSON.dump(params)
|
27
|
-
|
28
14
|
Rake.application['spec'].invoke
|
29
15
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
name: self.name,
|
34
|
-
code: 'OK',
|
35
|
-
message: 'OK',
|
36
|
-
returnedData: {
|
37
|
-
output: File.open('rspec.out', 'r').read
|
38
|
-
}
|
39
|
-
}
|
16
|
+
self.execution.code = 'OK'
|
17
|
+
self.execution.message = 'OK'
|
18
|
+
self.execution.output = File.open('rspec.out', 'r').read
|
40
19
|
rescue Exception => e
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
returnedData: {
|
46
|
-
output: File.open('rspec.out', 'r').read,
|
47
|
-
backtrace: e.message
|
48
|
-
}
|
49
|
-
}
|
20
|
+
self.execution.code = 'ERROR'
|
21
|
+
self.execution.message = 'ERROR'
|
22
|
+
self.execution.output = File.open('rspec.out', 'r').read
|
23
|
+
self.execution.backtrace = e.message
|
50
24
|
end
|
51
25
|
end
|
52
26
|
|
27
|
+
# Configures the Task.
|
28
|
+
#
|
29
|
+
# @param [Hash] params the task params.
|
30
|
+
def configure(params)
|
31
|
+
File.open('rspec.out', 'w') { |f| }
|
32
|
+
|
33
|
+
# Makes available the spec rake task.
|
34
|
+
RSpec::Core::RakeTask.new do |t|
|
35
|
+
t.pattern = (self.data.options && self.data.options['pattern']) || 'spec/*'
|
36
|
+
t.rspec_opts = '--out rspec.out'
|
37
|
+
end
|
38
|
+
|
39
|
+
self.export_params(params)
|
40
|
+
end
|
41
|
+
|
53
42
|
end
|
54
43
|
|
55
44
|
end
|
data/lib/henry/task.rb
CHANGED
@@ -6,11 +6,11 @@ module Henry
|
|
6
6
|
# Henry Task
|
7
7
|
class Task
|
8
8
|
|
9
|
-
# Accessors for name and
|
9
|
+
# Accessors for name, data and enabled
|
10
10
|
attr_accessor :name, :data, :enabled
|
11
11
|
|
12
12
|
# Returns an instance of the target Task class.
|
13
|
-
# @note Factory to create
|
13
|
+
# @note Factory to create X Task instances.
|
14
14
|
#
|
15
15
|
# @return [Task]
|
16
16
|
def self.create(name, data)
|
@@ -22,6 +22,28 @@ module Henry
|
|
22
22
|
self.name = name
|
23
23
|
self.data = OpenStruct.new(data)
|
24
24
|
self.enabled = true
|
25
|
+
self.execution.task_name = self.name
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns the json ready hash report of the task execution.
|
29
|
+
#
|
30
|
+
# @return [Hash]
|
31
|
+
def report
|
32
|
+
self.execution.report
|
33
|
+
end
|
34
|
+
|
35
|
+
# Exports the Task params to the ENV.
|
36
|
+
#
|
37
|
+
# @param [Hash] params the Task params to be exported.
|
38
|
+
def export_params(params)
|
39
|
+
Input.export!(params)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns the Task Execution.
|
43
|
+
#
|
44
|
+
# @return [Execution]
|
45
|
+
def execution
|
46
|
+
@execution ||= Execution.new
|
25
47
|
end
|
26
48
|
|
27
49
|
# Returns true whenever the Task is enabled.
|
@@ -48,8 +70,14 @@ module Henry
|
|
48
70
|
self.enabled = false
|
49
71
|
end
|
50
72
|
|
51
|
-
#
|
52
|
-
def execute
|
73
|
+
# The execution code should be defined under this method on the specific Task class.
|
74
|
+
def execute
|
75
|
+
abort "Your task class ('#{self.class}' may be?) MUST define this method with its execution logic."
|
76
|
+
end
|
77
|
+
|
78
|
+
# Nothing to be done here...
|
79
|
+
# The Task configuration code should be defined under this method on the specific Task class.
|
80
|
+
def configure(params)
|
53
81
|
end
|
54
82
|
|
55
83
|
end
|
data/lib/henry.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: henry-container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.35
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -117,31 +117,9 @@ extra_rdoc_files: []
|
|
117
117
|
files:
|
118
118
|
- .gitignore
|
119
119
|
- .rvmrc
|
120
|
-
- .yardoc/checksums
|
121
|
-
- .yardoc/object_types
|
122
|
-
- .yardoc/objects/root.dat
|
123
|
-
- .yardoc/proxy_types
|
124
120
|
- Gemfile
|
125
121
|
- Rakefile
|
126
122
|
- bin/henry-ruby-container
|
127
|
-
- doc/Henry.html
|
128
|
-
- doc/Henry/Container.html
|
129
|
-
- doc/Henry/Task.html
|
130
|
-
- doc/Henry/Task/CucumberTask.html
|
131
|
-
- doc/Henry/Task/RspecTask.html
|
132
|
-
- doc/_index.html
|
133
|
-
- doc/class_list.html
|
134
|
-
- doc/css/common.css
|
135
|
-
- doc/css/full_list.css
|
136
|
-
- doc/css/style.css
|
137
|
-
- doc/file_list.html
|
138
|
-
- doc/frames.html
|
139
|
-
- doc/index.html
|
140
|
-
- doc/js/app.js
|
141
|
-
- doc/js/full_list.js
|
142
|
-
- doc/js/jquery.js
|
143
|
-
- doc/method_list.html
|
144
|
-
- doc/top-level-namespace.html
|
145
123
|
- henry-container.gemspec
|
146
124
|
- henry-context.yml.sample
|
147
125
|
- in.henry.sample
|
@@ -156,6 +134,9 @@ files:
|
|
156
134
|
- lib/henry/.yardoc/proxy_types
|
157
135
|
- lib/henry/container.rb
|
158
136
|
- lib/henry/container/version.rb
|
137
|
+
- lib/henry/environment.rb
|
138
|
+
- lib/henry/execution.rb
|
139
|
+
- lib/henry/input.rb
|
159
140
|
- lib/henry/task.rb
|
160
141
|
- lib/henry/task/cucumber_task.rb
|
161
142
|
- lib/henry/task/rspec_task.rb
|
data/.yardoc/checksums
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
lib/henry.rb a099cbeab3003a8afbd3295a05937c64fa0af1ce
|
2
|
-
lib/henry/task.rb 1c480c5547ca6f7574755d437104036431f03c72
|
3
|
-
lib/henry/container.rb 60b90d0fdfafdbe35424ab386633414092594fa3
|
4
|
-
lib/henry/task/rspec_task.rb 84b6a26d0b5582416ac69207d055089656144a39
|
5
|
-
lib/henry/container/version.rb c6756bb3a6c79d109d282f032f4e4e1466470d86
|
6
|
-
lib/henry/task/cucumber_task.rb bd09e4b6c60fd358151a41cf3803d5e56f74bdec
|
data/.yardoc/object_types
DELETED
Binary file
|
data/.yardoc/objects/root.dat
DELETED
Binary file
|
data/.yardoc/proxy_types
DELETED
Binary file
|