henry-container 0.1.31 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjAyODgxNjM1YWFmOGZkMzdhNzk3ZjM1Mjc2MjE5ZmUzZDU3ZTdiOA==
5
- data.tar.gz: !binary |-
6
- YjYyZGE5MzY0ZGIzOTJmYmEzNjVjYWVmOWQxZTY5MGQ0YTFmZWRmMw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- OTBhNDZiZmNlNGJhZjM4OTUxNGQ0YWU2NTkzNTMxNDUxNDUzNzBjYzM0NDU1
10
- OWE0MmJhYmViOTNlYTQ4ZjAwNjJlMzU4N2Y0MmZhMjQ4ZmYyZTI3OWE1YjE0
11
- NjBmYjI3NzkzMzc2NDNlYzRiZTI1M2E4ZjBlZDU5OWYyMzE0OTM=
12
- data.tar.gz: !binary |-
13
- Y2FlMDc4ZTNkYzRmMGYzODI1NDhhYjdkMTRmYjFmZDEyZjdlZTkxMDNmMDkx
14
- MjUxYzZiODFlNTE2Y2IzODQxZmJiYzQ5NDAxYWZlMmZhZmMxZjQyNmIyZDVh
15
- Mzg2NjVmMzI5NzFkN2FmZjEwMTNlYzQzOTI0MWE0ZTFjNjkyNmE=
2
+ SHA1:
3
+ metadata.gz: 18c2df7d7145c351c81569f71c4b0a63018c57c3
4
+ data.tar.gz: b676c2f80686212e2497924c9783c7ed56527c04
5
+ SHA512:
6
+ metadata.gz: 0b431776abc04e77f1bdafc845a025b356da05b88cd9fc71e04434f0a415b39bf7da38ceb8b31f7abc8282d2763bb6fb886f35200d387c2dfd4cfdf9f50e1b67
7
+ data.tar.gz: 81c751a49b33eb3c43beda1a3808f18cf8bc1ac115c21fe23b61b3aea2afbfd51ab46dbbe7d507404598591b325596bf9c73a4064b318858f871168f391347ff
data/bin/release.sh CHANGED
@@ -5,7 +5,7 @@ if [[ $gem_version == "" ]]; then
5
5
  exit 1
6
6
  fi
7
7
 
8
- gem build henry-container.gemspec --sign
8
+ #gem build henry-container.gemspec --sign
9
9
  gem push henry-container-${gem_version}.gem
10
10
  gem inabox henry-container-${gem_version}.gem
11
11
 
@@ -1,10 +1,12 @@
1
1
  require_relative 'container/version'
2
2
 
3
- require 'yaml'
4
- require 'ostruct'
3
+
4
+ require 'colorize'
5
+ require 'fileutils'
5
6
  require 'json'
7
+ require 'ostruct'
6
8
  require 'rake'
7
- require 'colorize'
9
+ require 'yaml'
8
10
 
9
11
  module Henry
10
12
 
@@ -32,7 +34,8 @@ module Henry
32
34
  task.export_params(task_params)
33
35
  task.execution.params = task_params
34
36
  task.before_execute
35
- task.execute
37
+ self.execute_task(task)
38
+
36
39
  task.after_execute
37
40
  tasks_results_set << task.report
38
41
  end
@@ -62,6 +65,28 @@ module Henry
62
65
  tasks: []
63
66
  }
64
67
 
68
+ # Paths collection of the out.henry templates
69
+ #
70
+ # @return [Hash] the paths of the out.henry templates
71
+ TEMPLATE_PATHS = {
72
+ json_parse_error: 'templates/errors/json_parse_error.json'
73
+ }
74
+
75
+ # Executes the task inside a timeout (defined by the task itself).
76
+ # On Timeout::Error adds an erro mmessage to the Task Execution.
77
+ #
78
+ # @param [Henry::Task] task the task to be executed.
79
+ def execute_task(task)
80
+ begin
81
+ Timeout::timeout(task.timeout) do
82
+ task.execute
83
+ end
84
+ rescue Timeout::Error
85
+ task.execution.code = 'ERROR'
86
+ task.execution.message = 'The task execution exeeded the timeout.'
87
+ end
88
+ end
89
+
65
90
  # Returns the input file path based on the given options.
66
91
  #
67
92
  # @return [String] the input file path.
@@ -92,11 +117,9 @@ module Henry
92
117
 
93
118
  # Executes required validations before execution.
94
119
  def before_execution
95
-
96
120
  unless File.exists?('henry-context.yml')
97
121
  abort "'henry-context.yml' file does not exist. You need it in order to execute a Henry compatible test.".red
98
122
  end
99
-
100
123
  end
101
124
 
102
125
  # Returns the execution params.
@@ -257,6 +280,12 @@ module Henry
257
280
  # Writes into @opts[:out] the execution results.
258
281
  def dump_results
259
282
  File.open(self.output_file_path, 'w') { |f| f.write(results.to_json) }
283
+
284
+ begin
285
+ JSON.parse(File.read(self.output_file_path))
286
+ rescue JSON::ParserError
287
+ FileUtils.copy(TEMPLATE_PATHS[:json_parse_error], self.output_file_path)
288
+ end
260
289
  end
261
290
 
262
291
  end
@@ -3,7 +3,7 @@ module Henry
3
3
  class Container
4
4
 
5
5
  # Current Gem version
6
- VERSION = '0.1.31'
6
+ VERSION = '0.1.33'
7
7
 
8
8
  end
9
9
 
data/lib/henry/task.rb CHANGED
@@ -6,7 +6,7 @@ module Henry
6
6
  class Task
7
7
 
8
8
  # Accessors for name, data and enabled
9
- attr_accessor :name, :data, :enabled
9
+ attr_accessor :name, :data, :enabled, :timeout
10
10
 
11
11
  # Returns an instance of the target Task class.
12
12
  # @note Factory to create X Task instances.
@@ -18,10 +18,11 @@ module Henry
18
18
 
19
19
  # Initialize the Task with the given name and data.
20
20
  def initialize(name, data)
21
- self.name = name
22
21
  self.data = OpenStruct.new(data)
23
22
  self.enabled = true
24
23
  self.execution.task_name = self.name
24
+ self.name = name
25
+ self.timeout = self.data.timeout || 18000 #The given timeout (in seconds) or 5 hours
25
26
  end
26
27
 
27
28
  # Code to be run just before the execution
@@ -0,0 +1 @@
1
+ {"summary":{"total":0,"breakdownByStatusCode":{"OK":0,"ERROR":0,"WARNING":0}, "result":"Oops, we were not able to generate a valid out.henry. Please email us at henry@despegar.com"},"tasks":[]}
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: henry-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.31
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Decurnex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-29 00:00:00.000000000 Z
11
+ date: 2013-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cucumber
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
@@ -56,70 +56,70 @@ dependencies:
56
56
  name: minitest-reporters
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: colorize
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: trollop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mail
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: yard
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: The Ruby Container for Henry
@@ -157,6 +157,7 @@ files:
157
157
  - spec/lib/henry/input_spec.rb
158
158
  - spec/support/files/email.file
159
159
  - spec/support/spec_helper.rb
160
+ - templates/errors/json_parse_error.json
160
161
  homepage: http://henry.despegar.it
161
162
  licenses: []
162
163
  metadata: {}
@@ -166,12 +167,12 @@ require_paths:
166
167
  - lib
167
168
  required_ruby_version: !ruby/object:Gem::Requirement
168
169
  requirements:
169
- - - ! '>='
170
+ - - '>='
170
171
  - !ruby/object:Gem::Version
171
172
  version: '0'
172
173
  required_rubygems_version: !ruby/object:Gem::Requirement
173
174
  requirements:
174
- - - ! '>='
175
+ - - '>='
175
176
  - !ruby/object:Gem::Version
176
177
  version: '0'
177
178
  requirements: []
checksums.yaml.gz.asc DELETED
@@ -1,11 +0,0 @@
1
- -----BEGIN PGP SIGNATURE-----
2
- Version: GnuPG v1.4.11 (GNU/Linux)
3
-
4
- iQEcBAABAgAGBQJRftZLAAoJEHEygQkPTV7SELIH/3WrND1dufSQQyDcq+UQ9wwe
5
- YEkOgQz0+F+jq22mBzMhsDoNE6hAwQn4ZUFlPZJRxzaCf5xIOP9PrIg32sqodlwk
6
- epnRs/6a0lQgMb+Fe5GhqEk2CoG7AvFCL0dzskbt9Z+Q6MbfaOP9lDKKv4iJ6IKD
7
- WJH5LutWd2t/nuCq9dSGuZ/aFuNO3BFdz2QYlrZQbJTWv1PcMVPHy5BKMEF80GIT
8
- M5wLDh5+fjhI27Dv7TQbIT9JQLRYPDT3K9NBsVD/Ufk6s43OG8f7vbNegDCb2USc
9
- h/gsCNj4QBUDMftGGNO4bePylMeXV0cFmOn5yPoaRswEJ1X0xWI0pohyDRyuIps=
10
- =9gFm
11
- -----END PGP SIGNATURE-----
data.tar.gz.asc DELETED
@@ -1,11 +0,0 @@
1
- -----BEGIN PGP SIGNATURE-----
2
- Version: GnuPG v1.4.11 (GNU/Linux)
3
-
4
- iQEcBAABAgAGBQJRftZLAAoJEHEygQkPTV7SVNAH/31AZNlRYbzL58TMGwEqqJZ8
5
- PMmkoANmt8VfU66FoLKnzETvZyAl7JmlcI0fchDmpCUydWEerZrecT/MveAFadSI
6
- T6NaegIFWS2pM184t7VOHDqsarcX84Gw8+5QJ2WDsdd1oS0/oSBvzBaoNAGzP8j1
7
- higv2b0EtAJL6nQMnVylHh37Icjcdcyq+q4I4NBWeKeBpcZKyI+1EUzGlMNH0CBT
8
- LiUN+LmU9mqkWkuWQoa5v2CZDOlxIfPwiSDuQRw3dNb/5/z6jXx+cHBVFkXf0xup
9
- pUxp3I2q8I8/fzXec3n6FhX6wcw8a3CvP/2aWHU4K30HgIsXtOgNdFVt3DixmYA=
10
- =9ei8
11
- -----END PGP SIGNATURE-----
metadata.gz.asc DELETED
@@ -1,11 +0,0 @@
1
- -----BEGIN PGP SIGNATURE-----
2
- Version: GnuPG v1.4.11 (GNU/Linux)
3
-
4
- iQEcBAABAgAGBQJRftY5AAoJEHEygQkPTV7SOe8H/is0N9orOl5RREzFcIMaWulH
5
- Bqj1mC84YZhNvJ6WUIFT1xqZCzr1gcgYZ3zl9FxO3RnJX8mj00Adz+ZndT8RwNDP
6
- Rq7qttDK9sdAw/FyXZznUFNL+vAe4T7ZtiNR/wp27xasAAeubQ9UhcrMiSBsWKvk
7
- jWd4s0xknTzyisIiKESKveSFYn874c09OP2K1wKtF6VnzUC6rL0DWo1VlPO8b4UT
8
- HQ9bSFF64bU4Hnwyu91rW+Cm0BeCd9cp0aIhucW2U6z5xKKiT8FH6XcBvLt+j9b+
9
- TlJtAcO3zaxixmjOaw8kML7d3QSiqslnAo6/qKhnBEzWjcsqVkhhwx7Xq6arHVE=
10
- =urZI
11
- -----END PGP SIGNATURE-----